summaryrefslogtreecommitdiffabout
path: root/korganizer
Side-by-side diff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp8
-rw-r--r--korganizer/calendarview.h1
-rw-r--r--korganizer/main.cpp6
-rw-r--r--korganizer/mainwindow.cpp59
-rw-r--r--korganizer/mainwindow.h12
5 files changed, 77 insertions, 9 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 884c61a..0306e07 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1236,2 +1236,3 @@ void CalendarView::syncExternal( int mode )
PhoneFormat* phoneFormat = 0;
+ emit tempDisableBR(true);
#ifndef DESKTOP_VERSION
@@ -1251,4 +1252,6 @@ void CalendarView::syncExternal( int mode )
- } else
- return;
+ } else {
+ emit tempDisableBR(false);
+ return;
+ }
if ( loadSuccess ) {
@@ -1305,2 +1308,3 @@ void CalendarView::syncExternal( int mode )
updateView();
+ emit tempDisableBR(false);
return ;//syncOK;
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 1cd896d..2818ee9 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -119,2 +119,3 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
signals:
+ void tempDisableBR(bool);
/** This todo has been modified */
diff --git a/korganizer/main.cpp b/korganizer/main.cpp
index 16186c0..c8a55d2 100644
--- a/korganizer/main.cpp
+++ b/korganizer/main.cpp
@@ -82,4 +82,3 @@ int main( int argc, char **argv )
#ifndef DESKTOP_VERSION
- QCopChannel* c1 = new QCopChannel("QPE/Application/datebook",&m, "channel" ) ;
- QObject::connect( c1, SIGNAL (received ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& )));
+
QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& )));
@@ -101,5 +100,2 @@ int main( int argc, char **argv )
a.exec();
-#ifndef DESKTOP_VERSION
- delete c1;
-#endif
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 02ca523..9e215b9 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -239,2 +239,4 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
+ connect( mView, SIGNAL( tempDisableBR(bool) ),
+ SLOT( disableBR(bool) ) );
connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
@@ -275,3 +277,8 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
#endif
-
+#ifndef DESKTOP_VERSION
+ infrared = 0;
+#endif
+
+ mBRdisabled = false;
+ toggleBeamReceive();
}
@@ -283,4 +290,48 @@ MainWindow::~MainWindow()
delete mSyncManager;
+ if ( infrared )
+ delete infrared;
+
+
+}
+
+void MainWindow::disableBR(bool b)
+{
+ if ( b ) {
+ if ( infrared ) {
+ toggleBeamReceive();
+ mBRdisabled = true;
+ }
+ } else {
+ if ( mBRdisabled ) {
+ mBRdisabled = false;
+ toggleBeamReceive();
+ }
+ }
+}
+bool MainWindow::beamReceiveEnabled()
+{
+#ifndef DESKTOP_VERSION
+ return ( infrared != 0 );
+#endif
+ return false;
+}
+void MainWindow::toggleBeamReceive()
+{
+ if ( mBRdisabled )
+ return;
+#ifndef DESKTOP_VERSION
+ if ( infrared ) {
+ qDebug("disable BeamReceive ");
+ delete infrared;
+ infrared = 0;
+ brAction->setOn(false);
+ return;
+ }
+ qDebug("enable BeamReceive ");
+ brAction->setOn(true);
+ infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ;
+ QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& )));
+#endif
}
@@ -753,2 +804,8 @@ void MainWindow::initActions()
importMenu->insertSeparator();
+ brAction = new QAction( "beam toggle", i18n("Beam receice enabled"), 0,
+ this );
+ brAction->addTo( importMenu );
+ brAction->setToggleAction (true ) ;
+ connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) );
+
action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index e3383ed..0926313 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -13,3 +13,5 @@
#include <ksyncmanager.h>
-
+#ifndef DESKTOP_VERSION
+#include <qcopchannel_qws.h>
+#endif
class QAction;
@@ -37,2 +39,3 @@ class MainWindow : public QMainWindow
~MainWindow();
+ bool beamReceiveEnabled();
public slots:
@@ -78,2 +81,4 @@ class MainWindow : public QMainWindow
void exportToPhone( int );
+ void toggleBeamReceive();
+ void disableBR(bool);
@@ -93,2 +98,7 @@ class MainWindow : public QMainWindow
private:
+ bool mBRdisabled;
+#ifndef DESKTOP_VERSION
+ QCopChannel* infrared;
+#endif
+ QAction* brAction;
KSyncManager* mSyncManager;