kmobiletools
addressbook.h
Go to the documentation of this file.00001 /*************************************************************************** 00002 Copyright (C) 2007 by Matthias Lechner <matthias@lmme.de> 00003 00004 This program is free software; you can redistribute it and/or modify 00005 it under the terms of the GNU General Public License as published by 00006 the Free Software Foundation; either version 2 of the License, or 00007 (at your option) any later version. 00008 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 GNU General Public License for more details. 00013 00014 You should have received a copy of the GNU General Public License 00015 along with this program; if not, write to the 00016 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 Boston, MA 02110-1301, USA. 00018 ***************************************************************************/ 00019 00020 #ifndef ADDRESSBOOK_H 00021 #define ADDRESSBOOK_H 00022 00023 #include <KLibFactory> 00024 #include <KAction> 00025 #include <klistwidgetsearchline.h> 00026 #include <KTextBrowser> 00027 00028 #include <libkmobiletools/coreservice.h> 00029 #include <libkmobiletools/ifaces/guiservice.h> 00030 #include <libkmobiletools/ifaces/actionprovider.h> 00031 00032 #include <libkmobiletools/addressbookentry.h> 00033 00034 #include <QtCore/QObject> 00035 #include <QtCore/QString> 00036 #include <QtCore/QHash> 00037 #include <QtCore/QTimer> 00038 #include <QtGui/QIcon> 00039 #include <QtGui/QWidget> 00040 #include <QtGui/QListWidget> 00041 #include <QtCore/QMutex> 00042 00043 #include "addaddresseedialog.h" 00044 00045 namespace KMobileTools { 00046 class EngineXP; 00047 namespace Ifaces { 00048 class Addressbook; 00049 } 00050 } 00051 class QPoint; 00059 class Addressbook : public KMobileTools::CoreService, // base class 00060 public KMobileTools::Ifaces::GuiService, // interfaces 00061 public KMobileTools::Ifaces::ActionProvider 00062 { 00063 Q_OBJECT 00064 Q_INTERFACES(KMobileTools::Ifaces::GuiService KMobileTools::Ifaces::ActionProvider) 00065 00066 public: 00067 Addressbook( QObject* parent, const QString& deviceName ); 00068 ~Addressbook(); 00069 00075 QString name() const; 00076 00082 KIcon icon() const; 00083 00089 QWidget* widget() const; 00090 00097 QStringList requires() const; 00098 00104 QList<QAction*> actionList() const; 00105 00106 Q_SIGNALS: 00107 void foundAvailableSlots( KMobileTools::AddressbookEntry::MemorySlots ); 00108 00109 public Q_SLOTS: 00110 void addEntry( const KMobileTools::AddressbookEntry& entry ); 00111 void removeEntry( const KMobileTools::AddressbookEntry& entry ); 00112 00113 private Q_SLOTS: 00114 void cleanUpItems(); 00115 00116 void requestEntryAddition(); 00117 void requestEntryAddition( const KMobileTools::AddressbookEntry& entry ); 00118 void requestEntryEditing(); 00119 void requestEntryRemoval(); 00120 00121 void checkEnableActions(); 00122 00123 void findAvailableSlots(); 00124 00125 void addresseeListContextMenu( const QPoint& position ); 00126 void addresseeActivated( QListWidgetItem* item ); 00127 00128 private: 00129 void setupWidget(); 00130 void setupActions(); 00131 00133 QTimer* m_fetchTimer; 00134 00135 KMobileTools::EngineXP* m_engine; 00136 KMobileTools::Ifaces::Addressbook* m_addressbook; 00137 00138 QWidget* m_widget; 00139 QString m_deviceName; 00140 QList<QAction*> m_actionList; 00141 00142 AddAddresseeDialog* m_addAddresseeDialog; 00143 00144 QList<QListWidgetItem*> m_pendingItems; 00145 QMutex m_mutex; 00146 00147 // gui 00148 KListWidgetSearchLine* m_addresseeSearch; 00149 QListWidget* m_addresseeList; 00150 KTextBrowser* m_addresseeDetails; 00151 00152 // actions 00153 QAction* m_newContact; 00154 QAction* m_editContact; 00155 QAction* m_deleteContact; 00156 }; 00157 00158 class AddressbookFactory : public KPluginFactory 00159 { 00160 Q_OBJECT 00161 public: 00162 AddressbookFactory(); 00163 virtual ~AddressbookFactory(); 00164 virtual QObject *create( 00165 const char *iface, QWidget *parentWidget, QObject *parent, const QVariantList &args, const QString &keyword ); 00166 }; 00167 00168 #endif
KDE 4.2 API Reference