File indexing completed on 2019-04-16 12:20:17

0001 /***************************************************************************
0002  *   Copyright (C) 2007 by Pino Toscano <pino@kde.org>                     *
0003  *                                                                         *
0004  *   This program is free software; you can redistribute it and/or modify  *
0005  *   it under the terms of the GNU General Public License as published by  *
0006  *   the Free Software Foundation; either version 2 of the License, or     *
0007  *   (at your option) any later version.                                   *
0008  ***************************************************************************/
0009 
0010 #ifndef _OKULAR_CONFIGINTERFACE_H_
0011 #define _OKULAR_CONFIGINTERFACE_H_
0012 
0013 #include "../core/okularcore_export.h"
0014 
0015 #include <QObject>
0016 
0017 class KConfigDialog;
0018 
0019 namespace Okular {
0020 
0021 /**
0022  * @short Abstract interface for configuration control
0023  *
0024  * This interface defines a way to configure the Generator itself.
0025  *
0026  * How to use it in a custom Generator:
0027  * @code
0028     class MyGenerator : public Okular::Generator, public Okular::ConfigInterface
0029     {
0030         Q_OBJECT
0031         Q_INTERFACES( Okular::ConfigInterface )
0032 
0033         ...
0034     };
0035  * @endcode
0036  * and - of course - implementing its methods.
0037  */
0038 class OKULARCORE_EXPORT ConfigInterface
0039 {
0040     public:
0041         /**
0042          * Destroys the config interface.
0043          */
0044         virtual ~ConfigInterface() {}
0045 
0046         /**
0047          * This method is called to tell the generator to re-parse its configuration.
0048          *
0049          * Returns true if something has changed.
0050          *
0051          * @note this method can be called also when the generator is not the
0052          * active generator, or when there was not changed in the config added
0053          * by the generator itself. So the suggestion is to @b check whether
0054          * something changed, and only in that case return @p true
0055          */
0056         virtual bool reparseConfig() = 0;
0057 
0058         /**
0059          * This method allows the generator to add custom configuration pages to the
0060          * config @p dialog of okular.
0061          */
0062         virtual void addPages( KConfigDialog *dialog ) = 0;
0063 };
0064 
0065 }
0066 
0067 Q_DECLARE_INTERFACE( Okular::ConfigInterface, "org.kde.okular.ConfigInterface/0.1" )
0068 
0069 #endif