From b3662915cb2c966ed7b5c563b8e840ae5b82d4e6 Mon Sep 17 00:00:00 2001 From: zautrix Date: Wed, 20 Oct 2004 09:45:16 +0000 Subject: fixed br for kopi --- (limited to 'korganizer/mainwindow.cpp') diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 02ca523..9e215b9 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -237,6 +237,8 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : SLOT( slotModifiedChanged( bool ) ) ); + connect( mView, SIGNAL( tempDisableBR(bool) ), + SLOT( disableBR(bool) ) ); connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); mView->setModified( false ); mBlockAtStartup = false; @@ -273,7 +275,12 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : #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() { @@ -281,8 +288,52 @@ 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 () { @@ -751,6 +802,12 @@ void MainWindow::initActions() 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 ); -- cgit v0.9.0.2