Warning, file /network/ktp-contact-list/main-widget.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002  * This file is part of telepathy-contact-list
0003  *
0004  * Copyright (C) 2009-2010 Collabora Ltd. <info@collabora.co.uk>
0005  *   @Author George Goldberg <george.goldberg@collabora.co.uk>
0006  * Copyright (C) 2011 Martin Klapetek <martin.klapetek@gmail.com>
0007  * Copyright (C) 2011 Keith Rusler <xzekecomax@gmail.com>
0008  *
0009  * This library is free software; you can redistribute it and/or
0010  * modify it under the terms of the GNU Lesser General Public
0011  * License as published by the Free Software Foundation; either
0012  * version 2.1 of the License, or (at your option) any later version.
0013  *
0014  * This library is distributed in the hope that it will be useful,
0015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0017  * Lesser General Public License for more details.
0018  *
0019  * You should have received a copy of the GNU Lesser General Public
0020  * License along with this library; if not, write to the Free Software
0021  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
0022  */
0023 
0024 #ifndef TELEPATHY_CONTACTSLIST_MAIN_WIDGET_H
0025 #define TELEPATHY_CONTACTSLIST_MAIN_WIDGET_H
0026 
0027 #include <QWidget>
0028 #include <QStyledItemDelegate>
0029 
0030 #include <TelepathyQt/Types>
0031 
0032 #include <KXmlGuiWindow>
0033 #include <QAction>
0034 #include <KDualAction>
0035 #include "ui_main-widget.h"
0036 
0037 class ContextMenu;
0038 class ContactDelegateCompact;
0039 class GroupsModel;
0040 class QMenu;
0041 class KMenuBar;
0042 class KSelectAction;
0043 class AccountsModel;
0044 class AccountsFilterModel;
0045 class ContactDelegate;
0046 class FilterBar;
0047 class KJob;
0048 
0049 class MainWidget : public KMainWindow, Ui::MainWindow
0050 {
0051     Q_OBJECT
0052     //this is needed otherwise this class is exported as .ktp-contactlist interface
0053     //and dashes are not allowed in dbus interface names, so this interface would not work otherwise
0054     Q_CLASSINFO("D-Bus Interface", "org.kde.KTp.ContactList")
0055 public:
0056     MainWidget(QWidget *parent = 0);
0057     ~MainWidget();
0058 
0059     bool isPresencePlasmoidPresent() const;
0060 
0061     enum SystemMessageType {
0062         /*
0063          * this will show a system message to the user
0064          * but it will fade after short timout,
0065          * thus it should be used for non-important messages
0066          * like "Connecting..." etc.
0067          */
0068         SystemMessageInfo,
0069 
0070         /*
0071          * message with this class will stay visible until user
0072          * closes it and will have light-red background
0073          */
0074         SystemMessageError
0075     };
0076 
0077 public Q_SLOTS:
0078     void showMessageToUser(const QString &text, const SystemMessageType type);
0079     Q_INVOKABLE void toggleWindowVisibility();
0080 
0081 private Q_SLOTS:
0082     void toggleSearchWidget(bool show);
0083     void clearSearch();
0084     void onAccountManagerReady(Tp::PendingOperation *op);
0085     void onAddContactRequest();
0086     void onStartChatRequest();
0087     void onJoinChatRoomRequested();                 /** join chat room action is triggered */
0088     void onMakeCallRequested();
0089     void onMergeContactsDialogRequested();
0090     void onCustomContextMenuRequested(const QPoint &point);
0091     void onGenericOperationFinished(Tp::PendingOperation *operation);   /** called when a Tp::PendingOperation finishes. Used to check for errors */
0092     void onContactSelectionChanged();
0093     void onMetacontactToggleTriggered();
0094     void onModelInitialized(bool success);
0095 
0096 private:
0097     QStringList extractLinksFromIndex(const QModelIndex &index);    /** extract links from a QModelIndex pointing to a contact */
0098     ///Was moved to telepathy-kded-module
0099     //void handleConnectionError(const Tp::AccountPtr &account);      /** handle connection errors for given account. This method provides visual notification */
0100     void closeEvent(QCloseEvent *e);
0101     QAction *createAction(const QString &text, QObject *signalReceiver, const char *slot, const QIcon &icon);
0102     QAction *createAction(const QString &text, QObject *signalReceiver, const char *slot, bool isChecked, const QIcon &icon);
0103     void setupActions(const KConfigGroup&);
0104     void setupGlobalMenu();
0105     void setupToolBar();
0106     void setupTelepathy();
0107 
0108     QMenuBar               *m_globalMenu;
0109     QAction                *m_settingsDialog;
0110     QAction                *m_joinChatRoom;
0111     QAction                *m_makeCall;
0112     QAction                *m_mergeContacts;
0113     QActionGroup           *m_contactListTypeGroup;
0114     QActionGroup           *m_blockedFilterGroup;
0115 
0116     QMenu                  *m_accountMenu;
0117     KSelectAction          *m_setStatusAction;
0118 
0119     KDualAction            *m_metacontactToggleAction;
0120     QAction                *m_addContactAction;
0121     QActionGroup           *m_groupContactsActionGroup;
0122     KDualAction            *m_showOfflineAction;
0123     QAction                *m_searchContactAction;
0124     QAction                *m_startChatAction;
0125     KDualAction            *m_sortByPresenceAction;
0126     QAction                *m_quitAction;
0127 
0128     Tp::AccountManagerPtr  m_accountManager;
0129 
0130     ContextMenu            *m_contextMenu;
0131 };
0132 
0133 
0134 #endif // Header guard