From e98d90ad44957e5e59ddf107293a178235f9d311 Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage <emmanuel.lepage@savoirfairelinux.com> Date: Fri, 30 Sep 2011 11:17:51 -0400 Subject: [PATCH] More polishing for release --- kde/data/sflphone-client-kdeui.rc | 1 + kde/src/AccountListModel.cpp | 1 + kde/src/AccountListModel.h | 8 +- kde/src/AccountView.cpp | 14 ++- kde/src/AccountView.h | 9 +- kde/src/AccountWizard.cpp | 4 + kde/src/AccountWizard.h | 9 +- kde/src/AkonadiBackend.cpp | 21 +++- kde/src/AkonadiBackend.h | 20 ++-- kde/src/CallView.cpp | 11 +- kde/src/CallView.h | 15 +-- kde/src/SFLPhone.cpp | 147 ++++++++++++++++---------- kde/src/SFLPhone.h | 93 ++++++++-------- kde/src/SFLPhoneView.cpp | 57 ++++------ kde/src/SFLPhoneView.h | 85 +++++---------- kde/src/SFLPhoneapplication.cpp | 8 +- kde/src/conf/dlgaccounts.cpp | 1 + kde/src/lib/Account.cpp | 2 + kde/src/lib/Account.h | 4 +- kde/src/lib/AccountList.cpp | 2 +- kde/src/lib/Call.cpp | 3 +- kde/src/lib/Call.h | 11 +- kde/src/lib/CallModel.cpp | 1 + kde/src/lib/CallModel.h | 27 ++--- kde/src/lib/CallModel.hpp | 15 +++ kde/src/lib/Contact.cpp | 6 ++ kde/src/lib/Contact.h | 20 ++-- kde/src/lib/ContactBackend.h | 1 + kde/src/main.cpp | 2 +- kde/src/widgets/BookmarkDock.cpp | 5 +- kde/src/widgets/BookmarkDock.h | 8 +- kde/src/widgets/CallTreeItem.cpp | 27 ++++- kde/src/widgets/CallTreeItem.h | 25 ++--- kde/src/widgets/ContactDock.cpp | 29 +++-- kde/src/widgets/ContactDock.h | 30 ++++-- kde/src/widgets/ContactItemWidget.cpp | 97 +++++++++-------- kde/src/widgets/ContactItemWidget.h | 28 ++--- kde/src/widgets/Dialpad.cpp | 36 ++++--- kde/src/widgets/Dialpad.h | 32 +++--- kde/src/widgets/HistoryDock.cpp | 18 ++-- kde/src/widgets/HistoryDock.h | 18 ++-- kde/src/widgets/HistoryTreeItem.cpp | 55 +++++----- kde/src/widgets/HistoryTreeItem.h | 17 ++- kde/src/widgets/SFLPhoneTray.cpp | 3 + kde/src/widgets/SFLPhoneTray.h | 10 +- 45 files changed, 588 insertions(+), 448 deletions(-) diff --git a/kde/data/sflphone-client-kdeui.rc b/kde/data/sflphone-client-kdeui.rc index 9c1a57fe71..2485812adb 100755 --- a/kde/data/sflphone-client-kdeui.rc +++ b/kde/data/sflphone-client-kdeui.rc @@ -30,6 +30,7 @@ <Action name="action_displayVolumeControls" /> <Action name="action_displayDialpad" /> <Separator /> + <Action name="action_configureShortcut" /> <Action name="action_configureSflPhone" /> <Separator /> <Action name="action_accountCreationWizard" /> diff --git a/kde/src/AccountListModel.cpp b/kde/src/AccountListModel.cpp index e65968e331..b5b4ad6d81 100755 --- a/kde/src/AccountListModel.cpp +++ b/kde/src/AccountListModel.cpp @@ -21,6 +21,7 @@ #include "AccountListModel.h" #include "lib/sflphone_const.h" +#include "conf/ConfigAccountList.h" #include <QDebug> AccountListModel::AccountListModel(QObject *parent) diff --git a/kde/src/AccountListModel.h b/kde/src/AccountListModel.h index 5de0fd28da..2d70f68e2d 100755 --- a/kde/src/AccountListModel.h +++ b/kde/src/AccountListModel.h @@ -23,7 +23,8 @@ #include <QAbstractListModel> -#include "conf/ConfigAccountList.h" +//SFLPhone +class ConfigAccountList; /** @author Jérémy Quentin <jeremy.quentin@gmail.com> @@ -41,8 +42,6 @@ public: QVariant data ( const QModelIndex & index, int role = Qt::DisplayRole ) const; int rowCount(const QModelIndex & parent = QModelIndex()) const; -// int columnCount(const QModelIndex & parent = QModelIndex()) const; -// QVariant headerData(int section , Qt::Orientation orientation, int role) const; Qt::ItemFlags flags(const QModelIndex & index) const; virtual bool setData ( const QModelIndex & index, const QVariant &value, int role); @@ -52,9 +51,6 @@ public: bool addAccount( QString alias ); QString getOrderedList() const; -// QStringList getActiveCodecList() const ; -// void setActiveCodecList(const QStringList & activeCodecListToSet); - }; #endif diff --git a/kde/src/AccountView.cpp b/kde/src/AccountView.cpp index 9e1af78d7d..015dfaea38 100644 --- a/kde/src/AccountView.cpp +++ b/kde/src/AccountView.cpp @@ -1,15 +1,17 @@ #include "AccountView.h" #include <QDebug> - +#include <QtGui/QListWidgetItem> #include "lib/sflphone_const.h" #include "lib/configurationmanager_interface_singleton.h" +///Constructor AccountView::AccountView() : Account(), item2(0), itemWidget(0) { } +///Init void AccountView::initItem() { if(item2 != NULL) @@ -20,6 +22,7 @@ void AccountView::initItem() initItemWidget(); } +///Init widget void AccountView::initItemWidget() { if(itemWidget != NULL) @@ -39,16 +42,19 @@ void AccountView::initItemWidget() connect(itemWidget, SIGNAL(checkStateChanged(bool)), this, SLOT(setEnabled(bool))); } +///Get the current item QListWidgetItem* AccountView::getItem() { return item2; } +///Get the current widget AccountItemWidget* AccountView::getItemWidget() { return itemWidget; } +///Return the state color QColor AccountView::getStateColor() { if(getAccountDetail(ACCOUNT_STATUS) == ACCOUNT_STATE_UNREGISTERED) @@ -58,7 +64,7 @@ QColor AccountView::getStateColor() return Qt::red; } - +///Get the color name QString AccountView::getStateColorName() { if(getAccountDetail(ACCOUNT_STATUS) == ACCOUNT_STATE_UNREGISTERED) @@ -68,11 +74,13 @@ QString AccountView::getStateColorName() return "red"; } +///Is this item checked? bool AccountView::isChecked() const { return itemWidget->getEnabled(); } +///Build an item from an account id AccountView* AccountView::buildExistingAccountFromId(QString _accountId) { //Account* a = Account::buildExistingAccountFromId( _accountId); @@ -84,6 +92,7 @@ AccountView* AccountView::buildExistingAccountFromId(QString _accountId) return a; } +///Build an item from an alias AccountView* AccountView::buildNewAccountFromAlias(QString alias) { //Account* a = Account::buildNewAccountFromAlias(alias); @@ -94,6 +103,7 @@ AccountView* AccountView::buildNewAccountFromAlias(QString alias) return a; } +///Change LED color void AccountView::updateState() { qDebug() << "updateState"; diff --git a/kde/src/AccountView.h b/kde/src/AccountView.h index f13bf523be..e3911997ce 100644 --- a/kde/src/AccountView.h +++ b/kde/src/AccountView.h @@ -1,12 +1,15 @@ #ifndef ACCOUNT_VIEW_H #define ACCOUNT_VIEW_H -#include <QtGui/QListWidgetItem> - #include "lib/Item.h" #include "lib/Account.h" #include "widgets/AccountItemWidget.h" -#include "lib/sflphone_const.h" + +//Qt +class QListWidgetItem; + +//SFLPhone +class AccountItemWidget; class AccountView : public Account, public Item<AccountItemWidget> { public: diff --git a/kde/src/AccountWizard.cpp b/kde/src/AccountWizard.cpp index 8c44a3fadf..904f3b75d7 100755 --- a/kde/src/AccountWizard.cpp +++ b/kde/src/AccountWizard.cpp @@ -24,6 +24,10 @@ #include <QFormLayout> #include "lib/sflphone_const.h" #include "lib/configurationmanager_interface_singleton.h" +#include <QLabel> +#include <QRadioButton> +#include <QLineEdit> +#include <QCheckBox> #include <klocale.h> diff --git a/kde/src/AccountWizard.h b/kde/src/AccountWizard.h index 8700099317..f1671b7fdb 100755 --- a/kde/src/AccountWizard.h +++ b/kde/src/AccountWizard.h @@ -22,11 +22,12 @@ #define ACCOUNTWIZARD_H #include <QWizard> -#include <QLabel> -#include <QRadioButton> -#include <QLineEdit> -#include <QCheckBox> +//Qt +class QLabel; +class QRadioButton; +class QLineEdit; +class QCheckBox; /** @author Jérémy Quentin <jeremy.quentin@savoirfairelinux.com> diff --git a/kde/src/AkonadiBackend.cpp b/kde/src/AkonadiBackend.cpp index 0f96b12a28..5b37a36c45 100644 --- a/kde/src/AkonadiBackend.cpp +++ b/kde/src/AkonadiBackend.cpp @@ -2,7 +2,6 @@ #include <QtCore/QTimer> #include <akonadi/control.h> #include <akonadi/collectionfilterproxymodel.h> -#include <akonadi/collectionmodel.h> #include <akonadi/kmime/messagemodel.h> #include <kabc/contactgroup.h> #include <kabc/phonenumber.h> @@ -13,11 +12,19 @@ #include <akonadi/contact/contacteditor.h> #include <kdialog.h> +#include <QObject> +#include <akonadi/session.h> +#include <kabc/addressee.h> +#include <kabc/addresseelist.h> + #include "lib/Contact.h" #include "SFLPhone.h" +#include "SFLPhoneView.h" +///Init static attributes AkonadiBackend* AkonadiBackend::m_pInstance = 0; +///Constructor AkonadiBackend::AkonadiBackend(QObject* parent) : ContactBackend(parent) { //QTimer::singleShot( 0, this, SLOT( delayedInit() ) ); @@ -29,11 +36,13 @@ AkonadiBackend::AkonadiBackend(QObject* parent) : ContactBackend(parent) connect( job, SIGNAL( collectionsReceived( const Akonadi::Collection::List& ) ), this, SLOT( collectionsReceived( const Akonadi::Collection::List& ) ) ); } +///Destructor AkonadiBackend::~AkonadiBackend() { } +///Singleton ContactBackend* AkonadiBackend::getInstance() { if (m_pInstance == NULL) { @@ -42,6 +51,7 @@ ContactBackend* AkonadiBackend::getInstance() return m_pInstance; } +///Update the contact list when a new Akonadi collection is added ContactList AkonadiBackend::update(Akonadi::Collection collection) { m_pCollection = collection; @@ -95,22 +105,25 @@ ContactList AkonadiBackend::update(Akonadi::Collection collection) return contacts; } +///Update the contact list even without a new collection ContactList AkonadiBackend::update_slot() { return update(m_pCollection); } - +///Find contact using a phone number Contact* AkonadiBackend::getContactByPhone(QString phoneNumber) { return m_pContactByPhone[phoneNumber]; } +///Find contact by UID Contact* AkonadiBackend::getContactByUid(QString uid) { return m_pContactByUid[uid]; } +///Called when a new collection is added void AkonadiBackend::collectionsReceived( const Akonadi::Collection::List& list) { foreach (Akonadi::Collection coll, list) { @@ -119,6 +132,7 @@ void AkonadiBackend::collectionsReceived( const Akonadi::Collection::List& list } } +///Edit backend value using an updated frontend contact void AkonadiBackend::editContact(Contact* contact) { KABC::Addressee ct = m_pAddrHash[contact->getUid()]; @@ -135,6 +149,7 @@ void AkonadiBackend::editContact(Contact* contact) dlg->exec(); } +///Add a new contact void AkonadiBackend::addNewContact(Contact* contact) { KABC::Addressee newContact; @@ -177,8 +192,6 @@ void AkonadiBackend::addNewContact(Contact* contact) dlg->setMainWidget(editor); dlg->exec(); - - if ( !editor->saveContact() ) { qDebug() << "Unable to save new contact to storage"; return; diff --git a/kde/src/AkonadiBackend.h b/kde/src/AkonadiBackend.h index cc2ddb4a24..fdc97e6305 100644 --- a/kde/src/AkonadiBackend.h +++ b/kde/src/AkonadiBackend.h @@ -1,19 +1,27 @@ #ifndef AKONADI_BACKEND_H #define AKONADI_BACKEND_H -#include <QObject> -#include <akonadi/session.h> -#include <akonadi/collectionmodel.h> -#include <kabc/addressee.h> -#include <kabc/addresseelist.h> #include <lib/ContactBackend.h> +#include <akonadi/collectionmodel.h> -class Contact; +//Qt +class QObject; +//KDE namespace KABC { class Addressee; + class AddresseeList; } +namespace Akonadi { + class Session; + class CollectionModel; + class Collection; +} + +//SFLPhone +class Contact; + typedef QList<Contact*> ContactList; class AkonadiBackend : public ContactBackend { diff --git a/kde/src/CallView.cpp b/kde/src/CallView.cpp index 2817b7562d..a68334add4 100644 --- a/kde/src/CallView.cpp +++ b/kde/src/CallView.cpp @@ -1,19 +1,20 @@ #include "CallView.h" #include "AkonadiBackend.h" #include "lib/Contact.h" +#include "lib/sflphone_const.h" +#include "lib/callmanager_interface_singleton.h" +#include "widgets/CallTreeItem.h" #include "SFLPhone.h" +#include "SFLPhoneView.h" #include <QtGui/QInputDialog> +#include <QtGui/QTreeWidget> +#include <QtGui/QTreeWidgetItem> ///Retrieve current and older calls from the daemon, fill history and the calls TreeView and enable drag n' drop CallView::CallView(QWidget* parent) : QTreeWidget(parent) { -// if (type == ActiveCall) -// SFLPhone::model()->initCall(); -// else if (type == History) -// SFLPhone::model()->initHistory(); - //Widget part setAcceptDrops(true); setDragEnabled(true); diff --git a/kde/src/CallView.h b/kde/src/CallView.h index cb54f7b95e..f2fb282935 100644 --- a/kde/src/CallView.h +++ b/kde/src/CallView.h @@ -1,14 +1,15 @@ #ifndef CALL_VIEW #define CALL_VIEW -#include <QTreeWidget> -#include <QTreeWidgetItem> -#include <QItemDelegate> - +#include <QtGui/QItemDelegate> +#include <QtGui/QTreeWidget> #include "lib/CallModel.h" -#include "lib/sflphone_const.h" -#include "lib/callmanager_interface_singleton.h" -#include "widgets/CallTreeItem.h" + +//Qt +class QTreeWidgetItem; + +//SFLPhone +class CallTreeItem; class CallTreeItemDelegate : public QItemDelegate { diff --git a/kde/src/SFLPhone.cpp b/kde/src/SFLPhone.cpp index ab696b09bc..2dbde9b648 100755 --- a/kde/src/SFLPhone.cpp +++ b/kde/src/SFLPhone.cpp @@ -1,4 +1,4 @@ -/************************************** ************************************* +/************************************** ************************************ * Copyright (C) 2009-2010 by Savoir-Faire Linux * * Author : Jérémy Quentin <jeremy.quentin@savoirfairelinux.com> * * Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com>* @@ -17,7 +17,7 @@ * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ + **************************************************************************/ #include <unistd.h> #include "SFLPhone.h" @@ -31,6 +31,16 @@ #include <QtGui/QStatusBar> #include <QtGui/QCursor> #include <KActionCollection> +#include <QtCore/QString> +#include <QtGui/QListWidgetItem> +#include <QtGui/QKeyEvent> +#include <QErrorMessage> +#include <KSystemTrayIcon> +#include <KNotification> +#include <QActionGroup> +#include <QLabel> +#include <QListWidget> +#include <kshortcutsdialog.h> #include "lib/sflphone_const.h" #include "lib/instance_interface_singleton.h" @@ -38,28 +48,46 @@ #include "lib/Contact.h" #include "AkonadiBackend.h" #include "conf/ConfigurationSkeleton.h" +#include "widgets/ContactDock.h" +#include "AccountWizard.h" +#include "widgets/HistoryDock.h" +#include "widgets/BookmarkDock.h" +#include "lib/Contact.h" +#include "SFLPhoneView.h" +#include "widgets/SFLPhoneTray.h" SFLPhone* SFLPhone::m_sApp = NULL; TreeWidgetCallModel* SFLPhone::m_pModel = NULL; +///Constructor SFLPhone::SFLPhone(QWidget *parent) : KXmlGuiWindow(parent), - initialized_(false), + m_pInitialized(false), m_pView(new SFLPhoneView(this)) { setupActions(); m_sApp = this; } +///Destructor +SFLPhone::~SFLPhone() +{ + //saveState(); +} + +///Singleton SFLPhone* SFLPhone::app() { return m_sApp; } +///Get the view (to be used with the singleton) SFLPhoneView* SFLPhone::view() { return m_pView; } + +///Singleton TreeWidgetCallModel* SFLPhone::model() { if (!m_pModel) { @@ -70,29 +98,28 @@ TreeWidgetCallModel* SFLPhone::model() return m_pModel; } +///Return the contact dock ContactDock* SFLPhone::contactDock() { return m_pContactCD; } +///Return the history dock HistoryDock* SFLPhone::historyDock() { return m_pHistoryDW; } +///Return the bookmark dock BookmarkDock* SFLPhone::bookmarkDock() { return m_pBookmarkDW; } -SFLPhone::~SFLPhone() -{ - //saveState(); -} - +///Init everything bool SFLPhone::initialize() { - if ( initialized_ ) { + if ( m_pInitialized ) { qDebug() << "Already initialized."; return false; } @@ -111,15 +138,14 @@ bool SFLPhone::initialize() addDockWidget(Qt::TopDockWidgetArea,m_pContactCD); // tell the KXmlGuiWindow that this is indeed the main widget - //setCentralWidget(m_pView); m_pCentralDW = new QDockWidget(this); - m_pCentralDW->setObjectName("callDock"); - m_pCentralDW->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); - m_pCentralDW->setWidget(m_pView); - m_pCentralDW->setWindowTitle("Call"); - m_pCentralDW->setFeatures(QDockWidget::NoDockWidgetFeatures); - m_pView->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); - m_pCentralDW->setStyleSheet("\ + m_pCentralDW->setObjectName ( "callDock" ); + m_pCentralDW->setSizePolicy ( QSizePolicy::Expanding,QSizePolicy::Expanding ); + m_pCentralDW->setWidget ( m_pView ); + m_pCentralDW->setWindowTitle ( i18n("Call") ); + m_pCentralDW->setFeatures ( QDockWidget::NoDockWidgetFeatures ); + m_pView->setSizePolicy ( QSizePolicy::Expanding,QSizePolicy::Expanding ); + m_pCentralDW->setStyleSheet ( "\ QDockWidget::title {\ margin:0px;\ padding:0px;\ @@ -135,55 +161,54 @@ bool SFLPhone::initialize() addDockWidget(Qt::TopDockWidgetArea,m_pCentralDW); - m_pHistoryDW = new HistoryDock(this); - m_pBookmarkDW = new BookmarkDock(this); - addDockWidget( Qt::TopDockWidgetArea,m_pHistoryDW ); - addDockWidget( Qt::TopDockWidgetArea,m_pBookmarkDW ); - tabifyDockWidget(m_pBookmarkDW,m_pHistoryDW); + m_pHistoryDW = new HistoryDock(this); + m_pBookmarkDW = new BookmarkDock(this); + addDockWidget( Qt::TopDockWidgetArea,m_pHistoryDW ); + addDockWidget( Qt::TopDockWidgetArea,m_pBookmarkDW ); + tabifyDockWidget(m_pBookmarkDW,m_pHistoryDW); setWindowIcon(QIcon(ICON_SFLPHONE)); setWindowTitle(i18n("SFLphone")); setupActions(); - statusBarWidget = new QLabel(); - statusBar()->addWidget(statusBarWidget); + m_pStatusBarWidget = new QLabel(); + statusBar()->addWidget(m_pStatusBarWidget); - trayIcon = new SFLPhoneTray(this->windowIcon(), this); - trayIcon->show(); + m_pTrayIcon = new SFLPhoneTray(this->windowIcon(), this); + m_pTrayIcon->show(); - iconChanged = false; + m_pIconChanged = false; setObjectNames(); QMetaObject::connectSlotsByName(this); m_pView->loadWindow(); move(QCursor::pos().x() - geometry().width()/2, QCursor::pos().y() - geometry().height()/2); - //if( ! configurationManager.isStartHidden()) { show(); - //} if(configurationManager.getAccountList().value().isEmpty()) { (new AccountWizard())->show(); } - initialized_ = true; + m_pInitialized = true; return true; } +///Set widgets object name void SFLPhone::setObjectNames() { - m_pView->setObjectName ( "m_pView" ); - statusBar()->setObjectName ( "statusBar" ); - trayIcon->setObjectName ( "trayIcon" ); + m_pView->setObjectName ( "m_pView" ); + statusBar()->setObjectName ( "statusBar" ); + m_pTrayIcon->setObjectName ( "trayIcon" ); } +///Setup evry actions void SFLPhone::setupActions() { qDebug() << "setupActions"; - //ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); action_accept = new KAction(this); action_refuse = new KAction(this); @@ -203,8 +228,8 @@ void SFLPhone::setupActions() action_screen->setExclusive(true); action_main = new KAction(KIcon(QIcon(ICON_SCREEN_MAIN)), i18n("Main screen"), action_screen); - action_main->setCheckable(true); - action_main->setChecked(true); + action_main->setCheckable( true ); + action_main->setChecked ( true ); action_screen->addAction(action_main); action_close = KStandardAction::close(this, SLOT(close()), this); @@ -214,14 +239,17 @@ void SFLPhone::setupActions() action_configureSflPhone->setText(i18n("Configure SFLphone")); action_displayDialpad = new KAction(KIcon(QIcon(ICON_DISPLAY_DIALPAD)), i18n("Display dialpad"), this); - action_displayDialpad->setCheckable(true); - action_displayDialpad->setChecked(ConfigurationSkeleton::displayDialpad()); + action_displayDialpad->setCheckable( true ); + action_displayDialpad->setChecked ( ConfigurationSkeleton::displayDialpad() ); action_displayVolumeControls = new KAction(KIcon(QIcon(ICON_DISPLAY_VOLUME_CONSTROLS)), i18n("Display volume controls"), this); - action_displayVolumeControls->setCheckable(true); - action_displayVolumeControls->setChecked(ConfigurationSkeleton::displayVolume()); + action_displayVolumeControls->setCheckable( true ); + action_displayVolumeControls->setChecked ( ConfigurationSkeleton::displayVolume() ); action_accountCreationWizard = new KAction(i18n("Account creation wizard"), this); + + + action_configureShortcut = new KAction(KIcon(KIcon("configure-shortcuts")), i18n("Configure Shortcut"), this); connect(action_accept, SIGNAL(triggered()), m_pView , SLOT(accept() )); connect(action_refuse, SIGNAL(triggered()), m_pView , SLOT(refuse() )); @@ -233,6 +261,7 @@ void SFLPhone::setupActions() connect(action_displayVolumeControls, SIGNAL(toggled(bool)), m_pView , SLOT(displayVolumeControls(bool) )); connect(action_displayDialpad, SIGNAL(toggled(bool)), m_pView , SLOT(displayDialpad(bool) )); connect(action_accountCreationWizard, SIGNAL(triggered()), m_pView , SLOT(accountCreationWizard() )); + connect(action_configureShortcut, SIGNAL(triggered()), this , SLOT(showShortCutEditor() )); action_screen->addAction(action_main); @@ -249,17 +278,17 @@ void SFLPhone::setupActions() actionCollection()->addAction("action_displayDialpad" , action_displayDialpad ); actionCollection()->addAction("action_configureSflPhone" , action_configureSflPhone ); actionCollection()->addAction("action_accountCreationWizard" , action_accountCreationWizard ); + actionCollection()->addAction("action_configureShortcut" , action_configureShortcut ); setAutoSaveSettings(); createGUI(); - } -SFLPhoneView * SFLPhone::getView() -{ - return m_pView; +void SFLPhone::showShortCutEditor() { + KShortcutsDialog::configure( actionCollection() ); } +///[Action]Hide sflphone bool SFLPhone::queryClose() { qDebug() << "queryClose"; @@ -267,31 +296,35 @@ bool SFLPhone::queryClose() return false; } +///[Action] Quit action void SFLPhone::quitButton() { - m_pView->saveState(); qApp->quit(); } +///Called when something happen void SFLPhone::changeEvent(QEvent* event) { - if (event->type() == QEvent::ActivationChange && iconChanged && isActiveWindow()) { - iconChanged = false; + if (event->type() == QEvent::ActivationChange && m_pIconChanged && isActiveWindow()) { + m_pIconChanged = false; } } +///Change status message void SFLPhone::on_m_pView_statusMessageChangeAsked(const QString & message) { qDebug() << "on_m_pView_statusMessageChangeAsked : " + message; - statusBarWidget->setText(message); + m_pStatusBarWidget->setText(message); } +///Change windowtitle void SFLPhone::on_m_pView_windowTitleChangeAsked(const QString & message) { qDebug() << "on_m_pView_windowTitleChangeAsked : " + message; setWindowTitle(message); } +///Enable or disable toolbar items void SFLPhone::on_m_pView_enabledActionsChangeAsked(const bool * enabledActions) { qDebug() << "on_m_pView_enabledActionsChangeAsked"; @@ -303,6 +336,7 @@ void SFLPhone::on_m_pView_enabledActionsChangeAsked(const bool * enabledActions) action_mailBox->setVisible ( enabledActions[SFLPhone::Mailbox ]); } +///Change icons void SFLPhone::on_m_pView_actionIconsChangeAsked(const QString * actionIcons) { qDebug() << "on_m_pView_actionIconsChangeAsked"; @@ -314,6 +348,7 @@ void SFLPhone::on_m_pView_actionIconsChangeAsked(const QString * actionIcons) action_mailBox->setIcon ( QIcon(actionIcons[SFLPhone::Mailbox ])); } +///Change text void SFLPhone::on_m_pView_actionTextsChangeAsked(const QString * actionTexts) { qDebug() << "on_m_pView_actionTextsChangeAsked"; @@ -325,30 +360,35 @@ void SFLPhone::on_m_pView_actionTextsChangeAsked(const QString * actionTexts) action_mailBox->setText ( actionTexts[SFLPhone::Mailbox ]); } - +///Change transfer state void SFLPhone::on_m_pView_transferCheckStateChangeAsked(bool transferCheckState) { qDebug() << "Changing transfer action checkState"; action_transfer->setChecked(transferCheckState); } +///Change record state void SFLPhone::on_m_pView_recordCheckStateChangeAsked(bool recordCheckState) { qDebug() << "Changing record action checkState"; action_record->setChecked(recordCheckState); } +///Update the GUI void SFLPhone::updateScreen(QAction * action) { if(action == action_main) m_pView->changeScreen(SCREEN_MAIN); } +///Do nothing +/// @deprecated This function can be removed void SFLPhone::on_m_pView_screenChanged(int screen) { qDebug() << "on_m_pView_screenChanged"; if(screen == SCREEN_MAIN) action_main->setChecked(true); } +///Produce an actionList for auto CallBack QList<QAction*> SFLPhone::getCallActions() { QList<QAction*> callActions = QList<QAction *>(); @@ -361,19 +401,12 @@ QList<QAction*> SFLPhone::getCallActions() return callActions; } +///Called when a call is coming void SFLPhone::on_m_pView_incomingCall(const Call * call) { - //ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); - //trayIconSignal(); - /*if(configurationManager.popupMode()) - { - putForeground(); - }*/ - //if(configurationManager.getNotify()) { Contact* contact = AkonadiBackend::getInstance()->getContactByPhone(call->getPeerPhoneNumber()); if (contact) { KNotification::event(KNotification::Notification, "New incomming call", "New call from: \n" + call->getPeerName().isEmpty() ? call->getPeerPhoneNumber() : call->getPeerName(),*contact->getPhoto()); } KNotification::event(KNotification::Notification, "New incomming call", "New call from: \n" + call->getPeerName().isEmpty() ? call->getPeerPhoneNumber() : call->getPeerName()); - //} } diff --git a/kde/src/SFLPhone.h b/kde/src/SFLPhone.h index e84d0fae87..9efe6cae4f 100755 --- a/kde/src/SFLPhone.h +++ b/kde/src/SFLPhone.h @@ -17,51 +17,48 @@ * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ + **************************************************************************/ #ifndef SFLPHONE_H #define SFLPHONE_H -#include <QtCore/QString> -#include <QtCore/QVector> -#include <QtGui/QListWidgetItem> -#include <QtGui/QKeyEvent> -#include <QErrorMessage> -#include <KSystemTrayIcon> -#include <KNotification> - #include <KXmlGuiWindow> -#include <KAction> -#include "widgets/ContactDock.h" -#include "widgets/HistoryDock.h" -#include "widgets/BookmarkDock.h" -#include <QActionGroup> - -// #include "ui_SFLPhoneView_base.h" -//#include "CallList.h" -#include "AccountWizard.h" -#include "lib/Contact.h" -#include "SFLPhoneView.h" -#include "widgets/SFLPhoneTray.h" - +#include <QtCore/QVector> +#include <lib/CallModel.h> + +//Qt +class QString; +class QLabel; +class QTreeWidgetItem; +class QActionGroup; + +//KDE +class KAction; + +//SFLPhone +class Call; +class ContactDock; +class BookmarkDock; +class SFLPhoneTray; class SFLPhoneView; -class CallView; +class HistoryDock; +class CallTreeItem; typedef CallModel<CallTreeItem*,QTreeWidgetItem*> TreeWidgetCallModel; -/** - * This class represents the SFLphone main window - * It implements the methods relative to windowing - * (status, menus, toolbars, notifications...). - * It uses a view which implements the real functionning - * and features of the phone. - * The display of the window is according to the state of the view, - * so the view sends some signals to ask for changes on the window - * that the window has to take into account. - * - * @short Main window - * @author Jérémy Quentin <jeremy.quentin@savoirfairelinux.com> - * @version 0.9.6 +/** + * This class represents the SFLphone main window + * It implements the methods relative to windowing + * (status, menus, toolbars, notifications...). + * It uses a view which implements the real functionning + * and features of the phone. + * The display of the window is according to the state of the view, + * so the view sends some signals to ask for changes on the window + * that the window has to take into account. + * + * @short Main window + * @author Jérémy Quentin <jeremy.quentin@savoirfairelinux.com> + * @version 0.9.6 **/ class SFLPhone : public KXmlGuiWindow { @@ -80,7 +77,7 @@ enum CallAction { private: // Whether or not the object has been initialized - bool initialized_; + bool m_pInitialized; KAction* action_accept ; KAction* action_refuse ; KAction* action_hold ; @@ -93,20 +90,19 @@ private: KAction* action_displayVolumeControls ; KAction* action_displayDialpad ; KAction* action_configureSflPhone ; + KAction* action_configureShortcut ; KAction* action_accountCreationWizard ; QActionGroup * action_screen; - SFLPhoneView* m_pView ; - QMenu* trayIconMenu ; - bool iconChanged ; - SFLPhoneTray* trayIcon ; - KNotification* notification ; - QLabel* statusBarWidget ; - ContactDock* m_pContactCD ; - QDockWidget* m_pCentralDW ; - HistoryDock* m_pHistoryDW ; - BookmarkDock* m_pBookmarkDW ; + SFLPhoneView* m_pView ; + bool m_pIconChanged ; + SFLPhoneTray* m_pTrayIcon ; + QLabel* m_pStatusBarWidget ; + ContactDock* m_pContactCD ; + QDockWidget* m_pCentralDW ; + HistoryDock* m_pHistoryDW ; + BookmarkDock* m_pBookmarkDW ; static SFLPhone* m_sApp; static TreeWidgetCallModel* m_pModel; @@ -124,7 +120,6 @@ public: bool initialize (); void setupActions (); void trayIconSignal (); - SFLPhoneView* getView (); QList<QAction *> getCallActions (); friend class SFLPhoneView; @@ -147,7 +142,7 @@ private slots: void on_m_pView_recordCheckStateChangeAsked ( bool recordCheckState ); void on_m_pView_screenChanged ( int screen ); void on_m_pView_incomingCall ( const Call * call ); - + void showShortCutEditor ( ); void updateScreen(QAction * action); void quitButton(); diff --git a/kde/src/SFLPhoneView.cpp b/kde/src/SFLPhoneView.cpp index e4554b857a..fd2bf1a3b3 100755 --- a/kde/src/SFLPhoneView.cpp +++ b/kde/src/SFLPhoneView.cpp @@ -26,6 +26,17 @@ #include <QtGui/QBrush> #include <QtGui/QPalette> #include <QtGui/QInputDialog> +#include <QtGui/QWidget> +#include <QtCore/QString> +#include <QtGui/QKeyEvent> +#include <QErrorMessage> +#include <KXmlGuiWindow> + +#include "conf/ConfigurationDialog.h" +#include "AccountWizard.h" +#include "lib/Contact.h" +#include "lib/AccountList.h" +#include "CallView.h" #include <klocale.h> #include <kstandardaction.h> @@ -63,7 +74,7 @@ SFLPhoneView::SFLPhoneView(QWidget *parent) ConfigurationManagerInterface& configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); errorWindow = new QErrorMessage(this); - callTreeModel->setTitle("Calls"); + callTreeModel->setTitle(i18n("Calls")); QPalette pal = QPalette(palette()); pal.setColor(QPalette::AlternateBase, Qt::lightGray); @@ -86,12 +97,6 @@ SFLPhoneView::~SFLPhoneView() { } -void SFLPhoneView::saveState() -{ - //ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); - //configurationManager.setHistory(callTreeModel->getHistoryCallId()); -} - void SFLPhoneView::loadWindow() { updateWindowCallState (); @@ -109,11 +114,6 @@ QErrorMessage * SFLPhoneView::getErrorWindow() return errorWindow; } -// CallView* SFLPhoneView::model() -// { -// return callTreeModel; -// } - void SFLPhoneView::typeString(QString str) { CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance(); @@ -323,17 +323,6 @@ void SFLPhoneView::updateWindowCallState() qDebug() << "Window updated."; } -void SFLPhoneView::alternateColors(QListWidget * listWidget) -{ - for(int i = 0 ; i < listWidget->count(); i++) { - QListWidgetItem* item = listWidget->item(i); - QBrush c = (i % 2 == 1) ? palette().base() : palette().alternateBase(); - item->setBackground( c ); - } - listWidget->setUpdatesEnabled( true ); - -} - int SFLPhoneView::phoneNumberTypesDisplayed() { ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); @@ -420,25 +409,15 @@ void SFLPhoneView::updateVolumeBar() void SFLPhoneView::updateVolumeControls() { + ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); - int display = false; - - if(QString(configurationManager.getAudioManager()) == "alsa") { - display = true; - - SFLPhone::app()->action_displayVolumeControls->setEnabled(true); - } - else { - SFLPhone::app()->action_displayVolumeControls->setEnabled(false); - } - - SFLPhone::app()->action_displayVolumeControls->setChecked(display); + //SFLPhone::app()->action_displayVolumeControls->setChecked(display); //widget_recVol->setVisible(display); //widget_sndVol->setVisible(display); - toolButton_recVol->setVisible ( display && ConfigurationSkeleton::displayVolume() ); - toolButton_sndVol->setVisible ( display && ConfigurationSkeleton::displayVolume() ); - slider_recVol->setVisible ( display && ConfigurationSkeleton::displayVolume() ); - slider_sndVol->setVisible ( display && ConfigurationSkeleton::displayVolume() ); + toolButton_recVol->setVisible ( SFLPhone::app()->action_displayVolumeControls->isChecked() && ConfigurationSkeleton::displayVolume() ); + toolButton_sndVol->setVisible ( SFLPhone::app()->action_displayVolumeControls->isChecked() && ConfigurationSkeleton::displayVolume() ); + slider_recVol->setVisible ( SFLPhone::app()->action_displayVolumeControls->isChecked() && ConfigurationSkeleton::displayVolume() ); + slider_sndVol->setVisible ( SFLPhone::app()->action_displayVolumeControls->isChecked() && ConfigurationSkeleton::displayVolume() ); } diff --git a/kde/src/SFLPhoneView.h b/kde/src/SFLPhoneView.h index 4d5aef5439..393cbfd596 100755 --- a/kde/src/SFLPhoneView.h +++ b/kde/src/SFLPhoneView.h @@ -17,55 +17,47 @@ * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ + **************************************************************************/ #ifndef SFLPHONEVIEW_H #define SFLPHONEVIEW_H -#include <QtGui/QWidget> -#include <QtCore/QString> +#include "ui_SFLPhoneView_base.h" #include <QtCore/QVector> #include <QtCore/QList> -#include <QtGui/QKeyEvent> -#include <QErrorMessage> -#include <KXmlGuiWindow> +#include <QtGui/QWidget> -#include "ui_SFLPhoneView_base.h" -#include "conf/ConfigurationDialog.h" -#include "widgets/CallTreeItem.h" -#include "AccountWizard.h" -#include "lib/Contact.h" -#include "lib/AccountList.h" -#include "CallView.h" +//Qt +class QString; +class QKeyEvent; +class QErrorMessage; +class QListWidget; +//SFLPhone class ConfigurationDialog; - - -/** - * This is the main view class for sflphone-client-kde. Most of the non-menu, - * non-toolbar, and non-statusbar (e.g., non frame) GUI code should go - * here. - * As the state of the view has effects on the window, - * it emits some signals to ask for changes that the window has - * to treat. - * - * @short Main view - * @author Jérémy Quentin <jeremy.quentin@savoirfairelinux.com> - * @version 0.9.6 +class AccountWizard; +class CallView; + + +/** + * This is the main view class for sflphone-client-kde. Most of the non-menu, + * non-toolbar, and non-statusbar (e.g., non frame) GUI code should go + * here. + * As the state of the view has effects on the window, + * it emits some signals to ask for changes that the window has + * to treat. + * + * @short Main view + * @author Jérémy Quentin <jeremy.quentin@savoirfairelinux.com> + * @version 0.9.6 */ class SFLPhoneView : public QWidget, public Ui::SFLPhone_view { Q_OBJECT private: - - //static ConfigurationDialog * configDialog; AccountWizard * wizard; - //List of calls in the window, and past ones. - //Handles both current calls (dialing, ringing...) and history. - //CallList * callList; QErrorMessage * errorWindow; - //Account used prioritary if defined and registered. If not, the first registered account in accountList is used. protected: @@ -103,19 +95,6 @@ public: * chosen to be displayed in SFLphone configuration. */ int phoneNumberTypesDisplayed(); - - /** - * - * @return true if the address book is enabled in config - */ - //bool isAddressBookEnabled(); - - //QVector<Contact *> findContactsInKAddressBook(QString textSearched, bool & full); - - /** - * Save the settings to save in the daemon before exit - */ - void saveState(); private slots: /** @@ -174,13 +153,6 @@ private slots: */ void editBeforeCall(); - /** - * Alternates colors of the list widget with the application's palettes's - * base and alternateBase colors. - * @param listWidget the list widget to which we alternate colors - */ - void alternateColors(QListWidget * listWidget); - /** * Updates the toolbar's actions' display according to the selected * item's state. @@ -243,11 +215,10 @@ public slots: void on_widget_dialpad_typed(QString text); - void on_slider_recVol_valueChanged(int value); - void on_slider_sndVol_valueChanged(int value); - - void on_toolButton_recVol_clicked(bool checked); - void on_toolButton_sndVol_clicked(bool checked); + void on_slider_recVol_valueChanged ( int value ); + void on_slider_sndVol_valueChanged ( int value ); + void on_toolButton_recVol_clicked ( bool checked ); + void on_toolButton_sndVol_clicked ( bool checked ); void on1_error(MapStringString details); void on1_incomingCall(Call* call); diff --git a/kde/src/SFLPhoneapplication.cpp b/kde/src/SFLPhoneapplication.cpp index f7c4e8cb4a..786df12a2c 100755 --- a/kde/src/SFLPhoneapplication.cpp +++ b/kde/src/SFLPhoneapplication.cpp @@ -102,10 +102,10 @@ void SFLPhoneApplication::initializePaths() qDebug() << "KGlobal::dirs" << QString(DATA_INSTALL_DIR); // Test whether the prefix is correct. - if( KGlobal::dirs()->findResource( "appdata", "icons/hi128-apps-sflphone-client-kde.png" ).isNull() ) { - kWarning() << "SFLPhone could not find resources in the search paths: " - << KGlobal::dirs()->findDirs( "appdata", QString::null ).join(", ") << endl; - } +// if( KGlobal::dirs()->findResource( "appdata", "icons/hi128-apps-sflphone-client-kde.png" ).isNull() ) { +// kWarning() << "SFLPhone could not find resources in the search paths: " +// << KGlobal::dirs()->findDirs( "appdata", QString::null ).join(", ") << endl; + //} } Q_NOREPLY void SFLPhoneApplication::quit2() diff --git a/kde/src/conf/dlgaccounts.cpp b/kde/src/conf/dlgaccounts.cpp index f052871981..e928183f27 100755 --- a/kde/src/conf/dlgaccounts.cpp +++ b/kde/src/conf/dlgaccounts.cpp @@ -24,6 +24,7 @@ #include "lib/configurationmanager_interface_singleton.h" #include "SFLPhoneView.h" +#include "../AccountView.h" #include "lib/sflphone_const.h" #include "conf/ConfigurationDialog.h" #include <vector> diff --git a/kde/src/lib/Account.cpp b/kde/src/lib/Account.cpp index c9c4158668..bf978941af 100644 --- a/kde/src/lib/Account.cpp +++ b/kde/src/lib/Account.cpp @@ -23,6 +23,8 @@ #include <QtGui/QApplication> #include <QDebug> +#include <QtCore/QString> +#include <QtGui/QColor> #include "sflphone_const.h" #include "configurationmanager_interface_singleton.h" diff --git a/kde/src/lib/Account.h b/kde/src/lib/Account.h index b4c235ac25..f393a13fde 100644 --- a/kde/src/lib/Account.h +++ b/kde/src/lib/Account.h @@ -22,8 +22,8 @@ #ifndef ACCOUNT_H #define ACCOUNT_H -#include <QtCore/QString> -#include <QtGui/QColor> +//Qt +class QString; #include "typedefs.h" diff --git a/kde/src/lib/AccountList.cpp b/kde/src/lib/AccountList.cpp index 14212427c1..be54288e7e 100644 --- a/kde/src/lib/AccountList.cpp +++ b/kde/src/lib/AccountList.cpp @@ -166,7 +166,7 @@ Account* AccountList::firstRegisteredAccount() const Account* current; for (int i = 0; i < m_pAccounts->count(); ++i) { current = (*m_pAccounts)[i]; - if(current->getAccountDetail(ACCOUNT_STATUS) == ACCOUNT_STATE_REGISTERED) { + if(current && current->getAccountDetail(ACCOUNT_STATUS) == ACCOUNT_STATE_REGISTERED) { return current; } else { diff --git a/kde/src/lib/Call.cpp b/kde/src/lib/Call.cpp index 30313bfdf4..54533d8b97 100644 --- a/kde/src/lib/Call.cpp +++ b/kde/src/lib/Call.cpp @@ -610,7 +610,8 @@ void Call::call() this->m_pPeerPhoneNumber = m_pCallNumber; if (m_pContactBackend) { Contact* contact = m_pContactBackend->getContactByPhone(m_pPeerPhoneNumber); - m_pPeerName = contact->getFormattedName(); + if (contact) + m_pPeerName = contact->getFormattedName(); } this->m_pStartTime = new QDateTime(QDateTime::currentDateTime()); this->m_pHistoryState = OUTGOING; diff --git a/kde/src/lib/Call.h b/kde/src/lib/Call.h index 0ad0ee8bb2..e876915150 100644 --- a/kde/src/lib/Call.h +++ b/kde/src/lib/Call.h @@ -17,16 +17,17 @@ * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ + **************************************************************************/ #ifndef CALL_H #define CALL_H -#include <QtCore/QString> -#include <QtCore/QDateTime> -#include <QtGui/QLabel> -#include <QtGui/QWidget> +//Qt +class QString; +class QDateTime; +class QLabel; +class QWidget; #include "sflphone_const.h" #include "typedefs.h" diff --git a/kde/src/lib/CallModel.cpp b/kde/src/lib/CallModel.cpp index e9541dd836..e74ca594d8 100644 --- a/kde/src/lib/CallModel.cpp +++ b/kde/src/lib/CallModel.cpp @@ -62,6 +62,7 @@ void CallModelBase::on1_callStateChanged(const QString &callID, const QString &s void CallModelBase::on1_incomingCall(const QString & accountID, const QString & callID) { + Q_UNUSED(accountID) qDebug() << "Signal : Incoming Call ! ID = " << callID; Call* call = addIncomingCall(callID); diff --git a/kde/src/lib/CallModel.h b/kde/src/lib/CallModel.h index cdd9c681ae..6262751177 100644 --- a/kde/src/lib/CallModel.h +++ b/kde/src/lib/CallModel.h @@ -22,25 +22,26 @@ #define CALL_MODEL_H #include <QObject> -#include <QHash> #include <QVector> -#include <QDragEnterEvent> -#include <QDebug> - -#include "Call.h" -#include "AccountList.h" -#include "dbus/metatypes.h" -#include "callmanager_interface_singleton.h" -#include "configurationmanager_interface_singleton.h" -#include "instance_interface_singleton.h" -#include "sflphone_const.h" -#include "unistd.h" +#include <QHash> #include "typedefs.h" -#include "ContactBackend.h" + +//Qt +class QDragEnterEvent; +class QDebug; +class QModelIndex; + +//SFLPhone +class Call; +class AccountList; +class Account; +class ContactBackend; typedef QHash<QString, Call*> CallHash; typedef QList<Call*> CallList; +///This class need to exist because template classes can't have signals ans +///slots because Qt MOC generator can't guess the type at precompilation class LIB_EXPORT CallModelBase : public QObject { Q_OBJECT diff --git a/kde/src/lib/CallModel.hpp b/kde/src/lib/CallModel.hpp index 54c74c2b21..371a485398 100644 --- a/kde/src/lib/CallModel.hpp +++ b/kde/src/lib/CallModel.hpp @@ -1,3 +1,18 @@ +#include <QHash> +#include <QVector> +#include <QDragEnterEvent> +#include <QDebug> +#include "Call.h" +#include "AccountList.h" +#include "dbus/metatypes.h" +#include "callmanager_interface_singleton.h" +#include "configurationmanager_interface_singleton.h" +#include "instance_interface_singleton.h" +#include "sflphone_const.h" +#include "unistd.h" +#include "typedefs.h" +#include "ContactBackend.h" + //Static member template <typename CallWidget, typename Index> QString CallModel<CallWidget,Index>::m_pPriorAccountId = "" ; template <typename CallWidget, typename Index> AccountList* CallModel<CallWidget,Index>::m_pAccountList = 0 ; diff --git a/kde/src/lib/Contact.cpp b/kde/src/lib/Contact.cpp index 11551f750c..84eee4a920 100644 --- a/kde/src/lib/Contact.cpp +++ b/kde/src/lib/Contact.cpp @@ -21,6 +21,12 @@ #include "Contact.h" #include <QtCore/QDebug> +#include <kabc/addressee.h> +#include <kabc/picture.h> +#include <kabc/phonenumber.h> +#include <QtGui/QListWidgetItem> +#include <QtGui/QWidget> +#include <QPixmap> #include "sflphone_const.h" diff --git a/kde/src/lib/Contact.h b/kde/src/lib/Contact.h index 68e133acf1..5e03a500a7 100644 --- a/kde/src/lib/Contact.h +++ b/kde/src/lib/Contact.h @@ -21,20 +21,25 @@ #ifndef CONTACT_H #define CONTACT_H -#include <QtGui/QListWidgetItem> -#include <QtGui/QWidget> +#include <QObject> -#include <QPixmap> +//Qt +class QListWidgetItem; +class QWidget; +class QPixmap; -#include <kabc/addressee.h> -#include <kabc/picture.h> -#include <kabc/phonenumber.h> +//KDE +namespace KABC { + class Addressee ; + class Picture ; + class PhoneNumber ; +} #include "typedefs.h" /** @author Jérémy Quentin <jeremy.quentin@savoirfairelinux.com> - @author Jérémy Quentin <emmanuel.lepage@savoirfairelinux.com> + @author Emmanuel Lepage <emmanuel.lepage@savoirfairelinux.com> */ class LIB_EXPORT Contact : public QObject{ Q_OBJECT @@ -85,6 +90,7 @@ public: virtual QString getType() const; virtual void initItem(); + //Setters virtual void setPhoneNumbers (PhoneNumbers ); virtual void setFormattedName (QString name ); virtual void setNickName (QString name ); diff --git a/kde/src/lib/ContactBackend.h b/kde/src/lib/ContactBackend.h index 72584f8c52..1a3cc57a0c 100644 --- a/kde/src/lib/ContactBackend.h +++ b/kde/src/lib/ContactBackend.h @@ -6,6 +6,7 @@ #include "typedefs.h" +//SFLPhone class Contact; typedef QList<Contact*> ContactList; diff --git a/kde/src/main.cpp b/kde/src/main.cpp index 56019340d5..606a1f5936 100755 --- a/kde/src/main.cpp +++ b/kde/src/main.cpp @@ -26,7 +26,7 @@ static const char description[] = "A KDE 4 Client for SFLphone"; -static const char version[] = "0.9.14"; +static const char version[] = "1.0.0"; int main(int argc, char **argv) { diff --git a/kde/src/widgets/BookmarkDock.cpp b/kde/src/widgets/BookmarkDock.cpp index 42976ce907..550c152052 100644 --- a/kde/src/widgets/BookmarkDock.cpp +++ b/kde/src/widgets/BookmarkDock.cpp @@ -2,6 +2,7 @@ #include <QtGui/QVBoxLayout> #include <QtGui/QTreeWidgetItem> +#include <KLocalizedString> #include <kicon.h> #include <klineedit.h> #include <QtGui/QTreeWidget> @@ -50,8 +51,8 @@ BookmarkDock::BookmarkDock(QWidget* parent) : QDockWidget(parent) m_pSplitter->setChildrenCollapsible(true); m_pSplitter->setStretchFactor(0,7); - setWindowTitle("Bookmark"); - m_pItemView->headerItem()->setText(0,"Bookmark" ); + setWindowTitle(i18n("Bookmark")); + m_pItemView->headerItem()->setText(0,i18n("Bookmark") ); foreach (QString nb, ConfigurationSkeleton::bookmarkList()) { addBookmark_internal(nb); diff --git a/kde/src/widgets/BookmarkDock.h b/kde/src/widgets/BookmarkDock.h index b5e9bb0584..7c91b80997 100644 --- a/kde/src/widgets/BookmarkDock.h +++ b/kde/src/widgets/BookmarkDock.h @@ -3,10 +3,16 @@ #include <QtGui/QDockWidget> +//Qt class QTreeWidget; -class KLineEdit; class QSplitter; + +//KDE +class KLineEdit; + +//SFLPhonr class HistoryTreeItem; + typedef QList<HistoryTreeItem*> BookmarkList; class BookmarkDock : public QDockWidget { Q_OBJECT diff --git a/kde/src/widgets/CallTreeItem.cpp b/kde/src/widgets/CallTreeItem.cpp index 00704700f3..64f452e0b4 100644 --- a/kde/src/widgets/CallTreeItem.cpp +++ b/kde/src/widgets/CallTreeItem.cpp @@ -27,41 +27,58 @@ #include "lib/sflphone_const.h" #include "CallTreeItem.h" #include "lib/Contact.h" +#include "lib/Call.h" #include "AkonadiBackend.h" +#include <QtCore/QList> +#include <QtCore/QVariant> +#include <QtCore/QVector> + +#include <QtGui/QWidget> +#include <QtGui/QLabel> +#include <QtGui/QSpacerItem> +#include <QtGui/QHBoxLayout> +#include <QtGui/QVBoxLayout> +#include <KIcon> + +///Constant const char * CallTreeItem::callStateIcons[12] = {ICON_INCOMING, ICON_RINGING, ICON_CURRENT, ICON_DIALING, ICON_HOLD, ICON_FAILURE, ICON_BUSY, ICON_TRANSFER, ICON_TRANSF_HOLD, "", "", ICON_CONFERENCE}; +///Constructor CallTreeItem::CallTreeItem(QWidget *parent) : QWidget(parent), itemCall(0), init(false) { setMaximumSize(99999,50); } +///Destructor CallTreeItem::~CallTreeItem() { } +///Return the call item Call* CallTreeItem::call() const { return itemCall; } +///Set the call item void CallTreeItem::setCall(Call *call) { itemCall = call; if (itemCall->isConference()) { if (!init) { - labelHistoryPeerName = new QLabel("Conference",this); - labelIcon = new QLabel("Icn",this); + labelHistoryPeerName = new QLabel(i18n("Conference"),this); + labelIcon = new QLabel("",this); QHBoxLayout* mainLayout = new QHBoxLayout(); mainLayout->addWidget(labelIcon); mainLayout->addWidget(labelHistoryPeerName); setLayout(mainLayout); init = true; } - labelIcon->setPixmap(QPixmap(ICON_CONFERENCE)); + labelIcon->setPixmap(QPixmap(ICON_CONFERENCE).scaled(QSize(48,48))); labelIcon->setVisible(true); labelHistoryPeerName->setVisible(true); return; @@ -113,6 +130,7 @@ void CallTreeItem::setCall(Call *call) updated(); } +///Update data void CallTreeItem::updated() { qDebug() << "Updating tree item"; @@ -128,7 +146,7 @@ void CallTreeItem::updated() labelPeerName->setText("<b>"+itemCall->getPeerName()+"</b>"); } else { - labelPeerName->setText("<b>Unknow</b>"); + labelPeerName->setText(i18n("<b>Unknow</b>")); } } @@ -166,4 +184,3 @@ void CallTreeItem::updated() } } - diff --git a/kde/src/widgets/CallTreeItem.h b/kde/src/widgets/CallTreeItem.h index 02672737ff..7908979bdf 100644 --- a/kde/src/widgets/CallTreeItem.h +++ b/kde/src/widgets/CallTreeItem.h @@ -19,27 +19,22 @@ * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ - -/** - * http://doc.trolltech.com/4.5/itemviews-editabletreemodel.html - */ - + **************************************************************************/ #ifndef CALLTREE_ITEM_H #define CALLTREE_ITEM_H -#include <QtCore/QList> -#include <QtCore/QVariant> #include <QtCore/QVector> - +#include <QtCore/QList> #include <QtGui/QWidget> -#include <QtGui/QLabel> -#include <QtGui/QSpacerItem> -#include <QtGui/QHBoxLayout> -#include <QtGui/QVBoxLayout> -#include <KIcon> -#include "lib/Call.h" +//Qt +class QLabel; + +//KDE +class KIcon; + +//SFLPhone +class Call; class CallTreeItem : public QWidget { diff --git a/kde/src/widgets/ContactDock.cpp b/kde/src/widgets/ContactDock.cpp index d421405c52..625ca83b11 100644 --- a/kde/src/widgets/ContactDock.cpp +++ b/kde/src/widgets/ContactDock.cpp @@ -7,6 +7,10 @@ #include <QtGui/QHeaderView> #include <QtGui/QCheckBox> #include <QtCore/QDateTime> +#include <QSplitter> +#include <klineedit.h> +#include <KLocalizedString> +#include <QtGui/QLabel> #include <akonadi/collectionfilterproxymodel.h> #include <akonadi/contact/contactstreemodel.h> @@ -16,22 +20,25 @@ #include <kabc/picture.h> #include <kabc/phonenumber.h> #include <kabc/vcard.h> -#include <kabc/addressee.h> #include <kabc/field.h> #include <kabc/vcardline.h> #include <kabc/contactgroup.h> -#include <kabc/phonenumber.h> #include <akonadi/itemfetchscope.h> #include <akonadi/entitydisplayattribute.h> #include <akonadi/recursiveitemfetchjob.h> #include <kicon.h> +#include <akonadi/entitytreeview.h> +#include <akonadi/itemview.h> +#include <akonadi/collectioncombobox.h> #include "AkonadiBackend.h" #include "ContactItemWidget.h" #include "conf/ConfigurationSkeleton.h" #include "lib/Call.h" #include "SFLPhone.h" +#include "lib/Contact.h" +///Hack around Qt sorting limitation class QNumericTreeWidgetItem_hist : public QTreeWidgetItem { public: QNumericTreeWidgetItem_hist(QTreeWidget* parent):QTreeWidgetItem(parent),widget(0),weight(-1){} @@ -52,6 +59,7 @@ class QNumericTreeWidgetItem_hist : public QTreeWidgetItem { } }; +///Forward keypresses to the filter line edit bool KeyPressEaterC::eventFilter(QObject *obj, QEvent *event) { if (event->type() == QEvent::KeyPress) { @@ -63,6 +71,7 @@ bool KeyPressEaterC::eventFilter(QObject *obj, QEvent *event) } } +///Constructor ContactDock::ContactDock(QWidget* parent) : QDockWidget(parent) { setObjectName("contactDock"); @@ -81,7 +90,7 @@ ContactDock::ContactDock(QWidget* parent) : QDockWidget(parent) QWidget* mainWidget = new QWidget(this); setWidget(mainWidget); - m_pContactView->headerItem()->setText(0,"Contacts"); + m_pContactView->headerItem()->setText(0,i18n("Contacts")); m_pContactView->header()->setClickable(true); m_pContactView->header()->setSortIndicatorShown(true); m_pContactView->setAcceptDrops(true); @@ -91,11 +100,11 @@ ContactDock::ContactDock(QWidget* parent) : QDockWidget(parent) m_pContactView->setAlternatingRowColors(true); - m_pFilterLE->setPlaceholderText("Filter"); + m_pFilterLE->setPlaceholderText(i18n("Filter")); m_pFilterLE->setClearButtonShown(true); m_pShowHistoCK->setChecked(ConfigurationSkeleton::displayContactCallHistory()); - m_pShowHistoCK->setText("Display history"); + m_pShowHistoCK->setText(i18n("Display history")); setHistoryVisible(ConfigurationSkeleton::displayContactCallHistory()); @@ -115,14 +124,16 @@ ContactDock::ContactDock(QWidget* parent) : QDockWidget(parent) connect (m_pContactView, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),this, SLOT(loadContactHistory(QTreeWidgetItem*) )); connect (m_pFilterLE, SIGNAL(textChanged(QString)), this, SLOT(filter(QString) )); connect (m_pShowHistoCK, SIGNAL(toggled(bool)), this, SLOT(setHistoryVisible(bool) )); - setWindowTitle("Contact"); + setWindowTitle(i18n("Contact")); } +///Destructor ContactDock::~ContactDock() { } +///Reload the contact void ContactDock::reloadContact() { ContactList list = AkonadiBackend::getInstance()->update(); @@ -153,6 +164,7 @@ void ContactDock::reloadContact() } } +///Query the call history for all items related to this contact void ContactDock::loadContactHistory(QTreeWidgetItem* item) { if (m_pShowHistoCK->isChecked()) { @@ -172,6 +184,7 @@ void ContactDock::loadContactHistory(QTreeWidgetItem* item) } } +///Filter contact void ContactDock::filter(QString text) { foreach(ContactItemWidget* item, m_pContacts) { @@ -188,6 +201,7 @@ void ContactDock::filter(QString text) m_pContactView->expandAll(); } +///Serialize informations to be used for drag and drop QMimeData* ContactTree::mimeData( const QList<QTreeWidgetItem *> items) const { qDebug() << "An history call is being dragged"; @@ -213,6 +227,7 @@ QMimeData* ContactTree::mimeData( const QList<QTreeWidgetItem *> items) const return mimeData; } +///Handle data being dropped on the widget bool ContactTree::dropMimeData(QTreeWidgetItem *parent, int index, const QMimeData *data, Qt::DropAction action) { Q_UNUSED(index) @@ -226,6 +241,7 @@ bool ContactTree::dropMimeData(QTreeWidgetItem *parent, int index, const QMimeDa return false; } +///Show or hide the history list void ContactDock::setHistoryVisible(bool visible) { qDebug() << "Toggling history visibility"; @@ -233,6 +249,7 @@ void ContactDock::setHistoryVisible(bool visible) ConfigurationSkeleton::setDisplayContactCallHistory(visible); } +///Handle keypresses ont the dock void ContactDock::keyPressEvent(QKeyEvent* event) { int key = event->key(); if(key == Qt::Key_Escape) diff --git a/kde/src/widgets/ContactDock.h b/kde/src/widgets/ContactDock.h index b446ac0726..c470a1d093 100644 --- a/kde/src/widgets/ContactDock.h +++ b/kde/src/widgets/ContactDock.h @@ -3,21 +3,33 @@ #include <QtGui/QDockWidget> #include <QtGui/QTreeWidget> -#include <QSplitter> - -#include <akonadi/entitytreeview.h> -#include <akonadi/itemview.h> -#include <klineedit.h> -#include <kabc/addressee.h> -#include <akonadi/contact/contactstreemodel.h> -#include <akonadi/collectioncombobox.h> +//Qt +class QSplitter; class QListWidget; class QComboBox; class QTreeWidgetItem; class QCheckBox; -class ContactItemWidget; + +//KDE +class KLineEdit; + +namespace Akonadi { + class EntityTreeView; + class ItemView; + class CollectionCombobox; + namespace Contact { + class ContactsTreeModel; + } +} + +namespace KABC { + class Addressee; +} + +///SFLPhone class ContactTree; +class ContactItemWidget; class ContactDock : public QDockWidget { Q_OBJECT diff --git a/kde/src/widgets/ContactItemWidget.cpp b/kde/src/widgets/ContactItemWidget.cpp index 0a47d370ea..8bed3b30ec 100644 --- a/kde/src/widgets/ContactItemWidget.cpp +++ b/kde/src/widgets/ContactItemWidget.cpp @@ -25,6 +25,17 @@ #include <QtGui/QGridLayout> #include <QtGui/QMenu> +#include <QtGui/QLabel> +#include <QtGui/QSpacerItem> +#include <QtGui/QHBoxLayout> +#include <QtGui/QVBoxLayout> +#include <KIcon> +#include <kabc/addressee.h> +#include <kabc/picture.h> +#include <kabc/phonenumber.h> + +#include <lib/Contact.h> + #include <klocale.h> #include <kdebug.h> #include <unistd.h> @@ -33,42 +44,44 @@ #include "lib/sflphone_const.h" #include "ContactItemWidget.h" #include "AkonadiBackend.h" +#include "widgets/BookmarkDock.h" #include "SFLPhone.h" #include "conf/ConfigurationSkeleton.h" +///Constructor ContactItemWidget::ContactItemWidget(QWidget *parent) : QWidget(parent), m_pMenu(0),init(false) { setContextMenuPolicy(Qt::CustomContextMenu); m_pCallAgain = new KAction(this); - m_pCallAgain->setShortcut(Qt::CTRL + Qt::Key_Enter); - m_pCallAgain->setText("Call Again"); - m_pCallAgain->setIcon(KIcon(ICON_DIALING)); + m_pCallAgain->setShortcut ( Qt::CTRL + Qt::Key_Enter ); + m_pCallAgain->setText ( i18n("Call Again") ); + m_pCallAgain->setIcon ( KIcon(ICON_DIALING) ); m_pEditContact = new KAction(this); - m_pEditContact->setShortcut(Qt::CTRL + Qt::Key_E); - m_pEditContact->setText("Edit contact"); - m_pEditContact->setIcon(KIcon("contact-new")); + m_pEditContact->setShortcut ( Qt::CTRL + Qt::Key_E ); + m_pEditContact->setText ( i18n("Edit contact") ); + m_pEditContact->setIcon ( KIcon("contact-new") ); m_pCopy = new KAction(this); - m_pCopy->setShortcut(Qt::CTRL + Qt::Key_C); - m_pCopy->setText("Copy"); - m_pCopy->setIcon(KIcon("edit-copy")); + m_pCopy->setShortcut ( Qt::CTRL + Qt::Key_C ); + m_pCopy->setText ( i18n("Copy") ); + m_pCopy->setIcon ( KIcon("edit-copy") ); m_pEmail = new KAction(this); - m_pEmail->setShortcut(Qt::CTRL + Qt::Key_M); - m_pEmail->setText("Send Email"); - m_pEmail->setIcon(KIcon("mail-message-new")); + m_pEmail->setShortcut ( Qt::CTRL + Qt::Key_M ); + m_pEmail->setText ( i18n("Send Email") ); + m_pEmail->setIcon ( KIcon("mail-message-new") ); m_pAddPhone = new KAction(this); - m_pAddPhone->setShortcut(Qt::CTRL + Qt::Key_N); - m_pAddPhone->setText("Add Phone Number"); - m_pAddPhone->setIcon(KIcon("list-resource-add")); + m_pAddPhone->setShortcut ( Qt::CTRL + Qt::Key_N ); + m_pAddPhone->setText ( i18n("Add Phone Number") ); + m_pAddPhone->setIcon ( KIcon("list-resource-add") ); m_pBookmark = new KAction(this); - m_pBookmark->setShortcut(Qt::CTRL + Qt::Key_D); - m_pBookmark->setText("Bookmark"); - m_pBookmark->setIcon(KIcon("bookmarks")); + m_pBookmark->setShortcut ( Qt::CTRL + Qt::Key_D ); + m_pBookmark->setText ( i18n("Bookmark") ); + m_pBookmark->setIcon ( KIcon("bookmarks") ); connect(m_pCallAgain , SIGNAL(triggered()) , this,SLOT(callAgain() )); connect(m_pEditContact , SIGNAL(triggered()) , this,SLOT(editContact() )); @@ -78,19 +91,21 @@ ContactItemWidget::ContactItemWidget(QWidget *parent) connect(m_pBookmark , SIGNAL(triggered()) , this,SLOT(bookmark() )); } +///Destructor ContactItemWidget::~ContactItemWidget() { } +///Set the contact void ContactItemWidget::setContact(Contact* contact) { - m_pContactKA = contact; - m_pIconL = new QLabel(this); - m_pContactNameL = new QLabel(); - m_pOrganizationL = new QLabel(this); - m_pEmailL = new QLabel(); - m_pCallNumberL = new QLabel(this); + m_pContactKA = contact; + m_pIconL = new QLabel ( this ); + m_pContactNameL = new QLabel ( ); + m_pOrganizationL = new QLabel ( this ); + m_pEmailL = new QLabel ( ); + m_pCallNumberL = new QLabel ( this ); m_pIconL->setMinimumSize(70,48); m_pIconL->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); @@ -104,12 +119,12 @@ void ContactItemWidget::setContact(Contact* contact) QGridLayout* mainLayout = new QGridLayout(this); mainLayout->setContentsMargins(0,0,0,0); - mainLayout->addWidget(m_pIconL,0,0,4,1); - mainLayout->addWidget(m_pContactNameL,0,1); - mainLayout->addWidget(m_pOrganizationL,1,1); - mainLayout->addWidget(m_pCallNumberL,2,1); - mainLayout->addWidget(m_pEmailL,3,1); - mainLayout->addItem(verticalSpacer,4,1); + mainLayout->addWidget( m_pIconL , 0 , 0 , 4 , 1 ); + mainLayout->addWidget( m_pContactNameL , 0 , 1 ); + mainLayout->addWidget( m_pOrganizationL, 1 , 1 ); + mainLayout->addWidget( m_pCallNumberL , 2 , 1 ); + mainLayout->addWidget( m_pEmailL , 3 , 1 ); + mainLayout->addItem(verticalSpacer , 4 , 1 ); setLayout(mainLayout); setMinimumSize(QSize(50, 30)); @@ -118,6 +133,7 @@ void ContactItemWidget::setContact(Contact* contact) connect(this,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(showContext(QPoint))); } +///The contact need to be updated void ContactItemWidget::updated() { m_pContactNameL->setText("<b>"+m_pContactKA->getFormattedName()+"</b>"); @@ -143,7 +159,7 @@ void ContactItemWidget::updated() if (getCallNumbers().count() == 1) m_pCallNumberL->setText(getCallNumbers()[0]->getNumber()); else - m_pCallNumberL->setText(QString::number(getCallNumbers().count())+" numbers"); + m_pCallNumberL->setText(QString::number(getCallNumbers().count())+i18n(" numbers")); if (!m_pContactKA->getPhoto()) m_pIconL->setPixmap(QPixmap(KIcon("user-identity").pixmap(QSize(48,48)))); @@ -151,11 +167,6 @@ void ContactItemWidget::updated() m_pIconL->setPixmap(*m_pContactKA->getPhoto()); } -// QPixmap* ContactItemWidget::getIcon() -// { -// return new QPixmap(); -// } - QString ContactItemWidget::getContactName() const { return m_pContactKA->getFormattedName(); @@ -199,13 +210,13 @@ Contact* ContactItemWidget::getContact() void ContactItemWidget::showContext(const QPoint& pos) { if (!m_pMenu) { - m_pMenu = new QMenu(this); - m_pMenu->addAction(m_pCallAgain); - m_pMenu->addAction(m_pEditContact); - m_pMenu->addAction(m_pAddPhone); - m_pMenu->addAction(m_pCopy); - m_pMenu->addAction(m_pEmail); - m_pMenu->addAction(m_pBookmark); + m_pMenu = new QMenu( this ); + m_pMenu->addAction( m_pCallAgain ); + m_pMenu->addAction( m_pEditContact ); + m_pMenu->addAction( m_pAddPhone ); + m_pMenu->addAction( m_pCopy ); + m_pMenu->addAction( m_pEmail ); + m_pMenu->addAction( m_pBookmark ); } PhoneNumbers numbers = m_pContactKA->getPhoneNumbers(); m_pBookmark->setEnabled(numbers.count() == 1); diff --git a/kde/src/widgets/ContactItemWidget.h b/kde/src/widgets/ContactItemWidget.h index b3430a67d4..9c5151bab3 100644 --- a/kde/src/widgets/ContactItemWidget.h +++ b/kde/src/widgets/ContactItemWidget.h @@ -21,26 +21,28 @@ #ifndef CONTACTITEMWIDGET_H #define CONTACTITEMWIDGET_H +#include <QtGui/QWidget> #include <QtCore/QList> #include <QtCore/QVariant> #include <QtCore/QVector> +#include "lib/Contact.h" -#include <QtGui/QWidget> -#include <QtGui/QLabel> -#include <QtGui/QSpacerItem> -#include <QtGui/QHBoxLayout> -#include <QtGui/QVBoxLayout> -#include <KIcon> -#include <kabc/addressee.h> -#include <kabc/picture.h> -#include <kabc/phonenumber.h> - -#include <lib/Contact.h> - +//Qt +class QLabel; class QTreeWidgetItem; -class KAction; class QMenu; +//KDE +class KAction; +class KIcon; + +namespace KABC { + class Addressee; +} + +//SFLPhone +class Contact; + class ContactItemWidget : public QWidget { Q_OBJECT diff --git a/kde/src/widgets/Dialpad.cpp b/kde/src/widgets/Dialpad.cpp index f0f4514e14..a23bf72978 100755 --- a/kde/src/widgets/Dialpad.cpp +++ b/kde/src/widgets/Dialpad.cpp @@ -22,7 +22,10 @@ #include <QLabel> #include <QDebug> +#include <QPushButton> +#include <QGridLayout> +///Constructor Dialpad::Dialpad(QWidget *parent) : QWidget(parent) { @@ -55,33 +58,33 @@ Dialpad::Dialpad(QWidget *parent) pushButton_diese->setObjectName(QString::fromUtf8("pushButton_diese")); pushButton_etoile->setObjectName(QString::fromUtf8("pushButton_etoile")); - gridLayout->addWidget(pushButton_1, 0, 0); - gridLayout->addWidget(pushButton_2, 0, 1); - gridLayout->addWidget(pushButton_3, 0, 2); - gridLayout->addWidget(pushButton_4, 1, 0); - gridLayout->addWidget(pushButton_5, 1, 1); - gridLayout->addWidget(pushButton_6, 1, 2); - gridLayout->addWidget(pushButton_7, 2, 0); - gridLayout->addWidget(pushButton_8, 2, 1); - gridLayout->addWidget(pushButton_9, 2, 2); - gridLayout->addWidget(pushButton_etoile, 3, 0); - gridLayout->addWidget(pushButton_0, 3, 1); - gridLayout->addWidget(pushButton_diese, 3, 2); + gridLayout->addWidget(pushButton_1 , 0, 0 ); + gridLayout->addWidget(pushButton_2 , 0, 1 ); + gridLayout->addWidget(pushButton_3 , 0, 2 ); + gridLayout->addWidget(pushButton_4 , 1, 0 ); + gridLayout->addWidget(pushButton_5 , 1, 1 ); + gridLayout->addWidget(pushButton_6 , 1, 2 ); + gridLayout->addWidget(pushButton_7 , 2, 0 ); + gridLayout->addWidget(pushButton_8 , 2, 1 ); + gridLayout->addWidget(pushButton_9 , 2, 2 ); + gridLayout->addWidget(pushButton_etoile , 3, 0 ); + gridLayout->addWidget(pushButton_0 , 3, 1 ); + gridLayout->addWidget(pushButton_diese , 3, 2 ); fillButtons(); QMetaObject::connectSlotsByName(this); } - +///Make the buttons void Dialpad::fillButtons() { QHBoxLayout * layout; QLabel * number; QLabel * text; - int spacing = 5; - int numberSize = 14; - int textSize = 8; + int spacing = 5 ; + int numberSize = 14 ; + int textSize = 8 ; QPushButton * buttons[12] = {pushButton_1, pushButton_2, pushButton_3, @@ -117,6 +120,7 @@ void Dialpad::fillButtons() } } +///Slots void Dialpad::on_pushButton_1_clicked() { emit typed("1"); } void Dialpad::on_pushButton_2_clicked() { emit typed("2"); } void Dialpad::on_pushButton_3_clicked() { emit typed("3"); } diff --git a/kde/src/widgets/Dialpad.h b/kde/src/widgets/Dialpad.h index e93478a517..5a4d1c6031 100755 --- a/kde/src/widgets/Dialpad.h +++ b/kde/src/widgets/Dialpad.h @@ -22,8 +22,10 @@ #define DIALPAD_H #include <QWidget> -#include <QPushButton> -#include <QGridLayout> + +//Qt +class QPushButton; +class QGridLayout; /** A widget that represents a phone dialpad, with numbers and letters associated. @@ -35,19 +37,19 @@ class Dialpad : public QWidget Q_OBJECT private: - QGridLayout * gridLayout; - QPushButton * pushButton_0; - QPushButton * pushButton_1; - QPushButton * pushButton_2; - QPushButton * pushButton_3; - QPushButton * pushButton_4; - QPushButton * pushButton_5; - QPushButton * pushButton_6; - QPushButton * pushButton_7; - QPushButton * pushButton_8; - QPushButton * pushButton_9; - QPushButton * pushButton_diese; - QPushButton * pushButton_etoile; + QGridLayout* gridLayout; + QPushButton* pushButton_0; + QPushButton* pushButton_1; + QPushButton* pushButton_2; + QPushButton* pushButton_3; + QPushButton* pushButton_4; + QPushButton* pushButton_5; + QPushButton* pushButton_6; + QPushButton* pushButton_7; + QPushButton* pushButton_8; + QPushButton* pushButton_9; + QPushButton* pushButton_diese; + QPushButton* pushButton_etoile; public: Dialpad(QWidget *parent = 0); diff --git a/kde/src/widgets/HistoryDock.cpp b/kde/src/widgets/HistoryDock.cpp index b9abcc193e..b31e8df328 100644 --- a/kde/src/widgets/HistoryDock.cpp +++ b/kde/src/widgets/HistoryDock.cpp @@ -7,6 +7,10 @@ #include <QtGui/QComboBox> #include <QtGui/QPushButton> #include <QtGui/QLabel> +#include <QDebug> +#include <QDate> +#include <QtGui/QTreeWidgetItem> +#include <QtCore/QString> #include <kdatewidget.h> #include <QHeaderView> #include <QtGui/QCheckBox> @@ -58,12 +62,12 @@ HistoryDock::HistoryDock(QWidget* parent) : QDockWidget(parent) m_pFilterLE = new KLineEdit(); m_pItemView = new HistoryTree(this); m_pSortByCBB = new QComboBox(); - m_pSortByL = new QLabel("Sort by:"); - m_pFromL = new QLabel("From:"); - m_pToL = new QLabel("To:"); + m_pSortByL = new QLabel(i18n("Sort by:")); + m_pFromL = new QLabel(i18n("From:")); + m_pToL = new QLabel(i18n("To:")); m_pFromDW = new KDateWidget(); m_pToDW = new KDateWidget(); - m_pAllTimeCB = new QCheckBox("Display all"); + m_pAllTimeCB = new QCheckBox(i18n("Display all")); m_pLinkPB = new QPushButton(this); m_pAllTimeCB->setChecked(ConfigurationSkeleton::displayDataRange()); @@ -75,7 +79,7 @@ HistoryDock::HistoryDock(QWidget* parent) : QDockWidget(parent) m_pLinkPB->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding); m_pLinkPB->setCheckable(true); - m_pItemView->headerItem()->setText(0,"Calls" ); + m_pItemView->headerItem()->setText(0,i18n("Calls") ); m_pItemView->header ()->setClickable(true ); m_pItemView->header ()->setSortIndicatorShown(true ); m_pItemView->setAlternatingRowColors(true ); @@ -84,7 +88,7 @@ HistoryDock::HistoryDock(QWidget* parent) : QDockWidget(parent) KeyPressEater *keyPressEater = new KeyPressEater(this); m_pItemView->installEventFilter(keyPressEater); - m_pFilterLE->setPlaceholderText("Filter"); + m_pFilterLE->setPlaceholderText(i18n("Filter")); m_pFilterLE->setClearButtonShown(true); QStringList sortBy; @@ -107,7 +111,7 @@ HistoryDock::HistoryDock(QWidget* parent) : QDockWidget(parent) mainLayout->addWidget(m_pItemView ,6,0,1,3 ); mainLayout->addWidget(m_pFilterLE ,7,0,1,3 ); - setWindowTitle("History"); + setWindowTitle(i18n("History")); QDate date(2000,1,1); m_pFromDW->setDate(date); diff --git a/kde/src/widgets/HistoryDock.h b/kde/src/widgets/HistoryDock.h index 5f49d8b386..3c1b20e68b 100644 --- a/kde/src/widgets/HistoryDock.h +++ b/kde/src/widgets/HistoryDock.h @@ -2,19 +2,23 @@ #define HISTORY_DOCK_H #include <QtGui/QDockWidget> -#include <QDebug> -#include <QDate> -#include <QtGui/QTreeWidgetItem> -#include <QtCore/QString> +#include <QtGui/QTreeWidget> +#include <QtCore/QDate> +//Qt +class QTreeWidgetItem; +class QString; class QTreeWidget; -class KLineEdit; class QComboBox; class QLabel; -class KDateWidget; class QCheckBox; class QPushButton; -class QDate; + +//KDE +class KLineEdit; +class KDateWidget; + +//SFLPhone class HistoryTreeItem; class HistoryTree; diff --git a/kde/src/widgets/HistoryTreeItem.cpp b/kde/src/widgets/HistoryTreeItem.cpp index f0ca222f54..f27c8c8793 100644 --- a/kde/src/widgets/HistoryTreeItem.cpp +++ b/kde/src/widgets/HistoryTreeItem.cpp @@ -26,14 +26,21 @@ #include <kdebug.h> #include <unistd.h> #include <kaction.h> -#include <kicon.h> +#include <QtGui/QLabel> +#include <QtGui/QSpacerItem> +#include <QtGui/QHBoxLayout> +#include <QtGui/QVBoxLayout> +#include <KIcon> +#include <QLabel> #include "lib/sflphone_const.h" #include "HistoryTreeItem.h" #include "AkonadiBackend.h" #include "lib/Contact.h" #include "SFLPhone.h" +#include "widgets/BookmarkDock.h" #include "conf/ConfigurationSkeleton.h" +#include "lib/Call.h" const char * HistoryTreeItem::callStateIcons[12] = {ICON_INCOMING, ICON_RINGING, ICON_CURRENT, ICON_DIALING, ICON_HOLD, ICON_FAILURE, ICON_BUSY, ICON_TRANSFER, ICON_TRANSF_HOLD, "", "", ICON_CONFERENCE}; @@ -50,32 +57,32 @@ HistoryTreeItem::HistoryTreeItem(QWidget *parent ,QString phone) m_pAddToContact = new KAction(this); m_pBookmark = new KAction(this); - m_pCallAgain->setShortcut ( Qt::CTRL + Qt::Key_Enter ); - m_pCallAgain->setText ( "Call Again" ); - m_pCallAgain->setIcon ( KIcon(ICON_DIALING) ); - - m_pAddToContact->setShortcut ( Qt::CTRL + Qt::Key_E ); - m_pAddToContact->setText ( "Add Number to Contact" ); - m_pAddToContact->setIcon ( KIcon("list-resource-add") ); - m_pAddToContact->setDisabled ( true ); + m_pCallAgain->setShortcut ( Qt::CTRL + Qt::Key_Enter ); + m_pCallAgain->setText ( i18n("Call Again") ); + m_pCallAgain->setIcon ( KIcon(ICON_DIALING) ); + + m_pAddToContact->setShortcut ( Qt::CTRL + Qt::Key_E ); + m_pAddToContact->setText ( i18n("Add Number to Contact") ); + m_pAddToContact->setIcon ( KIcon("list-resource-add") ); + m_pAddToContact->setDisabled ( true ); - m_pAddContact->setShortcut ( Qt::CTRL + Qt::Key_E ); - m_pAddContact->setText ( "Add Contact" ); - m_pAddContact->setIcon ( KIcon("contact-new") ); + m_pAddContact->setShortcut ( Qt::CTRL + Qt::Key_E ); + m_pAddContact->setText ( i18n("Add Contact") ); + m_pAddContact->setIcon ( KIcon("contact-new") ); - m_pCopy->setShortcut ( Qt::CTRL + Qt::Key_C ); - m_pCopy->setText ( "Copy" ); - m_pCopy->setIcon ( KIcon("edit-copy") ); - m_pCopy->setDisabled ( true ); + m_pCopy->setShortcut ( Qt::CTRL + Qt::Key_C ); + m_pCopy->setText ( i18n("Copy") ); + m_pCopy->setIcon ( KIcon("edit-copy") ); + m_pCopy->setDisabled ( true ); - m_pEmail->setShortcut ( Qt::CTRL + Qt::Key_M ); - m_pEmail->setText ( "Send Email" ); - m_pEmail->setIcon ( KIcon("mail-message-new") ); - m_pEmail->setDisabled ( true ); + m_pEmail->setShortcut ( Qt::CTRL + Qt::Key_M ); + m_pEmail->setText ( i18n("Send Email") ); + m_pEmail->setIcon ( KIcon("mail-message-new") ); + m_pEmail->setDisabled ( true ); - m_pBookmark->setShortcut ( Qt::CTRL + Qt::Key_D ); - m_pBookmark->setText ( "Bookmark" ); - m_pBookmark->setIcon ( KIcon("bookmarks") ); + m_pBookmark->setShortcut ( Qt::CTRL + Qt::Key_D ); + m_pBookmark->setText ( i18n("Bookmark") ); + m_pBookmark->setIcon ( KIcon("bookmarks") ); connect(m_pCallAgain , SIGNAL(triggered()) , this , SLOT(callAgain() )); connect(m_pAddContact , SIGNAL(triggered()) , this , SLOT(addContact() )); @@ -161,7 +168,7 @@ bool HistoryTreeItem::getContactInfo(QString phoneNumber) } else { labelIcon->setPixmap(QPixmap(KIcon("user-identity").pixmap(QSize(48,48)))); - labelPeerName->setText("<b>Unknow</b>"); + labelPeerName->setText(i18n("<b>Unknow</b>")); return false; } return true; diff --git a/kde/src/widgets/HistoryTreeItem.h b/kde/src/widgets/HistoryTreeItem.h index abe24eabfa..28eb710bc8 100644 --- a/kde/src/widgets/HistoryTreeItem.h +++ b/kde/src/widgets/HistoryTreeItem.h @@ -28,22 +28,21 @@ #ifndef HISTORYTREE_ITEM_H #define HISTORYTREE_ITEM_H +#include <QtGui/QWidget> #include <QtCore/QList> #include <QtCore/QVariant> #include <QtCore/QVector> -#include <QtGui/QWidget> -#include <QtGui/QLabel> -#include <QtGui/QSpacerItem> -#include <QtGui/QHBoxLayout> -#include <QtGui/QVBoxLayout> -#include <KIcon> - -#include "lib/Call.h" +//SFLPhone +class Call; +//Qt class QTreeWidgetItem; -class KAction; class QMenu; +class QLabel; + +//KDE +class KAction; class HistoryTreeItem : public QWidget { diff --git a/kde/src/widgets/SFLPhoneTray.cpp b/kde/src/widgets/SFLPhoneTray.cpp index 662506892d..88e924df43 100755 --- a/kde/src/widgets/SFLPhoneTray.cpp +++ b/kde/src/widgets/SFLPhoneTray.cpp @@ -20,6 +20,9 @@ ***************************************************************************/ #include <QDebug> +#include <KAction> +#include <QMenu> +#include <QIcon> #include "SFLPhoneTray.h" diff --git a/kde/src/widgets/SFLPhoneTray.h b/kde/src/widgets/SFLPhoneTray.h index 537e147b6c..9c4d730fcb 100755 --- a/kde/src/widgets/SFLPhoneTray.h +++ b/kde/src/widgets/SFLPhoneTray.h @@ -23,9 +23,13 @@ #define SFLPHONETRAY_H #include <KSystemTrayIcon> -#include <KAction> -#include <QMenu> -#include <QIcon> + +//KDE +class KAction; + +//Qt +class QMenu; +class QIcon; class SFLPhoneTray : public KSystemTrayIcon { -- GitLab