summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (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
@@ -1233,8 +1233,9 @@ void CalendarView::syncExternal( int mode )
calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
bool syncOK = false;
bool loadSuccess = false;
PhoneFormat* phoneFormat = 0;
+ emit tempDisableBR(true);
#ifndef DESKTOP_VERSION
SharpFormat* sharpFormat = 0;
if ( mode == 0 ) { // sharp
sharpFormat = new SharpFormat () ;
@@ -1248,10 +1249,12 @@ void CalendarView::syncExternal( int mode )
mSyncManager->mPhoneConnection,
mSyncManager->mPhoneModel);
loadSuccess = phoneFormat->load( calendar,mCalendar);
- } else
- return;
+ } else {
+ emit tempDisableBR(false);
+ return;
+ }
if ( loadSuccess ) {
getEventViewerDialog()->setSyncMode( true );
syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs );
getEventViewerDialog()->setSyncMode( false );
@@ -1302,8 +1305,9 @@ void CalendarView::syncExternal( int mode )
}
delete calendar;
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
@@ -116,8 +116,9 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
KOEventViewerDialog* getEventViewerDialog();
Incidence *currentSelection();
signals:
+ void tempDisableBR(bool);
/** This todo has been modified */
void todoModified(Todo *, int);
/** when change is made to options dialog, the topwidget will catch this
diff --git a/korganizer/main.cpp b/korganizer/main.cpp
index 16186c0..c8a55d2 100644
--- a/korganizer/main.cpp
+++ b/korganizer/main.cpp
@@ -79,10 +79,9 @@ int main( int argc, char **argv )
#endif
KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "korganizer")));
MainWindow m;
#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& )));
a.showMainWidget(&m );
#else
a.setMainWidget(&m );
@@ -98,11 +97,8 @@ int main( int argc, char **argv )
m.recieve(command, QByteArray() );
}
a.exec();
-#ifndef DESKTOP_VERSION
- delete c1;
-#endif
}
qDebug("KO: Bye! ");
}
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() ) );
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index e3383ed..0926313 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -10,9 +10,11 @@
#include <libkcal/incidence.h>
#include "simplealarmclient.h"
#include <ksyncmanager.h>
-
+#ifndef DESKTOP_VERSION
+#include <qcopchannel_qws.h>
+#endif
class QAction;
class CalendarView;
class KSyncProfile;
#ifdef DESKTOP_VERSION
@@ -34,8 +36,9 @@ class MainWindow : public QMainWindow
Q_OBJECT
public:
MainWindow( QWidget *parent = 0, const char *name = 0, QString command = "");
~MainWindow();
+ bool beamReceiveEnabled();
public slots:
virtual void showMaximized ();
void configureAgenda( int );
void recieve( const QCString& msg, const QByteArray& data );
@@ -75,8 +78,10 @@ class MainWindow : public QMainWindow
void exportVCalendar();
void fillFilterMenu();
void selectFilter( int );
void exportToPhone( int );
+ void toggleBeamReceive();
+ void disableBR(bool);
protected:
void displayText( QString, QString);
@@ -90,8 +95,13 @@ class MainWindow : public QMainWindow
QTime piTime;
void getFile( bool );
void syncFileRequest();
private:
+ bool mBRdisabled;
+#ifndef DESKTOP_VERSION
+ QCopChannel* infrared;
+#endif
+ QAction* brAction;
KSyncManager* mSyncManager;
bool mClosed;
void saveOnClose();
bool mFlagKeyPressed;