summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2004-10-20 09:45:16 (UTC)
committer zautrix <zautrix>2004-10-20 09:45:16 (UTC)
commitb3662915cb2c966ed7b5c563b8e840ae5b82d4e6 (patch) (unidiff)
treebc09d046e1d47fe94acb538af88458f716993dfc /korganizer
parent40eaafc9e008dc004b6ebc65fae8d89c8883ee8b (diff)
downloadkdepimpi-b3662915cb2c966ed7b5c563b8e840ae5b82d4e6.zip
kdepimpi-b3662915cb2c966ed7b5c563b8e840ae5b82d4e6.tar.gz
kdepimpi-b3662915cb2c966ed7b5c563b8e840ae5b82d4e6.tar.bz2
fixed br for kopi
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
@@ -1231,12 +1231,13 @@ void CalendarView::syncExternal( int mode )
1231 qApp->processEvents(); 1231 qApp->processEvents();
1232 CalendarLocal* calendar = new CalendarLocal(); 1232 CalendarLocal* calendar = new CalendarLocal();
1233 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 1233 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
1234 bool syncOK = false; 1234 bool syncOK = false;
1235 bool loadSuccess = false; 1235 bool loadSuccess = false;
1236 PhoneFormat* phoneFormat = 0; 1236 PhoneFormat* phoneFormat = 0;
1237 emit tempDisableBR(true);
1237#ifndef DESKTOP_VERSION 1238#ifndef DESKTOP_VERSION
1238 SharpFormat* sharpFormat = 0; 1239 SharpFormat* sharpFormat = 0;
1239 if ( mode == 0 ) { // sharp 1240 if ( mode == 0 ) { // sharp
1240 sharpFormat = new SharpFormat () ; 1241 sharpFormat = new SharpFormat () ;
1241 loadSuccess = sharpFormat->load( calendar, mCalendar ); 1242 loadSuccess = sharpFormat->load( calendar, mCalendar );
1242 1243
@@ -1246,14 +1247,16 @@ void CalendarView::syncExternal( int mode )
1246 phoneFormat = new PhoneFormat (mCurrentSyncDevice, 1247 phoneFormat = new PhoneFormat (mCurrentSyncDevice,
1247 mSyncManager->mPhoneDevice, 1248 mSyncManager->mPhoneDevice,
1248 mSyncManager->mPhoneConnection, 1249 mSyncManager->mPhoneConnection,
1249 mSyncManager->mPhoneModel); 1250 mSyncManager->mPhoneModel);
1250 loadSuccess = phoneFormat->load( calendar,mCalendar); 1251 loadSuccess = phoneFormat->load( calendar,mCalendar);
1251 1252
1252 } else 1253 } else {
1253 return; 1254 emit tempDisableBR(false);
1255 return;
1256 }
1254 if ( loadSuccess ) { 1257 if ( loadSuccess ) {
1255 getEventViewerDialog()->setSyncMode( true ); 1258 getEventViewerDialog()->setSyncMode( true );
1256 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); 1259 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs );
1257 getEventViewerDialog()->setSyncMode( false ); 1260 getEventViewerDialog()->setSyncMode( false );
1258 qApp->processEvents(); 1261 qApp->processEvents();
1259 if ( syncOK ) { 1262 if ( syncOK ) {
@@ -1300,12 +1303,13 @@ void CalendarView::syncExternal( int mode )
1300 QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), 1303 QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"),
1301 question, i18n("Ok")) ; 1304 question, i18n("Ok")) ;
1302 1305
1303 } 1306 }
1304 delete calendar; 1307 delete calendar;
1305 updateView(); 1308 updateView();
1309 emit tempDisableBR(false);
1306 return ;//syncOK; 1310 return ;//syncOK;
1307 1311
1308} 1312}
1309 1313
1310bool CalendarView::importBday() 1314bool CalendarView::importBday()
1311{ 1315{
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 1cd896d..2818ee9 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -114,12 +114,13 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
114 void addView(KOrg::BaseView *); 114 void addView(KOrg::BaseView *);
115 void showView(KOrg::BaseView *); 115 void showView(KOrg::BaseView *);
116 KOEventViewerDialog* getEventViewerDialog(); 116 KOEventViewerDialog* getEventViewerDialog();
117 Incidence *currentSelection(); 117 Incidence *currentSelection();
118 118
119 signals: 119 signals:
120 void tempDisableBR(bool);
120 /** This todo has been modified */ 121 /** This todo has been modified */
121 void todoModified(Todo *, int); 122 void todoModified(Todo *, int);
122 123
123 /** when change is made to options dialog, the topwidget will catch this 124 /** when change is made to options dialog, the topwidget will catch this
124 * and emit this signal which notifies all widgets which have registered 125 * and emit this signal which notifies all widgets which have registered
125 * for notification to update their settings. */ 126 * for notification to update their settings. */
diff --git a/korganizer/main.cpp b/korganizer/main.cpp
index 16186c0..c8a55d2 100644
--- a/korganizer/main.cpp
+++ b/korganizer/main.cpp
@@ -77,14 +77,13 @@ int main( int argc, char **argv )
77 fileName = qApp->applicationDirPath () + "/kdepim/korganizer/"; 77 fileName = qApp->applicationDirPath () + "/kdepim/korganizer/";
78 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); 78 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName));
79#endif 79#endif
80 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "korganizer"))); 80 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "korganizer")));
81 MainWindow m; 81 MainWindow m;
82#ifndef DESKTOP_VERSION 82#ifndef DESKTOP_VERSION
83 QCopChannel* c1 = new QCopChannel("QPE/Application/datebook",&m, "channel" ) ; 83
84 QObject::connect( c1, SIGNAL (received ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& )));
85 QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& ))); 84 QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& )));
86 a.showMainWidget(&m ); 85 a.showMainWidget(&m );
87#else 86#else
88 a.setMainWidget(&m ); 87 a.setMainWidget(&m );
89 m.show(); 88 m.show();
90 //m.resize( 800, 600 ); 89 //m.resize( 800, 600 );
@@ -96,13 +95,10 @@ int main( int argc, char **argv )
96 command += argv[2]; 95 command += argv[2];
97 qApp->processEvents(); 96 qApp->processEvents();
98 m.recieve(command, QByteArray() ); 97 m.recieve(command, QByteArray() );
99 98
100 } 99 }
101 a.exec(); 100 a.exec();
102#ifndef DESKTOP_VERSION
103 delete c1;
104#endif
105 101
106 } 102 }
107 qDebug("KO: Bye! "); 103 qDebug("KO: Bye! ");
108} 104}
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 02ca523..9e215b9 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -234,12 +234,14 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
234 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 234 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
235 SLOT( processIncidenceSelection( Incidence * ) ) ); 235 SLOT( processIncidenceSelection( Incidence * ) ) );
236 connect( mView, SIGNAL( modifiedChanged( bool ) ), 236 connect( mView, SIGNAL( modifiedChanged( bool ) ),
237 SLOT( slotModifiedChanged( bool ) ) ); 237 SLOT( slotModifiedChanged( bool ) ) );
238 238
239 239
240 connect( mView, SIGNAL( tempDisableBR(bool) ),
241 SLOT( disableBR(bool) ) );
240 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 242 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
241 mView->setModified( false ); 243 mView->setModified( false );
242 mBlockAtStartup = false; 244 mBlockAtStartup = false;
243 mView->setModified( false ); 245 mView->setModified( false );
244 setCentralWidget( mView ); 246 setCentralWidget( mView );
245 globalFlagBlockStartup = 0; 247 globalFlagBlockStartup = 0;
@@ -270,22 +272,71 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
270 } 272 }
271 273
272 //US listen for result adressed from Ka/Pi 274 //US listen for result adressed from Ka/Pi
273#ifndef DESKTOP_VERSION 275#ifndef DESKTOP_VERSION
274 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 276 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
275#endif 277#endif
276 278#ifndef DESKTOP_VERSION
279 infrared = 0;
280#endif
281
282 mBRdisabled = false;
283 toggleBeamReceive();
277} 284}
278MainWindow::~MainWindow() 285MainWindow::~MainWindow()
279{ 286{
280 //qDebug("MainWindow::~MainWindow() "); 287 //qDebug("MainWindow::~MainWindow() ");
281 //save toolbar location 288 //save toolbar location
282 delete mCalendar; 289 delete mCalendar;
283 delete mSyncManager; 290 delete mSyncManager;
291 if ( infrared )
292 delete infrared;
293
294
295}
296
297void MainWindow::disableBR(bool b)
298{
299 if ( b ) {
300 if ( infrared ) {
301 toggleBeamReceive();
302 mBRdisabled = true;
303 }
304 } else {
305 if ( mBRdisabled ) {
306 mBRdisabled = false;
307 toggleBeamReceive();
308 }
309 }
284 310
311}
312bool MainWindow::beamReceiveEnabled()
313{
314#ifndef DESKTOP_VERSION
315 return ( infrared != 0 );
316#endif
317 return false;
318}
285 319
320void MainWindow::toggleBeamReceive()
321{
322 if ( mBRdisabled )
323 return;
324#ifndef DESKTOP_VERSION
325 if ( infrared ) {
326 qDebug("disable BeamReceive ");
327 delete infrared;
328 infrared = 0;
329 brAction->setOn(false);
330 return;
331 }
332 qDebug("enable BeamReceive ");
333 brAction->setOn(true);
334 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ;
335 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& )));
336#endif
286} 337}
287void MainWindow::showMaximized () 338void MainWindow::showMaximized ()
288{ 339{
289#ifndef DESKTOP_VERSION 340#ifndef DESKTOP_VERSION
290 if ( ! globalFlagBlockStartup ) 341 if ( ! globalFlagBlockStartup )
291 if ( mClosed ) 342 if ( mClosed )
@@ -748,12 +799,18 @@ void MainWindow::initActions()
748 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 799 action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
749 this ); 800 this );
750 action->addTo( importMenu ); 801 action->addTo( importMenu );
751 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 802 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
752#ifndef DESKTOP_VERSION 803#ifndef DESKTOP_VERSION
753 importMenu->insertSeparator(); 804 importMenu->insertSeparator();
805 brAction = new QAction( "beam toggle", i18n("Beam receice enabled"), 0,
806 this );
807 brAction->addTo( importMenu );
808 brAction->setToggleAction (true ) ;
809 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) );
810
754 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, 811 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
755 this ); 812 this );
756 action->addTo( importMenu ); 813 action->addTo( importMenu );
757 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); 814 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
758 815
759 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, 816 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0,
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index e3383ed..0926313 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -8,13 +8,15 @@
8#include <qtextstream.h> 8#include <qtextstream.h>
9#include <qregexp.h> 9#include <qregexp.h>
10 10
11#include <libkcal/incidence.h> 11#include <libkcal/incidence.h>
12#include "simplealarmclient.h" 12#include "simplealarmclient.h"
13#include <ksyncmanager.h> 13#include <ksyncmanager.h>
14 14#ifndef DESKTOP_VERSION
15#include <qcopchannel_qws.h>
16#endif
15class QAction; 17class QAction;
16class CalendarView; 18class CalendarView;
17class KSyncProfile; 19class KSyncProfile;
18#ifdef DESKTOP_VERSION 20#ifdef DESKTOP_VERSION
19 21
20#define QPEToolBar QToolBar 22#define QPEToolBar QToolBar
@@ -32,12 +34,13 @@ using namespace KCal;
32class MainWindow : public QMainWindow 34class MainWindow : public QMainWindow
33{ 35{
34 Q_OBJECT 36 Q_OBJECT
35 public: 37 public:
36 MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); 38 MainWindow( QWidget *parent = 0, const char *name = 0, QString command = "");
37 ~MainWindow(); 39 ~MainWindow();
40 bool beamReceiveEnabled();
38 public slots: 41 public slots:
39 virtual void showMaximized (); 42 virtual void showMaximized ();
40 void configureAgenda( int ); 43 void configureAgenda( int );
41 void recieve( const QCString& msg, const QByteArray& data ); 44 void recieve( const QCString& msg, const QByteArray& data );
42 static QString defaultFileName(); 45 static QString defaultFileName();
43 static QString syncFileName(); 46 static QString syncFileName();
@@ -73,12 +76,14 @@ class MainWindow : public QMainWindow
73 void saveCalendar(); 76 void saveCalendar();
74 void loadCalendar(); 77 void loadCalendar();
75 void exportVCalendar(); 78 void exportVCalendar();
76 void fillFilterMenu(); 79 void fillFilterMenu();
77 void selectFilter( int ); 80 void selectFilter( int );
78 void exportToPhone( int ); 81 void exportToPhone( int );
82 void toggleBeamReceive();
83 void disableBR(bool);
79 84
80 85
81 protected: 86 protected:
82 void displayText( QString, QString); 87 void displayText( QString, QString);
83 void displayFile( QString, QString); 88 void displayFile( QString, QString);
84 89
@@ -88,12 +93,17 @@ class MainWindow : public QMainWindow
88 QSocket* piSocket; 93 QSocket* piSocket;
89 QString piFileString; 94 QString piFileString;
90 QTime piTime; 95 QTime piTime;
91 void getFile( bool ); 96 void getFile( bool );
92 void syncFileRequest(); 97 void syncFileRequest();
93 private: 98 private:
99 bool mBRdisabled;
100#ifndef DESKTOP_VERSION
101 QCopChannel* infrared;
102#endif
103 QAction* brAction;
94 KSyncManager* mSyncManager; 104 KSyncManager* mSyncManager;
95 bool mClosed; 105 bool mClosed;
96 void saveOnClose(); 106 void saveOnClose();
97 bool mFlagKeyPressed; 107 bool mFlagKeyPressed;
98 bool mBlockAtStartup; 108 bool mBlockAtStartup;
99 QPEToolBar *iconToolBar; 109 QPEToolBar *iconToolBar;