1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
|
/*
* This file is part of telepathy-contact-list
*
* Copyright (C) 2009-2010 Collabora Ltd. <info@collabora.co.uk>
* @Author George Goldberg <george.goldberg@collabora.co.uk>
* Copyright (C) 2011 Martin Klapetek <martin.klapetek@gmail.com>
* Copyright (C) 2011 Keith Rusler <xzekecomax@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef TELEPATHY_CONTACTSLIST_MAIN_WIDGET_H
#define TELEPATHY_CONTACTSLIST_MAIN_WIDGET_H
#include <QWidget>
#include <QStyledItemDelegate>
#include <TelepathyQt/Types>
#include <KXmlGuiWindow>
#include <QAction>
#include <KDualAction>
#include "ui_main-widget.h"
class ContextMenu;
class ContactDelegateCompact;
class GroupsModel;
class QMenu;
class KMenuBar;
class KSelectAction;
class AccountsModel;
class AccountsFilterModel;
class ContactDelegate;
class FilterBar;
class KJob;
class MainWidget : public KMainWindow, Ui::MainWindow
{
Q_OBJECT
//this is needed otherwise this class is exported as .ktp-contactlist interface
//and dashes are not allowed in dbus interface names, so this interface would not work otherwise
Q_CLASSINFO("D-Bus Interface", "org.kde.KTp.ContactList")
public:
MainWidget(QWidget *parent = 0);
~MainWidget();
bool isPresencePlasmoidPresent() const;
bool isAnyAccountOnline() const;
enum SystemMessageType {
/*
* this will show a system message to the user
* but it will fade after short timout,
* thus it should be used for non-important messages
* like "Connecting..." etc.
*/
SystemMessageInfo,
/*
* message with this class will stay visible until user
* closes it and will have light-red background
*/
SystemMessageError
};
public Q_SLOTS:
void showMessageToUser(const QString &text, const SystemMessageType type);
void goOffline();
Q_INVOKABLE void toggleWindowVisibility();
private Q_SLOTS:
void toggleSearchWidget(bool show);
void clearSearch();
void onAccountManagerReady(Tp::PendingOperation *op);
void onAddContactRequest();
void onStartChatRequest();
void onJoinChatRoomRequested(); /** join chat room action is triggered */
void onMakeCallRequested();
void onMergeContactsDialogRequested();
void onCustomContextMenuRequested(const QPoint &point);
void onGenericOperationFinished(Tp::PendingOperation *operation); /** called when a Tp::PendingOperation finishes. Used to check for errors */
void onContactSelectionChanged();
void onMetacontactToggleTriggered();
void onModelInitialized(bool success);
private:
QStringList extractLinksFromIndex(const QModelIndex &index); /** extract links from a QModelIndex pointing to a contact */
///Was moved to telepathy-kded-module
//void handleConnectionError(const Tp::AccountPtr &account); /** handle connection errors for given account. This method provides visual notification */
void closeEvent(QCloseEvent *e);
QAction *createAction(const QString &text, QObject *signalReceiver, const char *slot, const QIcon &icon);
QAction *createAction(const QString &text, QObject *signalReceiver, const char *slot, bool isChecked, const QIcon &icon);
void setupActions(const KConfigGroup&);
void setupGlobalMenu();
void setupToolBar();
void setupTelepathy();
QMenuBar *m_globalMenu;
QAction *m_settingsDialog;
QAction *m_joinChatRoom;
QAction *m_makeCall;
QAction *m_mergeContacts;
QActionGroup *m_contactListTypeGroup;
QActionGroup *m_blockedFilterGroup;
QMenu *m_accountMenu;
KSelectAction *m_setStatusAction;
KDualAction *m_metacontactToggleAction;
QAction *m_addContactAction;
QActionGroup *m_groupContactsActionGroup;
KDualAction *m_showOfflineAction;
QAction *m_searchContactAction;
QAction *m_startChatAction;
KDualAction *m_sortByPresenceAction;
QAction *m_quitAction;
Tp::AccountManagerPtr m_accountManager;
ContextMenu *m_contextMenu;
};
#endif // Header guard
|