diff --git a/kde/src/AccountListModel.cpp b/kde/src/AccountListModel.cpp index 5f350afcc914773cabe2dea01d33eb30f263474b..7d3a74c0ba07ff56932855103573031ad8dba351 100755 --- a/kde/src/AccountListModel.cpp +++ b/kde/src/AccountListModel.cpp @@ -36,6 +36,13 @@ AccountListModel::~AccountListModel() { } + +/***************************************************************************** + * * + * Getters * + * * + ****************************************************************************/ + ///Get data from the model QVariant AccountListModel::data ( const QModelIndex& index, int role) const { @@ -66,6 +73,19 @@ Qt::ItemFlags AccountListModel::flags(const QModelIndex & index) const return QAbstractItemModel::flags(index); } +///Get the account list +QString AccountListModel::getOrderedList() const +{ + return accounts->getOrderedList(); +} + + +/***************************************************************************** + * * + * Setters * + * * + ****************************************************************************/ + ///Set model data bool AccountListModel::setData(const QModelIndex & index, const QVariant &value, int role) { @@ -78,6 +98,13 @@ bool AccountListModel::setData(const QModelIndex & index, const QVariant &value, return false; } + +/***************************************************************************** + * * + * Mutator * + * * + ****************************************************************************/ + ///Move account up bool AccountListModel::accountUp( int index ) { @@ -123,10 +150,4 @@ bool AccountListModel::addAccount( QString alias ) int AccountListModel::rowCount(const QModelIndex & /*parent*/) const { return accounts->size(); -} - -///Get the account list -QString AccountListModel::getOrderedList() const -{ - return accounts->getOrderedList(); } \ No newline at end of file diff --git a/kde/src/AccountView.cpp b/kde/src/AccountView.cpp index 015dfaea3894a7904841094b92b62bbe096f0523..d34177925551f954331cce4ed59ed3f033f735c0 100644 --- a/kde/src/AccountView.cpp +++ b/kde/src/AccountView.cpp @@ -42,6 +42,13 @@ void AccountView::initItemWidget() connect(itemWidget, SIGNAL(checkStateChanged(bool)), this, SLOT(setEnabled(bool))); } + +/***************************************************************************** + * * + * Getters * + * * + ****************************************************************************/ + ///Get the current item QListWidgetItem* AccountView::getItem() { @@ -80,6 +87,13 @@ bool AccountView::isChecked() const return itemWidget->getEnabled(); } + +/***************************************************************************** + * * + * Mutator * + * * + ****************************************************************************/ + ///Build an item from an account id AccountView* AccountView::buildExistingAccountFromId(QString _accountId) { diff --git a/kde/src/AkonadiBackend.cpp b/kde/src/AkonadiBackend.cpp index 5b37a36c45add53b63aa49d1591a069614294ff1..c0573663b28b1f4b2dbcb85fe06ef7e4a61bc9ea 100644 --- a/kde/src/AkonadiBackend.cpp +++ b/kde/src/AkonadiBackend.cpp @@ -42,6 +42,13 @@ AkonadiBackend::~AkonadiBackend() } + +/***************************************************************************** + * * + * Getters * + * * + ****************************************************************************/ + ///Singleton ContactBackend* AkonadiBackend::getInstance() { @@ -51,6 +58,25 @@ ContactBackend* AkonadiBackend::getInstance() return m_pInstance; } +///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]; +} + + +/***************************************************************************** + * * + * Mutator * + * * + ****************************************************************************/ + ///Update the contact list when a new Akonadi collection is added ContactList AkonadiBackend::update(Akonadi::Collection collection) { @@ -105,33 +131,6 @@ 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) { - update(coll); - emit collectionChanged(); - } -} - ///Edit backend value using an updated frontend contact void AkonadiBackend::editContact(Contact* contact) { @@ -196,4 +195,26 @@ void AkonadiBackend::addNewContact(Contact* contact) qDebug() << "Unable to save new contact to storage"; return; } +} + + +/***************************************************************************** + * * + * Slots * + * * + ****************************************************************************/ + +///Called when a new collection is added +void AkonadiBackend::collectionsReceived( const Akonadi::Collection::List& list) +{ + foreach (Akonadi::Collection coll, list) { + update(coll); + emit collectionChanged(); + } +} + +///Update the contact list even without a new collection +ContactList AkonadiBackend::update_slot() +{ + return update(m_pCollection); } \ No newline at end of file diff --git a/kde/src/Codec.cpp b/kde/src/Codec.cpp index 12a71191d35eed97f12f6d2b1c2cfd2718f30a5b..c736aa52c00435ed32db89317b731326e6a71a71 100755 --- a/kde/src/Codec.cpp +++ b/kde/src/Codec.cpp @@ -37,6 +37,13 @@ Codec::Codec(int payload, bool enabled) this->bandwidth = details[CODEC_BANDWIDTH]; } + +/***************************************************************************** + * * + * Getters * + * * + ****************************************************************************/ + ///Return the payload QString Codec::getPayload() const { @@ -73,6 +80,13 @@ bool Codec::isEnabled() const return enabled; } + +/***************************************************************************** + * * + * Setters * + * * + ****************************************************************************/ + ///Set the payload void Codec::setPayload(QString payload) { @@ -108,5 +122,3 @@ void Codec::setEnabled(bool enabled) { this->enabled = enabled; } - - diff --git a/kde/src/SFLPhone.cpp b/kde/src/SFLPhone.cpp index 3de354e46da1b88d540a04e00c852ac037a35d0b..c42f01b895bc857b5c502323db1b037478aa54f9 100755 --- a/kde/src/SFLPhone.cpp +++ b/kde/src/SFLPhone.cpp @@ -75,47 +75,6 @@ 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) { - m_pModel = new TreeWidgetCallModel(TreeWidgetCallModel::ActiveCall); - m_pModel->initCall(); - m_pModel->initContact(AkonadiBackend::getInstance()); - } - 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; -} - ///Init everything bool SFLPhone::initialize() { @@ -197,14 +156,6 @@ bool SFLPhone::initialize() return true; } -///Set widgets object name -void SFLPhone::setObjectNames() -{ - m_pView->setObjectName ( "m_pView" ); - statusBar()->setObjectName ( "statusBar" ); - m_pTrayIcon->setObjectName ( "trayIcon" ); -} - ///Setup evry actions void SFLPhone::setupActions() { @@ -284,10 +235,93 @@ void SFLPhone::setupActions() createGUI(); } + +/***************************************************************************** + * * + * Getters * + * * + ****************************************************************************/ + +///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) { + m_pModel = new TreeWidgetCallModel(TreeWidgetCallModel::ActiveCall); + m_pModel->initCall(); + m_pModel->initContact(AkonadiBackend::getInstance()); + } + 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; +} + void SFLPhone::showShortCutEditor() { KShortcutsDialog::configure( actionCollection() ); } +///Produce an actionList for auto CallBack +QList<QAction*> SFLPhone::getCallActions() +{ + QList<QAction*> callActions = QList<QAction *>(); + callActions.insert((int) Accept , action_accept ); + callActions.insert((int) Refuse , action_refuse ); + callActions.insert((int) Hold , action_hold ); + callActions.insert((int) Transfer , action_transfer ); + callActions.insert((int) Record , action_record ); + callActions.insert((int) Mailbox , action_mailBox ); + return callActions; +} + + +/***************************************************************************** + * * + * Setters * + * * + ****************************************************************************/ + +///Set widgets object name +void SFLPhone::setObjectNames() +{ + m_pView->setObjectName ( "m_pView" ); + statusBar()->setObjectName ( "statusBar" ); + m_pTrayIcon->setObjectName ( "trayIcon" ); +} + + +/***************************************************************************** + * * + * Mutator * + * * + ****************************************************************************/ + ///[Action]Hide sflphone bool SFLPhone::queryClose() { @@ -382,19 +416,6 @@ void SFLPhone::on_m_pView_screenChanged(int screen) if(screen == SCREEN_MAIN) action_main->setChecked(true); } -///Produce an actionList for auto CallBack -QList<QAction*> SFLPhone::getCallActions() -{ - QList<QAction*> callActions = QList<QAction *>(); - callActions.insert((int) Accept , action_accept ); - callActions.insert((int) Refuse , action_refuse ); - callActions.insert((int) Hold , action_hold ); - callActions.insert((int) Transfer , action_transfer ); - callActions.insert((int) Record , action_record ); - callActions.insert((int) Mailbox , action_mailBox ); - return callActions; -} - ///Called when a call is coming void SFLPhone::on_m_pView_incomingCall(const Call * call) { diff --git a/kde/src/SFLPhoneView.cpp b/kde/src/SFLPhoneView.cpp index 7606cd68b156e30a51be7a0b84d3cad3ae6e4728..89c3b4688e02aec98b48f31b3352752376ceecd2 100755 --- a/kde/src/SFLPhoneView.cpp +++ b/kde/src/SFLPhoneView.cpp @@ -112,12 +112,27 @@ void SFLPhoneView::loadWindow() updateStatusMessage (); } + +/***************************************************************************** + * * + * Getters * + * * + ****************************************************************************/ + + ///Return the error window QErrorMessage * SFLPhoneView::getErrorWindow() { return errorWindow; } + +/***************************************************************************** + * * + * Keyboard input * + * * + ****************************************************************************/ + ///Called on keyboard void SFLPhoneView::typeString(QString str) { @@ -208,6 +223,14 @@ void SFLPhoneView::enter() } } + +/***************************************************************************** + * * + * Mutator * + * * + ****************************************************************************/ + +/// void SFLPhoneView::action(Call* call, call_action action) { if(! call) { @@ -225,9 +248,14 @@ void SFLPhoneView::action(Call* call, call_action action) } -/******************************************* -******** Update Display Functions ********** -*******************************************/ + + +/***************************************************************************** + * * + * Update display related code * + * * + ****************************************************************************/ + ///Change GUI icons void SFLPhoneView::updateWindowCallState() @@ -456,10 +484,11 @@ void SFLPhoneView::updateStatusMessage() } - -/************************************************************ -************ Autoconnect ************* -************************************************************/ +/***************************************************************************** + * * + * Slots * + * * + ****************************************************************************/ ///Proxy to hide or show the volume control ///@TODO is it still needed? <elepage 2011> diff --git a/kde/src/conf/dlgaccounts.cpp b/kde/src/conf/dlgaccounts.cpp index d9ec80755511ded5f31b85277fb7ac7d3b540c59..99764876c15ef101845c4edbc2dd81b815225e4f 100755 --- a/kde/src/conf/dlgaccounts.cpp +++ b/kde/src/conf/dlgaccounts.cpp @@ -26,9 +26,53 @@ #include "SFLPhoneView.h" #include "../AccountView.h" #include "lib/sflphone_const.h" +#include <kconfigdialog.h> +#include <QTableWidget> +#include <QListWidgetItem> #include "conf/ConfigurationDialog.h" -#include <vector> -#include <string> +#include <QWidget> +#include <QDebug> + +Private_AddCodecDialog::Private_AddCodecDialog(QList< StringHash > itemList, QStringList currentItems ,QWidget* parent) : KDialog(parent) { + codecTable = new QTableWidget(this); + codecTable->verticalHeader()->setVisible(false); + codecTable->setColumnCount(4); + for (int i=0;i<4;i++) { + codecTable->setHorizontalHeaderItem( i, new QTableWidgetItem(0)); + codecTable->horizontalHeader()->setResizeMode(i,QHeaderView::ResizeToContents); + } + + codecTable->setSelectionBehavior(QAbstractItemView::SelectRows); + codecTable->horizontalHeader()->setResizeMode(0,QHeaderView::Stretch); + codecTable->horizontalHeaderItem(0)->setText( "Name" ); + codecTable->horizontalHeaderItem(1)->setText( "Bitrate" ); + codecTable->horizontalHeaderItem(2)->setText( "Frequency" ); + codecTable->horizontalHeaderItem(3)->setText( "Alias" ); + int i =0; + foreach (StringHash aCodec, itemList) { + if ( currentItems.indexOf(aCodec["alias"]) == -1) { + codecTable->setRowCount(i+1); + QTableWidgetItem* cName = new QTableWidgetItem( aCodec["name"] ); + codecTable->setItem( i,0,cName ); + QTableWidgetItem* cBitrate = new QTableWidgetItem( aCodec["bitrate"] ); + codecTable->setItem( i,1,cBitrate ); + QTableWidgetItem* cFrequency = new QTableWidgetItem( aCodec["frequency"] ); + codecTable->setItem( i,2,cFrequency ); + QTableWidgetItem* cAlias = new QTableWidgetItem( aCodec["alias"] ); + codecTable->setItem( i,3,cAlias ); + i++; + } + } + setMainWidget(codecTable); + resize(550,300); + + connect(this, SIGNAL(okClicked()), this, SLOT(emitNewCodec())); +} + +void Private_AddCodecDialog::emitNewCodec() { + if (codecTable->currentRow() >= 0) + emit addCodec(codecTable->item(codecTable->currentRow(),3)->text()); +} DlgAccounts::DlgAccounts(KConfigDialog* parent) : QWidget(parent) diff --git a/kde/src/conf/dlgaccounts.h b/kde/src/conf/dlgaccounts.h index d6112e20fcbf776f981aa07d6487bb508778899a..413205bce3fc8c5c6f74a95ca32e787da8836195 100755 --- a/kde/src/conf/dlgaccounts.h +++ b/kde/src/conf/dlgaccounts.h @@ -21,18 +21,19 @@ #ifndef DLGACCOUNTS_H #define DLGACCOUNTS_H -#include <QWidget> -#include <QDebug> -#include <kconfigdialog.h> -#include <QTableWidget> -#include <QListWidgetItem> - #include "ui_dlgaccountsbase.h" #include "AccountView.h" #include "ConfigAccountList.h" -typedef QHash<QString, QString> StringHash; //Needed to fix a Qt foreach macro argument parsing bug +//Qt +class QTableWidget; +class QListWidgetItem; +class QWidget; + +//KDE +class KConfigDialog; +///@struct CredentialData store credential informations struct CredentialData { QListWidgetItem* pointer ; QString name ; @@ -40,54 +41,22 @@ struct CredentialData { QString realm ; }; +//Typedef +typedef QHash<QString, QString> StringHash; //Needed to fix a Qt foreach macro argument parsing bug typedef QHash<QListWidgetItem*, CredentialData> QListWidgetItemHash; //Needed to fix a Qt foreach macro argument parsing bug typedef QList<CredentialData> CredentialList; class Private_AddCodecDialog : public KDialog { Q_OBJECT public: - Private_AddCodecDialog(QList< StringHash > itemList, QStringList currentItems ,QWidget* parent = 0) : KDialog(parent) { - codecTable = new QTableWidget(this); - codecTable->verticalHeader()->setVisible(false); - codecTable->setColumnCount(4); - for (int i=0;i<4;i++) { - codecTable->setHorizontalHeaderItem( i, new QTableWidgetItem(0)); - codecTable->horizontalHeader()->setResizeMode(i,QHeaderView::ResizeToContents); - } - - codecTable->setSelectionBehavior(QAbstractItemView::SelectRows); - codecTable->horizontalHeader()->setResizeMode(0,QHeaderView::Stretch); - codecTable->horizontalHeaderItem(0)->setText( "Name" ); - codecTable->horizontalHeaderItem(1)->setText( "Bitrate" ); - codecTable->horizontalHeaderItem(2)->setText( "Frequency" ); - codecTable->horizontalHeaderItem(3)->setText( "Alias" ); - int i =0; - foreach (StringHash aCodec, itemList) { - if ( currentItems.indexOf(aCodec["alias"]) == -1) { - codecTable->setRowCount(i+1); - QTableWidgetItem* cName = new QTableWidgetItem( aCodec["name"] ); - codecTable->setItem( i,0,cName ); - QTableWidgetItem* cBitrate = new QTableWidgetItem( aCodec["bitrate"] ); - codecTable->setItem( i,1,cBitrate ); - QTableWidgetItem* cFrequency = new QTableWidgetItem( aCodec["frequency"] ); - codecTable->setItem( i,2,cFrequency ); - QTableWidgetItem* cAlias = new QTableWidgetItem( aCodec["alias"] ); - codecTable->setItem( i,3,cAlias ); - i++; - } - } - setMainWidget(codecTable); - resize(550,300); - - connect(this, SIGNAL(okClicked()), this, SLOT(emitNewCodec())); - } + Private_AddCodecDialog(QList< StringHash > itemList, QStringList currentItems ,QWidget* parent = 0); + private: QTableWidget* codecTable; + private slots: - void emitNewCodec() { - if (codecTable->currentRow() >= 0) - emit addCodec(codecTable->item(codecTable->currentRow(),3)->text()); - } + void emitNewCodec(); + signals: void addCodec(QString alias); }; diff --git a/kde/src/widgets/AccountItemWidget.cpp b/kde/src/widgets/AccountItemWidget.cpp index d19308b9c1052c892c0aab3a72f8ea4add298907..5c552496cd0ee50642e654b3ff924337ed515bae 100755 --- a/kde/src/widgets/AccountItemWidget.cpp +++ b/kde/src/widgets/AccountItemWidget.cpp @@ -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 "AccountItemWidget.h" @@ -61,6 +61,13 @@ AccountItemWidget::~AccountItemWidget() delete textLabel; } + +/***************************************************************************** + * * + * Mutator * + * * + ****************************************************************************/ + ///Update the LED widget color void AccountItemWidget::updateStateDisplay() { @@ -92,6 +99,13 @@ void AccountItemWidget::updateDisplay() updateEnabledDisplay(); } + +/***************************************************************************** + * * + * Setters * + * * + ****************************************************************************/ + ///Set the model state of the widget void AccountItemWidget::setState(int state) { @@ -118,6 +132,13 @@ bool AccountItemWidget::getEnabled() return checkBox->checkState(); } + +/***************************************************************************** + * * + * SLOTS * + * * + ****************************************************************************/ + ///Model state changed void AccountItemWidget::on_checkBox_stateChanged(int state) { diff --git a/kde/src/widgets/BookmarkDock.cpp b/kde/src/widgets/BookmarkDock.cpp index fd52f16ae90b39b42d203c08d37d25d5f9fe26f6..10ec7b023a0457f666b9f57d8a521e706b59c529 100644 --- a/kde/src/widgets/BookmarkDock.cpp +++ b/kde/src/widgets/BookmarkDock.cpp @@ -69,6 +69,13 @@ BookmarkDock::~BookmarkDock() } + +/***************************************************************************** + * * + * Mutator * + * * + ****************************************************************************/ + ///Add a new bookmark void BookmarkDock::addBookmark_internal(QString phone) { diff --git a/kde/src/widgets/CallTreeItem.cpp b/kde/src/widgets/CallTreeItem.cpp index 64f452e0b46062477fc46531b306606bcd6af3dc..127db14f401ee3096f03e7b06940bcb336f789a5 100644 --- a/kde/src/widgets/CallTreeItem.cpp +++ b/kde/src/widgets/CallTreeItem.cpp @@ -57,12 +57,26 @@ CallTreeItem::~CallTreeItem() } + +/***************************************************************************** + * * + * Getters * + * * + ****************************************************************************/ + ///Return the call item Call* CallTreeItem::call() const { return itemCall; } + +/***************************************************************************** + * * + * Mutator * + * * + ****************************************************************************/ + ///Set the call item void CallTreeItem::setCall(Call *call) { @@ -182,5 +196,4 @@ void CallTreeItem::updated() else { //qDebug() << "Updating item of call of state OVER. Doing nothing."; } - } diff --git a/kde/src/widgets/ContactDock.cpp b/kde/src/widgets/ContactDock.cpp index 27b2a7ee2a9875cddd2d1439c62914a947f5d224..d7bb2c354906e0d3da8f7c043a57ae74ceffe610 100644 --- a/kde/src/widgets/ContactDock.cpp +++ b/kde/src/widgets/ContactDock.cpp @@ -134,6 +134,13 @@ ContactDock::~ContactDock() } + +/***************************************************************************** + * * + * Mutator * + * * + ****************************************************************************/ + ///Reload the contact void ContactDock::reloadContact() { @@ -202,6 +209,13 @@ void ContactDock::filter(QString text) m_pContactView->expandAll(); } + +/***************************************************************************** + * * + * Drag and Drop * + * * + ****************************************************************************/ + ///Serialize informations to be used for drag and drop QMimeData* ContactTree::mimeData( const QList<QTreeWidgetItem *> items) const { @@ -242,6 +256,13 @@ bool ContactTree::dropMimeData(QTreeWidgetItem *parent, int index, const QMimeDa return false; } + +/***************************************************************************** + * * + * Setters * + * * + ****************************************************************************/ + ///Show or hide the history list void ContactDock::setHistoryVisible(bool visible) { @@ -250,6 +271,13 @@ void ContactDock::setHistoryVisible(bool visible) ConfigurationSkeleton::setDisplayContactCallHistory(visible); } + +/***************************************************************************** + * * + * Keyboard handling * + * * + ****************************************************************************/ + ///Handle keypresses ont the dock void ContactDock::keyPressEvent(QKeyEvent* event) { int key = event->key(); diff --git a/kde/src/widgets/ContactItemWidget.cpp b/kde/src/widgets/ContactItemWidget.cpp index 4c0c6ffdcbf1382dbb49dbbbfae63544c7b85334..ac2224c3a89c620d2a1c7a7c447b45121c6761b9 100644 --- a/kde/src/widgets/ContactItemWidget.cpp +++ b/kde/src/widgets/ContactItemWidget.cpp @@ -98,6 +98,13 @@ ContactItemWidget::~ContactItemWidget() } + +/***************************************************************************** + * * + * Setters * + * * + ****************************************************************************/ + ///Set the contact void ContactItemWidget::setContact(Contact* contact) { @@ -134,6 +141,19 @@ void ContactItemWidget::setContact(Contact* contact) connect(this,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(showContext(QPoint))); } +///Set the model index +void ContactItemWidget::setItem(QTreeWidgetItem* item) +{ + m_pItem = item; +} + + +/***************************************************************************** + * * + * Slots * + * * + ****************************************************************************/ + ///The contact need to be updated void ContactItemWidget::updated() { @@ -168,6 +188,13 @@ void ContactItemWidget::updated() m_pIconL->setPixmap(*m_pContactKA->getPhoto()); } + +/***************************************************************************** + * * + * Getters * + * * + ****************************************************************************/ + ///Return contact name QString ContactItemWidget::getContactName() const { @@ -204,18 +231,19 @@ QTreeWidgetItem* ContactItemWidget::getItem() return m_pItem; } -///Set the model index -void ContactItemWidget::setItem(QTreeWidgetItem* item) -{ - m_pItem = item; -} - ///Return the contact object Contact* ContactItemWidget::getContact() { return m_pContactKA; } + +/***************************************************************************** + * * + * Mutator * + * * + ****************************************************************************/ + ///Show the context menu void ContactItemWidget::showContext(const QPoint& pos) { diff --git a/kde/src/widgets/HistoryDock.cpp b/kde/src/widgets/HistoryDock.cpp index b31e8df3286fbca081bb7196a69d1865052d914f..d3c385e36ce9bec632d30c4d26876a1cf12ee71a 100644 --- a/kde/src/widgets/HistoryDock.cpp +++ b/kde/src/widgets/HistoryDock.cpp @@ -133,6 +133,13 @@ HistoryDock::~HistoryDock() { } + +/***************************************************************************** + * * + * Getters * + * * + ****************************************************************************/ + ///Return the identity of the call caller QString HistoryDock::getIdentity(HistoryTreeItem* item) { @@ -142,6 +149,13 @@ QString HistoryDock::getIdentity(HistoryTreeItem* item) return item->getName(); } + +/***************************************************************************** + * * + * Mutator * + * * + ****************************************************************************/ + ///Update informations void HistoryDock::updateContactInfo() { @@ -281,6 +295,13 @@ void HistoryDock::updateLinkedToDate(QDate date) connect (m_pFromDW , SIGNAL(changed(QDate)), this, SLOT(updateLinkedFromDate(QDate))); } + +/***************************************************************************** + * * + * Drag and drop * + * * + ****************************************************************************/ + ///Generate serializerd version of the content QMimeData* HistoryTree::mimeData( const QList<QTreeWidgetItem *> items) const { @@ -318,6 +339,13 @@ bool HistoryTree::dropMimeData(QTreeWidgetItem *parent, int index, const QMimeDa return false; } + +/***************************************************************************** + * * + * Keyboard handling * + * * + ****************************************************************************/ + ///Handle keyboard input and redirect them to the filterbox void HistoryDock::keyPressEvent(QKeyEvent* event) { int key = event->key(); diff --git a/kde/src/widgets/HistoryTreeItem.cpp b/kde/src/widgets/HistoryTreeItem.cpp index f27c8c8793c03d0dd458fbba0dc0262f3bc355ba..f4038e04f8b950ab7cb5da25dcad9fcff46517c7 100644 --- a/kde/src/widgets/HistoryTreeItem.cpp +++ b/kde/src/widgets/HistoryTreeItem.cpp @@ -125,55 +125,19 @@ HistoryTreeItem::~HistoryTreeItem() } + +/***************************************************************************** + * * + * Mutator * + * * + ****************************************************************************/ + ///Return the call item Call* HistoryTreeItem::call() const { return itemCall; } -///Set the call to be handled by this item -void HistoryTreeItem::setCall(Call *call) -{ - itemCall = call; - - if (itemCall->isConference()) { - labelIcon->setVisible(true); - return; - } - - labelCallNumber2->setText(itemCall->getPeerPhoneNumber()); - - m_pTimeL->setText(QDateTime::fromTime_t(itemCall->getStartTimeStamp().toUInt()).toString()); - - int dur = itemCall->getStopTimeStamp().toInt() - itemCall->getStartTimeStamp().toInt(); - m_pDurationL->setText(QString("%1").arg(dur/3600,2)+":"+QString("%1").arg((dur%3600)/60,2)+":"+QString("%1").arg((dur%3600)%60,2)+" "); - - connect(itemCall , SIGNAL(changed()) , this , SLOT(updated() )); - updated(); - - m_pTimeStamp = itemCall->getStartTimeStamp().toUInt(); - m_pDuration = dur; - m_pName = itemCall->getPeerName(); - m_pPhoneNumber = itemCall->getPeerPhoneNumber(); -} - -///Can a contact be associed with this call? -bool HistoryTreeItem::getContactInfo(QString phoneNumber) -{ - Contact* contact = AkonadiBackend::getInstance()->getContactByPhone(phoneNumber); - if (contact) { - if (contact->getPhoto() != NULL) - labelIcon->setPixmap(*contact->getPhoto()); - labelPeerName->setText("<b>"+contact->getFormattedName()+"</b>"); - } - else { - labelIcon->setPixmap(QPixmap(KIcon("user-identity").pixmap(QSize(48,48)))); - labelPeerName->setText(i18n("<b>Unknow</b>")); - return false; - } - return true; -} - ///The item have to be updated void HistoryTreeItem::updated() { @@ -201,42 +165,6 @@ void HistoryTreeItem::updated() } -///Return the time stamp -uint HistoryTreeItem::getTimeStamp() -{ - return m_pTimeStamp; -} - -///Return the duration -uint HistoryTreeItem::getDuration() -{ - return m_pDuration; -} - -///Return the caller name -QString HistoryTreeItem::getName() -{ - return m_pName; -} - -///Return the caller peer number -QString HistoryTreeItem::getPhoneNumber() -{ - return m_pPhoneNumber; -} - -///Get the index item assiciated with this widget -QTreeWidgetItem* HistoryTreeItem::getItem() -{ - return m_pItem; -} - -///Set the index associed with this widget -void HistoryTreeItem::setItem(QTreeWidgetItem* item) -{ - m_pItem = item; -} - ///Show the context menu void HistoryTreeItem::showContext(const QPoint& pos) { @@ -297,4 +225,97 @@ void HistoryTreeItem::bookmark() { qDebug() << "bookmark"; SFLPhone::app()->bookmarkDock()->addBookmark(m_pPhoneNumber); +} + + +/***************************************************************************** + * * + * Setters * + * * + ****************************************************************************/ + +///Set the call to be handled by this item +void HistoryTreeItem::setCall(Call *call) +{ + itemCall = call; + + if (itemCall->isConference()) { + labelIcon->setVisible(true); + return; + } + + labelCallNumber2->setText(itemCall->getPeerPhoneNumber()); + + m_pTimeL->setText(QDateTime::fromTime_t(itemCall->getStartTimeStamp().toUInt()).toString()); + + int dur = itemCall->getStopTimeStamp().toInt() - itemCall->getStartTimeStamp().toInt(); + m_pDurationL->setText(QString("%1").arg(dur/3600,2)+":"+QString("%1").arg((dur%3600)/60,2)+":"+QString("%1").arg((dur%3600)%60,2)+" "); + + connect(itemCall , SIGNAL(changed()) , this , SLOT(updated() )); + updated(); + + m_pTimeStamp = itemCall->getStartTimeStamp().toUInt(); + m_pDuration = dur; + m_pName = itemCall->getPeerName(); + m_pPhoneNumber = itemCall->getPeerPhoneNumber(); +} + +///Set the index associed with this widget +void HistoryTreeItem::setItem(QTreeWidgetItem* item) +{ + m_pItem = item; +} + + +/***************************************************************************** + * * + * Getters * + * * + ****************************************************************************/ + +///Can a contact be associed with this call? +bool HistoryTreeItem::getContactInfo(QString phoneNumber) +{ + Contact* contact = AkonadiBackend::getInstance()->getContactByPhone(phoneNumber); + if (contact) { + if (contact->getPhoto() != NULL) + labelIcon->setPixmap(*contact->getPhoto()); + labelPeerName->setText("<b>"+contact->getFormattedName()+"</b>"); + } + else { + labelIcon->setPixmap(QPixmap(KIcon("user-identity").pixmap(QSize(48,48)))); + labelPeerName->setText(i18n("<b>Unknow</b>")); + return false; + } + return true; +} + +///Return the time stamp +uint HistoryTreeItem::getTimeStamp() +{ + return m_pTimeStamp; +} + +///Return the duration +uint HistoryTreeItem::getDuration() +{ + return m_pDuration; +} + +///Return the caller name +QString HistoryTreeItem::getName() +{ + return m_pName; +} + +///Return the caller peer number +QString HistoryTreeItem::getPhoneNumber() +{ + return m_pPhoneNumber; +} + +///Get the index item assiciated with this widget +QTreeWidgetItem* HistoryTreeItem::getItem() +{ + return m_pItem; } \ No newline at end of file diff --git a/kde/src/widgets/SFLPhoneTray.cpp b/kde/src/widgets/SFLPhoneTray.cpp index 4c2ab1814ff2a607eebee7d5524eeed6c33075aa..c2a00f404cd57aa82bc142c0c9828813ccfc3c9d 100755 --- a/kde/src/widgets/SFLPhoneTray.cpp +++ b/kde/src/widgets/SFLPhoneTray.cpp @@ -55,6 +55,13 @@ bool SFLPhoneTray::initialize() return true; } + +/***************************************************************************** + * * + * Mutator * + * * + ****************************************************************************/ + ///Add a new action void SFLPhoneTray::addAction(KAction *action) {