File indexing completed on 2023-11-26 04:55:36
0001 /* 0002 * This file is part of telepathy-accounts-kcm 0003 * 0004 * Copyright (C) 2009 Collabora Ltd. <info@collabora.com> 0005 * Copyright (C) 2011 Daniele E. Domenichelli <daniele.domenichelli@gmail.com> 0006 * 0007 * This library is free software; you can redistribute it and/or 0008 * modify it under the terms of the GNU Lesser General Public 0009 * License as published by the Free Software Foundation; either 0010 * version 2.1 of the License, or (at your option) any later version. 0011 * 0012 * This library is distributed in the hope that it will be useful, 0013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0015 * Lesser General Public License for more details. 0016 * 0017 * You should have received a copy of the GNU Lesser General Public 0018 * License along with this library; if not, write to the Free Software 0019 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 0020 */ 0021 0022 #ifndef TELEPATHY_ACCOUNTS_KCM_KCM_TELEPATHY_ACCOUNTS_H 0023 #define TELEPATHY_ACCOUNTS_KCM_KCM_TELEPATHY_ACCOUNTS_H 0024 0025 #include <KCModule> 0026 0027 #include <TelepathyQt/AccountManager> 0028 0029 class QFrame; 0030 class KPixmapSequenceOverlayPainter; 0031 class SalutEnabler; 0032 class AddAccountAssistant; 0033 class QSortFilterProxyModel; 0034 class QListView; 0035 class KProgressDialog; 0036 0037 namespace KTp { 0038 class AccountsListModel; 0039 class GlobalPresence; 0040 } 0041 0042 namespace Tp { 0043 class PendingOperation; 0044 } 0045 0046 namespace Ui { 0047 class MainWidget; 0048 } 0049 0050 class KCMTelepathyAccounts : public KCModule 0051 { 0052 Q_OBJECT 0053 Q_DISABLE_COPY(KCMTelepathyAccounts) 0054 0055 public: 0056 explicit KCMTelepathyAccounts(QWidget *parent = 0, 0057 const QVariantList& args = QVariantList()); 0058 virtual ~KCMTelepathyAccounts(); 0059 0060 0061 public Q_SLOTS: 0062 virtual void load(); 0063 0064 private Q_SLOTS: 0065 void onAccountManagerReady(Tp::PendingOperation *op); 0066 void onAccountEnabledChanged(const QModelIndex &index, bool enabled); 0067 void onSelectedItemChanged(const QModelIndex ¤t, const QModelIndex &previous); 0068 void onAddAccountClicked(); 0069 void onEditAccountClicked(); 0070 void onEditIdentityClicked(); 0071 void onRemoveAccountClicked(); 0072 void onModelDataChanged(const QModelIndex &index); 0073 void onSalutEnableButtonToggled(bool checked); 0074 void onSalutConnectionManagerReady(Tp::PendingOperation*); 0075 void onSalutInfoReady(); 0076 0077 void onSalutSetupDone(); 0078 void onOperationFinished(Tp::PendingOperation *op); 0079 0080 void onNewAccountAdded(const Tp::AccountPtr &account); 0081 void onLogsImportError(const QString&); 0082 void onLogsImportDone(); 0083 0084 private: 0085 Ui::MainWidget *m_ui; 0086 0087 Tp::AccountManagerPtr m_accountManager; 0088 KTp::AccountsListModel *m_accountsListModel; 0089 QSortFilterProxyModel *m_salutFilterModel; 0090 QSortFilterProxyModel *m_accountsFilterModel; 0091 const QSortFilterProxyModel *m_currentModel; 0092 const QListView *m_currentListView; 0093 KTp::GlobalPresence *m_globalPresence; 0094 0095 QWeakPointer<SalutEnabler> m_salutEnabler; 0096 KPixmapSequenceOverlayPainter *m_salutBusyWheel; 0097 0098 QPointer<KProgressDialog> m_importProgressDialog; 0099 }; 0100 0101 // Helper class for drawing error overlays 0102 class ErrorOverlay : public QWidget 0103 { 0104 Q_OBJECT 0105 public: 0106 explicit ErrorOverlay(QWidget *baseWidget, const QString &details, QWidget *parent = 0); 0107 ~ErrorOverlay(); 0108 0109 protected: 0110 bool eventFilter(QObject *object, QEvent *event); 0111 0112 private: 0113 void reposition(); 0114 0115 private: 0116 QWidget *m_BaseWidget; 0117 }; 0118 0119 #endif // header guard