diff --git a/.gitignore b/.gitignore index 84df355e2b601adf37a6e6a520f50d42c16187aa..72adb2e01f8941612cc75fd1f1eedde73685526b 100644 --- a/.gitignore +++ b/.gitignore @@ -118,9 +118,40 @@ sflphone-client-gnome/stamp-h1 /sflphone-client-gnome/tests/check_global /sflphone-client-gnome/src/dbus/marshaller.c /sflphone-client-gnome/src/dbus/marshaller.h +/sflphone-client-gnome/ltmain.sh # Ignore sflphone_kde stuff /sflphone-client-kde/build +/sflphone-client-kde/*.moc +/sflphone-client-kde/src/moc_*.cpp +/sflphone-client-kde/src/ui_*.h +/sflphone-client-kde/po/ +/sflphone-client-kde/po/* +/sflphone-client-kde/doc/ +/sflphone-client-kde/man/ +/sflphone-client-kde/data/ +/sflphone-client-kde/CMakeCache.txt +/sflphone-client-kde/CMakeLists.txt.user +/sflphone-client-kde/CTestTestfile.cmake +/sflphone-client-kde/*.cmake +/sflphone-client-kde/Makefile +/sflphone-client-kde/CMakeFiles/* +/sflphone-client-kde/CMakeTmp/ +/sflphone-client-kde/qtcreator-build/ +/sflphone-client-kde/src/Makefile +/sflphone-client-kde/src/CTestTestfile.cmake +/sflphone-client-kde/src/CMakeFiles/ +/sflphone-client-kde/src/*.moc +/sflphone-client-kde/src/callmanager_dbus_interface.* +/sflphone-client-kde/src/configurationmanager_dbus_interface.* +/sflphone-client-kde/src/instance_dbus_interface.* +/sflphone-client-kde/src/sflphone-client-kde_automoc.cpp +/sflphone-client-kde/src/sflphone-client-kde_automoc.cpp.files +/sflphone-client-kde/src/cmake_install.cmake +/sflphone-client-kde/src/kcfg_settings.cpp +/sflphone-client-kde/src/kcfg_settings.h +/sflphone-client-kde/src/qrc_resources.cxx + # Ignore sub-modules stuff ## libiax2 diff --git a/sflphone-client-kde/src/CMakeLists.txt b/sflphone-client-kde/src/CMakeLists.txt index 765c46c23e1a78d69506762e2d0708c4e209977c..4735bad48c72823e776fe79da1b45fbf93f7c5ca 100644 --- a/sflphone-client-kde/src/CMakeLists.txt +++ b/sflphone-client-kde/src/CMakeLists.txt @@ -16,10 +16,11 @@ ENDIF(${CMAKE_BUILD_TYPE} MATCHES Release) SET ( KDE4_KABC_LIBS -lkabc ) -SET( sflphone_client_kde_SRCS +SET( sflphone_client_kde_SRCS SFLPhoneView.cpp SFLPhone.cpp SFLPhoneapplication.cpp + SFLPhoneTray.cpp main.cpp sflphone_const.h Account.cpp diff --git a/sflphone-client-kde/src/SFLPhone.cpp b/sflphone-client-kde/src/SFLPhone.cpp index a738de36cdf26f63639899187e314725f97ae3b6..95240a49219f73f8c4667c96aad887a160f846d9 100644 --- a/sflphone-client-kde/src/SFLPhone.cpp +++ b/sflphone-client-kde/src/SFLPhone.cpp @@ -72,12 +72,8 @@ bool SFLPhone::initialize() statusBarWidget = new QLabel(); statusBar()->addWidget(statusBarWidget); - trayIconMenu = new QMenu(this); - trayIconMenu->addAction(action_quit); - - trayIcon = new KSystemTrayIcon(this->windowIcon(), this); - trayIcon->setContextMenu(trayIconMenu); + trayIcon = new SFLPhoneTray(this->windowIcon(), this); trayIcon->show(); iconChanged = false; @@ -98,6 +94,7 @@ bool SFLPhone::initialize() (new AccountWizard())->show(); } + initialized_ = true; return true; } @@ -211,47 +208,26 @@ void SFLPhone::quitButton() if(view->listWidget_callList->count() > 0 && instance.getRegistrationCount() <= 1) { qDebug() << "Attempting to quit when still having some calls open."; -// view->getErrorWindow()->showMessage(i18n("You still have some calls open. Please close all calls before quitting.")); } view->saveState(); instance.Unregister(getpid()); qApp->quit(); } - -void SFLPhone::putForeground() -{ - activateWindow(); - hide(); - activateWindow(); - show(); - activateWindow(); -} - -void SFLPhone::trayIconSignal() -{ - if(! isActiveWindow()) - { - trayIcon->setIcon(QIcon(ICON_TRAY_NOTIF)); - iconChanged = true; - } -} - void SFLPhone::sendNotif(QString caller) -{ +{/* notification = new KNotification ( QString("test_notification"), this ); notification->setText("messageText") ; notification->setPixmap( QPixmap( this->windowIcon().pixmap(32, 32) )); notification->setActions( QStringList( i18n( "Open chat" ) ) ); notification->addContext( QString::fromLatin1("call") , "caller" ) ; - connect(notification, SIGNAL(activated(unsigned int )), this , SLOT(sendNotif()) ); - notification->sendEvent(); -} - -void SFLPhone::on_trayIcon_messageClicked() -{ - qDebug() << "on_trayIcon_messageClicked"; - putForeground(); + notification->sendEvent();*/ + /* KNotification::event(QString("test_notification"), + QString("Allo"), + this->windowIcon().pixmap(32, 32), + parentWidget(), + KNotification::CloseOnTimeout, + KGlobal::mainComponent());*/ } void SFLPhone::changeEvent(QEvent * event) @@ -262,31 +238,6 @@ void SFLPhone::changeEvent(QEvent * event) } } -void SFLPhone::on_trayIcon_activated(KSystemTrayIcon::ActivationReason reason) -{ - qDebug() << "on_trayIcon_activated"; - switch (reason) { - case KSystemTrayIcon::Trigger: - case KSystemTrayIcon::DoubleClick: - qDebug() << "Tray icon clicked."; - if(isActiveWindow()) - { - qDebug() << "isactive -> hide()"; - hide(); - } - else - { - qDebug() << "isnotactive -> show()"; - putForeground(); - } - break; - default: - qDebug() << "Tray icon activated with unknown reason."; - break; - } -} - - void SFLPhone::on_view_statusMessageChangeAsked(const QString & message) { qDebug() << "on_view_statusMessageChangeAsked : " + message; @@ -375,11 +326,11 @@ QList <QAction *> SFLPhone::getCallActions() void SFLPhone::on_view_incomingCall(const Call * call) { ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); - trayIconSignal(); - if(configurationManager.popupMode()) + //trayIconSignal(); + /*if(configurationManager.popupMode()) { putForeground(); - } + }*/ if(configurationManager.getNotify()) { sendNotif(call->getPeerName().isEmpty() ? call->getPeerPhoneNumber() : call->getPeerName()); diff --git a/sflphone-client-kde/src/SFLPhone.h b/sflphone-client-kde/src/SFLPhone.h index 0a8f74923523ddf61f81952bd866dde69232fea2..b2292097889afcd6193593bc4b7e4f81051dc425 100644 --- a/sflphone-client-kde/src/SFLPhone.h +++ b/sflphone-client-kde/src/SFLPhone.h @@ -39,6 +39,7 @@ #include "AccountWizard.h" #include "Contact.h" #include "SFLPhoneView.h" +#include "SFLPhoneTray.h" class SFLPhoneView; @@ -93,7 +94,7 @@ private: SFLPhoneView * view; QMenu *trayIconMenu; bool iconChanged; - KSystemTrayIcon *trayIcon; + SFLPhoneTray *trayIcon; KNotification *notification; QLabel * statusBarWidget; @@ -111,15 +112,14 @@ public: bool initialize(); void setupActions(); void sendNotif(QString caller); - void putForeground(); void trayIconSignal(); SFLPhoneView * getView(); QList<QAction *> getCallActions(); private slots: - void on_trayIcon_activated(KSystemTrayIcon::ActivationReason reason); - void on_trayIcon_messageClicked(); + /*void on_trayIcon_activated(KSystemTrayIcon::ActivationReason reason); + void on_trayIcon_messageClicked();*/ void on_view_statusMessageChangeAsked(const QString & message); void on_view_windowTitleChangeAsked(const QString & message); void on_view_enabledActionsChangeAsked(const bool * enabledActions); diff --git a/sflphone-client-kde/src/SFLPhoneTray.cpp b/sflphone-client-kde/src/SFLPhoneTray.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a1a0af965ff8fed0157227a5d0cbcf18963a3beb --- /dev/null +++ b/sflphone-client-kde/src/SFLPhoneTray.cpp @@ -0,0 +1,108 @@ +/************************************** ************************************* + * Copyright (C) 2009 by Savoir-Faire Linux * + * Author : Jérémy Quentin * + * jeremy.quentin@savoirfairelinux.com * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include <QDebug> + +#include "SFLPhoneTray.h" + +SFLPhoneTray::SFLPhoneTray(QIcon icon, QWidget *parent) + : KSystemTrayIcon(icon, parent), + initialized_(false), + trayIconMenu(0) +{ +} + +SFLPhoneTray::~SFLPhoneTray() +{ +} + +bool SFLPhoneTray::initialize() +{ + if ( initialized_ ) + { + qDebug() << "Already initialized."; + return false; + } + + trayIconMenu = new QMenu(parentWidget()); + setContextMenu(trayIconMenu); + + setupActions(); + + initialized_ = true; + + return true; +} + +void SFLPhoneTray::addAction(KAction *action) +{ + trayIconMenu->addAction(action); +} + +void SFLPhoneTray::setupActions() +{ + qDebug() << "setupActions"; +} + +/*void SFLPhone::putForeground() +{ + activateWindow(); + hide(); + activateWindow(); + show(); + activateWindow(); +} +*/ + +/*void SFLPhone::trayIconSignal() +{ + if(! parentWidget()->isActiveWindow()) + { + setIcon(QIcon(ICON_TRAY_NOTIF)); + iconChanged = true; + } +}*/ + +/* +void SFLPhone::on_trayIcon_activated(KSystemTrayIcon::ActivationReason reason) +{ + qDebug() << "on_trayIcon_activated"; + switch (reason) { + case KSystemTrayIcon::Trigger: + case KSystemTrayIcon::DoubleClick: + qDebug() << "Tray icon clicked."; + if(isActiveWindow()) + { + qDebug() << "isactive -> hide()"; + hide(); + } + else + { + qDebug() << "isnotactive -> show()"; + putForeground(); + } + break; + default: + qDebug() << "Tray icon activated with unknown reason."; + break; + } +} +*/ diff --git a/sflphone-client-kde/src/SFLPhoneTray.h b/sflphone-client-kde/src/SFLPhoneTray.h new file mode 100644 index 0000000000000000000000000000000000000000..054d9ae9235cb025b03ca807b5d43280442c5115 --- /dev/null +++ b/sflphone-client-kde/src/SFLPhoneTray.h @@ -0,0 +1,51 @@ +/*************************************************************************** + * Copyright (C) 2009 by Savoir-Faire Linux * + * Author : Jérémy Quentin * + * jeremy.quentin@savoirfairelinux.com * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef SFLPHONETRAY_H +#define SFLPHONETRAY_H + +#include <KSystemTrayIcon> +#include <KAction> +#include <QMenu> +#include <QIcon> + +class SFLPhoneTray : public KSystemTrayIcon +{ +Q_OBJECT + +public: + SFLPhoneTray(QIcon icon, QWidget *parent = 0); + ~SFLPhoneTray(); + bool initialize(); + void setupActions(); + void addAction(KAction *action); + +private: + QMenu *trayIconMenu; + bool initialized_; +/* +private slots: + void activated(KSystemTrayIcon::ActivationReason reason); + void messageClicked();*/ + void trayIconSignal(); +}; + +#endif // SFLPHONETRAY_H