summaryrefslogtreecommitdiffabout
path: root/korganizer/mainwindow.cpp
Side-by-side diff
Diffstat (limited to 'korganizer/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp59
1 files changed, 58 insertions, 1 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 02ca523..9e215b9 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -236,8 +236,10 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
connect( mView, SIGNAL( modifiedChanged( bool ) ),
SLOT( slotModifiedChanged( bool ) ) );
+ connect( mView, SIGNAL( tempDisableBR(bool) ),
+ SLOT( disableBR(bool) ) );
connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
mView->setModified( false );
mBlockAtStartup = false;
mView->setModified( false );
@@ -272,18 +274,67 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
//US listen for result adressed from Ka/Pi
#ifndef DESKTOP_VERSION
connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
#endif
-
+#ifndef DESKTOP_VERSION
+ infrared = 0;
+#endif
+
+ mBRdisabled = false;
+ toggleBeamReceive();
}
MainWindow::~MainWindow()
{
//qDebug("MainWindow::~MainWindow() ");
//save toolbar location
delete mCalendar;
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
}
void MainWindow::showMaximized ()
{
#ifndef DESKTOP_VERSION
@@ -750,8 +801,14 @@ void MainWindow::initActions()
action->addTo( importMenu );
connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
#ifndef DESKTOP_VERSION
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,
this );
action->addTo( importMenu );
connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );