[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    playground/pim/kcall/applet
From:       Tobias Hunger <tobias.hunger () basyskom ! de>
Date:       2007-07-23 17:17:02
Message-ID: 1185211022.373055.22968.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 691452 by hunger:

Begin porting the applet.



 M  +0 -5      CMakeLists.txt  
 D             Makefile.am  
 D             icons/Makefile.am  
 D             kcall.kdevelop  
 M  +9 -9      kcall/CMakeLists.txt  
 D             kcall/Makefile.am  
 M  +78 -62    kcall/kcall.cpp  
 M  +7 -7      kcall/kcall.h  
 M  +20 -20    kcall/main.cpp  


--- trunk/playground/pim/kcall/applet/CMakeLists.txt #691451:691452
@@ -2,8 +2,3 @@
 ADD_SUBDIRECTORY( kcall ) 
 ADD_SUBDIRECTORY( icons ) 
 
-#original Makefile.am contents follow:
-
-##SUBDIRS = $(TOPSUBDIRS)
-#SUBDIRS= kcallsipsettings ilbc gsm dissipate2 audio kcall icons
-#
--- trunk/playground/pim/kcall/applet/kcall/CMakeLists.txt #691451:691452
@@ -1,3 +1,5 @@
+PROJECT(kcall_applet)
+
 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}
                     ${CMAKE_CURRENT_BINARY_DIR}
                     ${KDE4_INCLUDE_DIR}
@@ -10,18 +12,18 @@
 SET(kcallapplet_SRCS
     main.cpp
     kcall.cpp
-    callmanager.cpp
-    diallist.cpp
-    kcallcore.cpp
-    ksipauthentication.cpp
+#    callmanager.cpp
+#    diallist.cpp
+#    kcallcore.cpp
+#    ksipauthentication.cpp
 )
 
 SET(kcallapplet_UI
-    incomingdialog.ui
-    dialdialog.ui
+#     incomingdialog.ui
+#     dialdialog.ui
 )
 
-KDE4_ADD_UI_FILES(kcallapplet_SRCS ${kcallapplet_UI} )
+# KDE4_ADD_UI_FILES(kcallapplet_SRCS ${kcallapplet_UI} )
 
 # SET(kcallapplet_DCOP_SKEL_SRCS
 #     kcallcore.h
@@ -32,8 +34,6 @@
 KDE4_ADD_EXECUTABLE(kcallapplet ${kcallapplet_SRCS})
 
 TARGET_LINK_LIBRARIES(kcallapplet
-                      ${QT_AND_KDECORE_LIBS}
-                      kcallsipsettings
                       ${KDE4_KIO_LIBS}
                       ${KDE4_KDEUI_LIBS}
 )
--- trunk/playground/pim/kcall/applet/kcall/kcall.cpp #691451:691452
@@ -26,41 +26,37 @@
 #include <kmessagebox.h>
 #include <klineedit.h>
 #include <kstdaction.h>
-#include <knotifyclient.h>
 #include <kapplication.h>
-#include <kpopupmenu.h>
 #include <kconfigdialog.h>
 
-#include <qtimer.h>
-#include <qpixmap.h>
-#include <qcursor.h>
+#include <QTimer>
+#include <QPixmap>
+#include <QCursor>
 
-#include "kcallsipsettings.h"
-#include "sipprefs.h"
+// #include "kcallcore.h"
+// #include "dialdialog.h"
+// #include "diallist.h"
+// #include "call.h"
+// #include "incomingdialog.h"
 
-#include "kcallcore.h"
-#include "dialdialog.h"
-#include "diallist.h"
-#include "call.h"
-#include "incomingdialog.h"
 
