Kontact Plugin Interface Library
uniqueapphandler.h
00001 /* 00002 This file is part of the KDE Kontact Plugin Interface Library. 00003 00004 Copyright (c) 2003,2008 David Faure <faure@kde.org> 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public 00008 License as published by the Free Software Foundation; either 00009 version 2 of the License, or (at your option) any later version. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Library General Public License for more details. 00015 00016 You should have received a copy of the GNU Library General Public License 00017 along with this library; see the file COPYING.LIB. If not, write to 00018 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 Boston, MA 02110-1301, USA. 00020 */ 00021 00022 #ifndef KONTACTINTERFACE_UNIQUEAPPHANDLER_H 00023 #define KONTACTINTERFACE_UNIQUEAPPHANDLER_H 00024 00025 #include "kontactinterface_export.h" 00026 #include "plugin.h" 00027 00028 namespace KontactInterface 00029 { 00030 00038 class KONTACTINTERFACE_EXPORT UniqueAppHandler : public QObject 00039 { 00040 Q_OBJECT 00041 // We implement the KUniqueApplication interface 00042 Q_CLASSINFO( "D-Bus Interface", "org.kde.KUniqueApplication" ) 00043 00044 public: 00045 UniqueAppHandler( Plugin *plugin ); 00046 virtual ~UniqueAppHandler(); 00047 00049 virtual void loadCommandLineOptions() = 0; 00050 00051 Plugin *plugin() const; 00052 00056 static void setMainWidget( QWidget *widget ); 00057 00062 QWidget *mainWidget(); 00063 00064 public Q_SLOTS: // DBUS methods 00065 int newInstance( const QByteArray &asn_id, const QByteArray &args ); 00066 bool load(); 00067 00068 protected: 00069 virtual int newInstance(); 00070 00071 private: 00072 class Private; 00073 Private *const d; 00074 }; 00075 00077 class UniqueAppHandlerFactoryBase 00078 { 00079 public: 00080 virtual ~UniqueAppHandlerFactoryBase(){} 00081 virtual UniqueAppHandler *createHandler( Plugin * ) = 0; 00082 }; 00083 00090 template <class T> class UniqueAppHandlerFactory : public UniqueAppHandlerFactoryBase 00091 { 00092 public: 00093 virtual UniqueAppHandler *createHandler( Plugin *plugin ) { 00094 plugin->registerClient(); 00095 return new T( plugin ); 00096 } 00097 }; 00098 00106 class KONTACTINTERFACE_EXPORT UniqueAppWatcher : public QObject 00107 { 00108 Q_OBJECT 00109 00110 public: 00120 UniqueAppWatcher( UniqueAppHandlerFactoryBase *factory, Plugin *plugin ); 00121 00122 virtual ~UniqueAppWatcher(); 00123 00124 bool isRunningStandalone() const; 00125 00126 private Q_SLOTS: 00127 void slotApplicationRemoved( const QString &name, const QString &oldOwner, 00128 const QString &newOwner ); 00129 00130 private: 00131 class Private; 00132 Private *const d; 00133 }; 00134 00135 } // namespace 00136 00137 #endif 00138
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Mon May 14 2012 04:51:33 by doxygen 1.7.5 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2012 The KDE developers.
Generated on Mon May 14 2012 04:51:33 by doxygen 1.7.5 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.