-
-KCall::KCall()
-     : KSystemTray()
+KCall::KCall() : KSystemTrayIcon()
      , m_isBlinking(false)
      , m_isBlinkIcon(false)
 {
-    m_blinkTimer = new QTimer(this, "m_blinkTimer");
+    m_blinkTimer = new QTimer(this);
     connect(m_blinkTimer, SIGNAL(timeout()), this, SLOT(slotBlink()));
 
-    paintGui();
+    setIcon( loadIcon( offlineIcon ));
+#if 0
+    // paintGui();
     mkcall = new KCallCore();
 
     kCallGuiRunning = mkcall->getGuiStatus();
     if(kCallGuiRunning)
-        kdDebug() << "KCallGui is running!" << endl;
+        kDebug() << "KCallGui is running!" << endl;
     else
-        kdDebug() << "KCallGui is not running!" << endl;
+        kDebug() << "KCallGui is not running!" << endl;
 
     connect(mkcall, SIGNAL(sigGuiStatus(bool)),
             this, SLOT(guiStatus(bool)));
@@ -80,8 +76,8 @@
     connect(incomingdlg, SIGNAL(reject(QString)), SLOT(rejectCall(QString)));
     connect(incomingdlg, SIGNAL(hangup(QString)), SLOT(hangupCall(QString)));
     connect(incomingdlg, SIGNAL(dial()), this, SLOT(slotDialDlg()));
+#endif
 
-
     //ringTimer = new QTimer;
     //connect(ringTimer, SIGNAL(timeout()), this, SLOT(ringAction()));
 
@@ -95,14 +91,16 @@
 
 KCall::~KCall()
 {
-    kdDebug() << "KCall::~ KCall()" << endl;
+    kDebug() << "KCall::~ KCall()" << endl;
+#if 0
     delete mkcall;
+#endif
 }
 
-
+#if 0
 void KCall::mousePressEvent(QMouseEvent *event)
 {
-    kdDebug() << "KCall::mousePressEvent()" << endl;
+    kDebug() << "KCall::mousePressEvent()" << endl;
 
     if (event->button() == LeftButton)
     {
@@ -121,7 +119,7 @@
 
 void KCall::paintGui()
 {
-    kdDebug() << "KCall::paintGui()" << endl;
+    kDebug() << "KCall::paintGui()" << endl;
 
     onlineIcon  = "phone_connect";
     offlineIcon = "phone_disconnect";
@@ -135,7 +133,7 @@
 
 void KCall::showDialList(QMouseEvent *pos)
 {
-    kdDebug() << "KCall::showDialList()" << endl;
+    kDebug() << "KCall::showDialList()" << endl;
 
     KPopupMenu dialListMenu;
     dialListMenu.insertTitle(i18n("Call List"));
@@ -188,7 +186,7 @@
         if(tmpCall->type > 0)
         {
             QString tmpCallInfo = tmpCallerNr+" ("+datetime+")";
-            kdDebug() << tmpCallInfo << endl;
+            kDebug() << tmpCallInfo << endl;
             dialListMenu->insertItem(SmallIcon(tmpCallTypeIcon), tmpCallInfo, this, \
SLOT(slotDialDlg()));  }else
         {
@@ -201,7 +199,7 @@
 
 void KCall::showMainMenu(QMouseEvent *pos)
 {
-    kdDebug() << "KCall::showMainMenu()" << endl;
+    kDebug() << "KCall::showMainMenu()" << endl;
 
     KPopupMenu* mainMenu = new KPopupMenu(this);
 
@@ -222,24 +220,18 @@
 
     mainMenu->popup( pos->globalPos() );
 }
+#endif
 
 void KCall::startBlink( const QPixmap& iconOn, const QPixmap& iconOff )
 {
     m_blinkIconOn = iconOn;
     m_blinkIconOff = iconOff;
-    if ( m_blinkTimer->isActive() == false )
-    {
-        m_isBlinkIcon = true;
-        m_isBlinking = true;
-        m_blinkTimer->start( 1000, false );
-    }
-    else
-    {
-        m_blinkTimer->stop();
-        m_isBlinkIcon = true;
-        m_isBlinking = true;
-        m_blinkTimer->start( 1000, false );
-    }
+    if ( m_blinkTimer->isActive() == true )
+    { m_blinkTimer->stop(); }
+
+    m_isBlinkIcon = true;
+    m_isBlinking = true;
+    m_blinkTimer->start( 1000 );
 }
 
 void KCall::stopBlink()
@@ -249,14 +241,16 @@
 
     m_isBlinkIcon = false;
     m_isBlinking = false;
+    m_blinkTimer->stop();
 }
 
 void KCall::slotBlink()
 {
-    setPixmap( m_isBlinkIcon ? m_blinkIconOn : m_blinkIconOff );
+    setIcon( m_isBlinkIcon ? m_blinkIconOn : m_blinkIconOff );
     m_isBlinkIcon = !m_isBlinkIcon;
 }
 
+#if 0
 void KCall::slotOpenKCall()
 {
     if (!kCallGuiRunning)
@@ -273,6 +267,7 @@
         /// TODO: bring kcall to front
      }
 }
+#endif
 
 
 void KCall::slotAbout()
@@ -289,7 +284,8 @@
 
 void KCall::slotPreferences()
 {
-    kdDebug() << "KCall::slotPreferences()" << endl;
+    kDebug() << "KCall::slotPreferences()" << endl;
+#if 0
     if (!kCallGuiRunning)
     {
        if(KConfigDialog::showDialog("settings"))
@@ -304,21 +300,24 @@
     }
     else
     {
-        kdDebug() << "dcop" << endl;
+        kDebug() << "dcop" << endl;
         mkcall->dcopClient->send("kcall", "KCallGuiCore", "showSettingsDialog()", \
                "");
         //KMessageBox::information(0, i18n("This is not implemented yet."));
     }
+#endif
 }
 
 void KCall::slotSettingsChanged()
 {
+#if 0
     mkcall->settingsChanged();
+#endif
 }
 
 void KCall::slotDialDlg()
 {
-    kdDebug() << "KCall::slotDialDlg()" << endl;
-
+    kDebug() << "KCall::slotDialDlg()" << endl;
+#if 0
     DialDialog dialdlg;
     /*if(num.isEmpty())
     {
@@ -336,6 +335,7 @@
         QString subject = "Hallo Welt!";
         slotStartIncomingCall(callId, caller, subject);
     }
+#endif
 }
 
 
@@ -343,15 +343,17 @@
                                   const QString & caller,
                                   const QString & subject)
 {
-    kdDebug() << "KCall::slotStartIncoming()" << endl;
+    kDebug() << "KCall::slotStartIncoming()" << endl;
 
+    setIcon( loadIcon( bellIcon ));
+#if 0
     connect(mkcall,SIGNAL(callEnded(const QString &)), this, \
SLOT(slotStopIncomingCall(const QString &)));  
     setPixmap( loadIcon( bellIcon ));
 
     if( kCallGuiRunning )
     {
-        kdDebug() << "StartIncoming:KCallGui is running!" << endl;
+        kDebug() << "StartIncoming:KCallGui is running!" << endl;
 
         QByteArray  callData;
 
@@ -363,7 +365,7 @@
     }
     else
     {
-        kdDebug() << "StartIncoming:KCallGui is not running!" << endl;
+        kDebug() << "StartIncoming:KCallGui is not running!" << endl;
 
         incomingdlg->newCall(callid);
         incomingdlg->show();
@@ -371,32 +373,39 @@
     //KNotifyClient::Instance();
     //KNotifyClient::event("incoming-call");
     //KNotifyClient::event(winId(), "incoming-call", "Anruf");
+#endif
 }
 
 void KCall::slotStopIncomingCall(const QString & callid)
 {
-    kdDebug() << "KCall::slotStopIncomingCall()" << endl;
+    kDebug() << "KCall::slotStopIncomingCall()" << endl;
+    setIcon( loadIcon( onlineIcon) );
+#if 0
     if( kCallGuiRunning )
     {
-        kdDebug() << "StopIncoming:KCallGui is running!" << endl;
+        kDebug() << "StopIncoming:KCallGui is running!" << endl;
 
         mkcall->dcopClient->send("kcall", "KCallGuiCore", "cancelCall(QString)", \
callid);  setPixmap( loadIcon( onlineIcon) );
     }
     else
     {
-        kdDebug() << "StopIncoming:KCallGui is not running!" << endl;
+        kDebug() << "StopIncoming:KCallGui is not running!" << endl;
         if(incomingdlg){
             incomingdlg->cancelCall(callid);
             setPixmap( loadIcon( onlineIcon ) );
         }
     }
+#endif
 }
 
 
 void KCall::slotRegistrationChanged(int newstatus)
 {
-    kdDebug() << "KCall:slotRegistrationChanged() " << newstatus << endl;
+    kDebug() << "KCall:slotRegistrationChanged() " << newstatus << endl;
+
+    setIcon( loadIcon( onlineIcon ));
+#if 0
     switch (newstatus)
     {
         case KCallCore::Connecting:
@@ -416,11 +425,13 @@
             setPixmap( loadIcon( offlineIcon ));
             regButtonText = i18n("Connect to Server");
     }
+#endif
 }
 
 void KCall::slotUnRegistrate()
 {
-    kdDebug() << "KCall::slotUnRegistrate()" << endl;
+#if 0
+    kDebug() << "KCall::slotUnRegistrate()" << endl;
     if(mkcall->getRegistration())
     {
         mkcall->unregistrate();
@@ -430,32 +441,36 @@
         mkcall->registrate();
         //dcopClient->send("kcall", "KCallCore", "registrate()", "");
     }
+#endif
 }
 
 void KCall::acceptCall(const QString & callId)
 {
-    kdDebug() << "KCall::acceptCall()" << endl;
-
+    kDebug() << "KCall::acceptCall()" << endl;
+#if 0
     mkcall->acceptCall( callId );
+#endif
 }
 
 void KCall::rejectCall(const QString & callId)
 {
-    kdDebug() << "KCall::rejectCall()" << endl;
-
+    kDebug() << "KCall::rejectCall()" << endl;
+#if 0
     mkcall->rejectCall( callId );
+#endif
 }
 
 void KCall::hangupCall(const QString & callId)
 {
-    kdDebug() << "KCall::hangupCall()" << endl;
-
+    kDebug() << "KCall::hangupCall()" << endl;
+#if 0
     mkcall->hangUp( callId );
+#endif
 }
 
 void KCall::slotQuit()
 {
-    kdDebug() << "KCall::slotQuit()" << endl;
+    kDebug() << "KCall::slotQuit()" << endl;
 
     // ### earth to maintainer: calling quit is extremely bad in an applet
     // because the applet could run in-process and then kicker will be quit!!
@@ -464,9 +479,10 @@
 
 void KCall::guiStatus(bool s)
 {
-    kdDebug() << "KCall::guiStatus()" << endl;
-
+    kDebug() << "KCall::guiStatus()" << endl;
+#if 0
     kCallGuiRunning = s;
+#endif
 }
 
 #include "kcall.moc"
--- trunk/playground/pim/kcall/applet/kcall/kcall.h #691451:691452
@@ -26,26 +26,26 @@
 #endif
 
 
-#include <ksystemtray.h>
+#include <ksystemtrayicon.h>
 #include <qpixmap.h>
 
 class QTimer;
 class KCallCore;
 class IncomingDialog;
 
-class KCall : public KSystemTray
+class KCall : public KSystemTrayIcon
 {
     Q_OBJECT
     public:
         KCall();
         virtual ~KCall();
 
-        void mousePressEvent(QMouseEvent *event);
-        void showDialList(QMouseEvent *pos);
-        void showMainMenu(QMouseEvent *pos);
+//         void mousePressEvent(QMouseEvent *event);
+//         void showDialList(QMouseEvent *pos);
+//         void showMainMenu(QMouseEvent *pos);
 
     protected:
-        void paintGui();
+//        void paintGui();
         void openDialList();
         void startBlink( const QPixmap &iconOn, const QPixmap &iconOff );
         void stopBlink();
@@ -70,7 +70,7 @@
         void slotBlink();
 
     public slots:
-        void slotOpenKCall();
+        // void slotOpenKCall();
         void slotHelp();
         void slotPreferences();
         void slotAbout();
--- trunk/playground/pim/kcall/applet/kcall/main.cpp #691451:691452
@@ -19,49 +19,49 @@
  */
 
 #include "kcall.h"
+
 #include <kuniqueapplication.h>
 #include <kaboutdata.h>
 #include <kcmdlineargs.h>
 #include <klocale.h>
-#include <kwin.h>
+#include <kwindowsystem.h>
 #include <kstartupinfo.h>
 #include <kdebug.h>
 
-static const char description[] =
-    ki18n("Phone Applet");
+static const char version[] = "0.7";
 
-static const char version[] = "0.1";
-
-static KCmdLineOptions options[] =
+static KCmdLineOptions applet_options()
 {
-    {"dial <number>",I18N_NOOP( "Init a call to the Number" ),0},
-    KCmdLineLastOption
-};
+    KCmdLineOptions options;
+    // options.add("dial <number>", I18N_NOOP( "Init a call to the Number" ), 0);
+    return options;
+}
 
 int main(int argc, char **argv)
 {
-    KAboutData about("kcallapplet", ki18n("kcallapplet"), version, description,
-                     KAboutData::License_LGPL, "(C) 2005 Mike Hauth", 0, 0,
-                     "mike@mike-hauth.de");
-    about.addAuthor( "Eva Brucherseifer", 0, "eva.brucherseifer@basyskom.de" );
-    about.addAuthor( "Mike Hauth", 0, "mike@mike-hauth.de" );
-    about.addAuthor( "Tobias Hunger", 0, "tobias.hunger@basyskom.de" );
+    KAboutData about( "kcallapplet", 0, ki18n( "kcallapplet" ), version,
+                      ki18n( "The KCall phone applet"),
+                      KAboutData::License_GPL_V2,
+                      ki18n( "(c) 2005, Mike Hauth" ) );
 
+    about.addAuthor( ki18n("Eva Brucherseifer"), ki18n("Developer"), \
"eva.brucherseifer@basyskom.de" ); +    about.addAuthor( ki18n("Mike Hauth"), \
ki18n("Initial version"), "mike@mike-hauth.de" ); +    about.addAuthor( ki18n("Tobias \
Hunger"), ki18n("Developer"), "tobias.hunger@basyskom.de" ); +
     KCmdLineArgs::init(argc, argv, &about);
-    KCmdLineArgs::addCmdLineOptions( options );
+    KCmdLineArgs::addCmdLineOptions( applet_options() );
     KUniqueApplication::addCmdLineOptions();
 
     KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
-    QCString dialOptionArg = args->getOption("dial");
+    // QString dialOptionArg = args->getOption("dial");
 
-
     KUniqueApplication app;
 
     KCall kcall;
-    KWin::setSystemTrayWindowFor(kcall.winId(), 0);
+    // KWin::setSystemTrayWindowFor(kcall.winId(), 0);
     kcall.show();
 
-    app.setTopWidget(&kcall);
+    // app.setTopWidget(&kcall);
     KStartupInfo::appStarted();
 
     return app.exec();


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic