-rw-r--r-- | korganizer/main.cpp | 6 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 6 | ||||
-rw-r--r-- | korganizer/mainwindow.h | 2 |
3 files changed, 7 insertions, 7 deletions
diff --git a/korganizer/main.cpp b/korganizer/main.cpp index 7f9b5c6..16186c0 100644 --- a/korganizer/main.cpp +++ b/korganizer/main.cpp | |||
@@ -1,102 +1,108 @@ | |||
1 | 1 | ||
2 | 2 | ||
3 | #ifndef DESKTOP_VERSION | 3 | #ifndef DESKTOP_VERSION |
4 | #include <qpe/qpeapplication.h> | 4 | #include <qpe/qpeapplication.h> |
5 | #include <qcopchannel_qws.h> | ||
5 | #include <qpe/global.h> | 6 | #include <qpe/global.h> |
6 | #include <stdlib.h> | 7 | #include <stdlib.h> |
7 | #else | 8 | #else |
8 | #include <qapplication.h> | 9 | #include <qapplication.h> |
9 | #include <qstring.h> | 10 | #include <qstring.h> |
10 | #include <qwindowsstyle.h> | 11 | #include <qwindowsstyle.h> |
11 | #include <qplatinumstyle.h> | 12 | #include <qplatinumstyle.h> |
12 | #include <qsgistyle.h> | 13 | #include <qsgistyle.h> |
13 | #endif | 14 | #endif |
14 | 15 | ||
15 | #include <qdir.h> | 16 | #include <qdir.h> |
16 | #include <kstandarddirs.h> | 17 | #include <kstandarddirs.h> |
17 | #include <kglobal.h> | 18 | #include <kglobal.h> |
18 | #include <stdio.h> | 19 | #include <stdio.h> |
19 | #include "mainwindow.h" | 20 | #include "mainwindow.h" |
20 | 21 | ||
21 | int main( int argc, char **argv ) | 22 | int main( int argc, char **argv ) |
22 | { | 23 | { |
23 | #ifndef DESKTOP_VERSION | 24 | #ifndef DESKTOP_VERSION |
24 | QPEApplication a( argc, argv ); | 25 | QPEApplication a( argc, argv ); |
25 | a.setKeepRunning (); | 26 | a.setKeepRunning (); |
26 | #else | 27 | #else |
27 | QApplication a( argc, argv ); | 28 | QApplication a( argc, argv ); |
28 | QApplication::setStyle( new QPlatinumStyle ()); | 29 | QApplication::setStyle( new QPlatinumStyle ()); |
29 | QString hdir = QDir::homeDirPath(); | 30 | QString hdir = QDir::homeDirPath(); |
30 | // there is a bug when creating dirs for WIN 98 | 31 | // there is a bug when creating dirs for WIN 98 |
31 | // it is difficult to fix, because we have no WIN 98 runnung | 32 | // it is difficult to fix, because we have no WIN 98 runnung |
32 | // such that we try it to create the dirs at startup here | 33 | // such that we try it to create the dirs at startup here |
33 | if ( hdir == "C:\\" ) { // win 98 or ME | 34 | if ( hdir == "C:\\" ) { // win 98 or ME |
34 | QDir app_dir; | 35 | QDir app_dir; |
35 | if ( !app_dir.exists("C:\\kdepim") ) | 36 | if ( !app_dir.exists("C:\\kdepim") ) |
36 | app_dir.mkdir ("C:\\kdepim"); | 37 | app_dir.mkdir ("C:\\kdepim"); |
37 | if ( !app_dir.exists("C:\\kdepim\\apps") ) | 38 | if ( !app_dir.exists("C:\\kdepim\\apps") ) |
38 | app_dir.mkdir ("C:\\kdepim\\apps"); | 39 | app_dir.mkdir ("C:\\kdepim\\apps"); |
39 | if ( !app_dir.exists("C:\\kdepim\\config") ) | 40 | if ( !app_dir.exists("C:\\kdepim\\config") ) |
40 | app_dir.mkdir ("C:\\kdepim\\config"); | 41 | app_dir.mkdir ("C:\\kdepim\\config"); |
41 | if ( !app_dir.exists("C:\\kdepim\\apps\\korganizer") ) | 42 | if ( !app_dir.exists("C:\\kdepim\\apps\\korganizer") ) |
42 | app_dir.mkdir ("C:\\kdepim\\apps\\korganizer"); | 43 | app_dir.mkdir ("C:\\kdepim\\apps\\korganizer"); |
43 | } | 44 | } |
44 | #endif | 45 | #endif |
45 | bool exitHelp = false; | 46 | bool exitHelp = false; |
46 | if ( argc > 1 ) { | 47 | if ( argc > 1 ) { |
47 | QString command = argv[1]; | 48 | QString command = argv[1]; |
48 | if ( command == "-help" ){ | 49 | if ( command == "-help" ){ |
49 | printf("KO/Pi command line commands:\n"); | 50 | printf("KO/Pi command line commands:\n"); |
50 | printf(" no command: Start KO/Pi in usual way\n"); | 51 | printf(" no command: Start KO/Pi in usual way\n"); |
51 | printf(" -help: This output\n"); | 52 | printf(" -help: This output\n"); |
52 | printf("Next Option: Open or Show after start:\n"); | 53 | printf("Next Option: Open or Show after start:\n"); |
53 | printf(" -newTodo: New Todo dialog\n"); | 54 | printf(" -newTodo: New Todo dialog\n"); |
54 | printf(" -newEvent: New Event dialog\n"); | 55 | printf(" -newEvent: New Event dialog\n"); |
55 | printf(" -showList: List view\n"); | 56 | printf(" -showList: List view\n"); |
56 | printf(" -showDay: Day view\n"); | 57 | printf(" -showDay: Day view\n"); |
57 | printf(" -showWWeek: Work Week view\n"); | 58 | printf(" -showWWeek: Work Week view\n"); |
58 | printf(" -showWeek: Week view\n"); | 59 | printf(" -showWeek: Week view\n"); |
59 | printf(" -showTodo: Todo view\n"); | 60 | printf(" -showTodo: Todo view\n"); |
60 | printf(" -showJournal: Journal view\n"); | 61 | printf(" -showJournal: Journal view\n"); |
61 | printf(" -showKO: Next Days view\n"); | 62 | printf(" -showKO: Next Days view\n"); |
62 | printf(" -showWNext: What's Next view\n"); | 63 | printf(" -showWNext: What's Next view\n"); |
63 | printf(" -showNextXView: Next X View\n"); | 64 | printf(" -showNextXView: Next X View\n"); |
64 | printf(" -new[Y] and -show[X] may be used togehther\n"); | 65 | printf(" -new[Y] and -show[X] may be used togehther\n"); |
65 | printf(" KO/Pi is exiting now. Bye!\n"); | 66 | printf(" KO/Pi is exiting now. Bye!\n"); |
66 | exitHelp = true; | 67 | exitHelp = true; |
67 | } | 68 | } |
68 | } | 69 | } |
69 | if ( ! exitHelp ) { | 70 | if ( ! exitHelp ) { |
70 | KGlobal::setAppName( "korganizer" ); | 71 | KGlobal::setAppName( "korganizer" ); |
71 | QString fileName ; | 72 | QString fileName ; |
72 | #ifndef DESKTOP_VERSION | 73 | #ifndef DESKTOP_VERSION |
73 | fileName = getenv("QPEDIR"); | 74 | fileName = getenv("QPEDIR"); |
74 | KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/korganizer/"); | 75 | KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/korganizer/"); |
75 | #else | 76 | #else |
76 | fileName = qApp->applicationDirPath () + "/kdepim/korganizer/"; | 77 | fileName = qApp->applicationDirPath () + "/kdepim/korganizer/"; |
77 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); | 78 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); |
78 | #endif | 79 | #endif |
79 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "korganizer"))); | 80 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "korganizer"))); |
80 | MainWindow m; | 81 | MainWindow m; |
81 | #ifndef DESKTOP_VERSION | 82 | #ifndef DESKTOP_VERSION |
83 | QCopChannel* c1 = new QCopChannel("QPE/Application/datebook",&m, "channel" ) ; | ||
84 | QObject::connect( c1, SIGNAL (received ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& ))); | ||
82 | QObject::connect( &a, SIGNAL (appMessage ( 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& ))); |
83 | a.showMainWidget(&m ); | 86 | a.showMainWidget(&m ); |
84 | #else | 87 | #else |
85 | a.setMainWidget(&m ); | 88 | a.setMainWidget(&m ); |
86 | m.show(); | 89 | m.show(); |
87 | //m.resize( 800, 600 ); | 90 | //m.resize( 800, 600 ); |
88 | QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); | 91 | QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); |
89 | #endif | 92 | #endif |
90 | if ( argc > 1 ) { | 93 | if ( argc > 1 ) { |
91 | QCString command = argv[1]; | 94 | QCString command = argv[1]; |
92 | if ( argc > 2 ) | 95 | if ( argc > 2 ) |
93 | command += argv[2]; | 96 | command += argv[2]; |
94 | qApp->processEvents(); | 97 | qApp->processEvents(); |
95 | m.recieve(command, QByteArray() ); | 98 | m.recieve(command, QByteArray() ); |
96 | 99 | ||
97 | } | 100 | } |
98 | a.exec(); | 101 | a.exec(); |
102 | #ifndef DESKTOP_VERSION | ||
103 | delete c1; | ||
104 | #endif | ||
99 | 105 | ||
100 | } | 106 | } |
101 | qDebug("KO: Bye! "); | 107 | qDebug("KO: Bye! "); |
102 | } | 108 | } |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 2d17986..3c16458 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -1,677 +1,673 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | 2 | ||
3 | #include <qaction.h> | 3 | #include <qaction.h> |
4 | #include <qpopupmenu.h> | 4 | #include <qpopupmenu.h> |
5 | #include <qpainter.h> | 5 | #include <qpainter.h> |
6 | #include <qwhatsthis.h> | 6 | #include <qwhatsthis.h> |
7 | #include <qpushbutton.h> | 7 | #include <qpushbutton.h> |
8 | #include <qmessagebox.h> | 8 | #include <qmessagebox.h> |
9 | #include <qlineedit.h> | 9 | #include <qlineedit.h> |
10 | #include <qtextcodec.h> | 10 | #include <qtextcodec.h> |
11 | #include <qfile.h> | 11 | #include <qfile.h> |
12 | #include <qdir.h> | 12 | #include <qdir.h> |
13 | #include <qapp.h> | 13 | #include <qapp.h> |
14 | #include <qfileinfo.h> | 14 | #include <qfileinfo.h> |
15 | #include <qlabel.h> | 15 | #include <qlabel.h> |
16 | #include <qspinbox.h> | 16 | #include <qspinbox.h> |
17 | #include <qcheckbox.h> | 17 | #include <qcheckbox.h> |
18 | #include <qmap.h> | 18 | #include <qmap.h> |
19 | #include <qwmatrix.h> | 19 | #include <qwmatrix.h> |
20 | #include <qtextbrowser.h> | 20 | #include <qtextbrowser.h> |
21 | #include <qtextstream.h> | 21 | #include <qtextstream.h> |
22 | #ifndef DESKTOP_VERSION | 22 | #ifndef DESKTOP_VERSION |
23 | #include <qpe/global.h> | 23 | #include <qpe/global.h> |
24 | #include <qpe/qpemenubar.h> | 24 | #include <qpe/qpemenubar.h> |
25 | #include <qpe/qpetoolbar.h> | 25 | #include <qpe/qpetoolbar.h> |
26 | #include <qpe/resource.h> | 26 | #include <qpe/resource.h> |
27 | #include <qpe/qpeapplication.h> | 27 | #include <qpe/qpeapplication.h> |
28 | #include <qtopia/alarmserver.h> | 28 | #include <qtopia/alarmserver.h> |
29 | #include <qtopia/qcopenvelope_qws.h> | 29 | #include <qtopia/qcopenvelope_qws.h> |
30 | #include <unistd.h> // for sleep | 30 | #include <unistd.h> // for sleep |
31 | #else | 31 | #else |
32 | #include <qmenubar.h> | 32 | #include <qmenubar.h> |
33 | #include <qtoolbar.h> | 33 | #include <qtoolbar.h> |
34 | #include <qapplication.h> | 34 | #include <qapplication.h> |
35 | //#include <resource.h> | 35 | //#include <resource.h> |
36 | 36 | ||
37 | #endif | 37 | #endif |
38 | #include <libkcal/calendarlocal.h> | 38 | #include <libkcal/calendarlocal.h> |
39 | #include <libkcal/todo.h> | 39 | #include <libkcal/todo.h> |
40 | #include <libkcal/phoneformat.h> | 40 | #include <libkcal/phoneformat.h> |
41 | #include <libkdepim/ksyncprofile.h> | 41 | #include <libkdepim/ksyncprofile.h> |
42 | #include <libkdepim/phoneaccess.h> | 42 | #include <libkdepim/phoneaccess.h> |
43 | #include <libkcal/kincidenceformatter.h> | 43 | #include <libkcal/kincidenceformatter.h> |
44 | #include <libkdepim/kpimglobalprefs.h> | 44 | #include <libkdepim/kpimglobalprefs.h> |
45 | 45 | ||
46 | #include "calendarview.h" | 46 | #include "calendarview.h" |
47 | #include "koviewmanager.h" | 47 | #include "koviewmanager.h" |
48 | #include "datenavigator.h" | 48 | #include "datenavigator.h" |
49 | #include "koagendaview.h" | 49 | #include "koagendaview.h" |
50 | #include "koagenda.h" | 50 | #include "koagenda.h" |
51 | #include "kodialogmanager.h" | 51 | #include "kodialogmanager.h" |
52 | #include "kdialogbase.h" | 52 | #include "kdialogbase.h" |
53 | #include "kapplication.h" | 53 | #include "kapplication.h" |
54 | #include "kofilterview.h" | 54 | #include "kofilterview.h" |
55 | #include "kstandarddirs.h" | 55 | #include "kstandarddirs.h" |
56 | #include "koprefs.h" | 56 | #include "koprefs.h" |
57 | #include "kfiledialog.h" | 57 | #include "kfiledialog.h" |
58 | #include "koglobals.h" | 58 | #include "koglobals.h" |
59 | #include "kglobal.h" | 59 | #include "kglobal.h" |
60 | #include "klocale.h" | 60 | #include "klocale.h" |
61 | #include "kconfig.h" | 61 | #include "kconfig.h" |
62 | #include "simplealarmclient.h" | 62 | #include "simplealarmclient.h" |
63 | #include "externalapphandler.h" | 63 | #include "externalapphandler.h" |
64 | 64 | ||
65 | using namespace KCal; | 65 | using namespace KCal; |
66 | #ifndef _WIN32_ | 66 | #ifndef _WIN32_ |
67 | #include <unistd.h> | 67 | #include <unistd.h> |
68 | #else | 68 | #else |
69 | #include "koimportoldialog.h" | 69 | #include "koimportoldialog.h" |
70 | #endif | 70 | #endif |
71 | #include "mainwindow.h" | 71 | #include "mainwindow.h" |
72 | 72 | ||
73 | class KOex2phonePrefs : public QDialog | 73 | class KOex2phonePrefs : public QDialog |
74 | { | 74 | { |
75 | public: | 75 | public: |
76 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : | 76 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : |
77 | QDialog( parent, name, true ) | 77 | QDialog( parent, name, true ) |
78 | { | 78 | { |
79 | setCaption( i18n("Export to phone options") ); | 79 | setCaption( i18n("Export to phone options") ); |
80 | QVBoxLayout* lay = new QVBoxLayout( this ); | 80 | QVBoxLayout* lay = new QVBoxLayout( this ); |
81 | lay->setSpacing( 3 ); | 81 | lay->setSpacing( 3 ); |
82 | lay->setMargin( 3 ); | 82 | lay->setMargin( 3 ); |
83 | QLabel *lab; | 83 | QLabel *lab; |
84 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); | 84 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); |
85 | lab->setAlignment (AlignHCenter ); | 85 | lab->setAlignment (AlignHCenter ); |
86 | QHBox* temphb; | 86 | QHBox* temphb; |
87 | temphb = new QHBox( this ); | 87 | temphb = new QHBox( this ); |
88 | new QLabel( i18n("I/O device: "), temphb ); | 88 | new QLabel( i18n("I/O device: "), temphb ); |
89 | mPhoneDevice = new QLineEdit( temphb); | 89 | mPhoneDevice = new QLineEdit( temphb); |
90 | lay->addWidget( temphb ); | 90 | lay->addWidget( temphb ); |
91 | temphb = new QHBox( this ); | 91 | temphb = new QHBox( this ); |
92 | new QLabel( i18n("Connection: "), temphb ); | 92 | new QLabel( i18n("Connection: "), temphb ); |
93 | mPhoneConnection = new QLineEdit( temphb); | 93 | mPhoneConnection = new QLineEdit( temphb); |
94 | lay->addWidget( temphb ); | 94 | lay->addWidget( temphb ); |
95 | temphb = new QHBox( this ); | 95 | temphb = new QHBox( this ); |
96 | new QLabel( i18n("Model(opt.): "), temphb ); | 96 | new QLabel( i18n("Model(opt.): "), temphb ); |
97 | mPhoneModel = new QLineEdit( temphb); | 97 | mPhoneModel = new QLineEdit( temphb); |
98 | lay->addWidget( temphb ); | 98 | lay->addWidget( temphb ); |
99 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); | 99 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); |
100 | mWriteBackFuture->setChecked( true ); | 100 | mWriteBackFuture->setChecked( true ); |
101 | lay->addWidget( mWriteBackFuture ); | 101 | lay->addWidget( mWriteBackFuture ); |
102 | temphb = new QHBox( this ); | 102 | temphb = new QHBox( this ); |
103 | new QLabel( i18n("Max. weeks in future: ") , temphb ); | 103 | new QLabel( i18n("Max. weeks in future: ") , temphb ); |
104 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); | 104 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); |
105 | mWriteBackFutureWeeks->setValue( 8 ); | 105 | mWriteBackFutureWeeks->setValue( 8 ); |
106 | lay->addWidget( temphb ); | 106 | lay->addWidget( temphb ); |
107 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); | 107 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); |
108 | lab->setAlignment (AlignHCenter ); | 108 | lab->setAlignment (AlignHCenter ); |
109 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); | 109 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); |
110 | lay->addWidget( ok ); | 110 | lay->addWidget( ok ); |
111 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 111 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
112 | lay->addWidget( cancel ); | 112 | lay->addWidget( cancel ); |
113 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 113 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
114 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 114 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
115 | resize( 220, 240 ); | 115 | resize( 220, 240 ); |
116 | 116 | ||
117 | } | 117 | } |
118 | 118 | ||
119 | public: | 119 | public: |
120 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; | 120 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; |
121 | QCheckBox* mWriteBackFuture; | 121 | QCheckBox* mWriteBackFuture; |
122 | QSpinBox* mWriteBackFutureWeeks; | 122 | QSpinBox* mWriteBackFutureWeeks; |
123 | }; | 123 | }; |
124 | 124 | ||
125 | int globalFlagBlockStartup; | 125 | int globalFlagBlockStartup; |
126 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | 126 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : |
127 | QMainWindow( parent, name ) | 127 | QMainWindow( parent, name ) |
128 | { | 128 | { |
129 | 129 | ||
130 | #ifdef DESKTOP_VERSION | 130 | #ifdef DESKTOP_VERSION |
131 | setFont( QFont("Arial"), 14 ); | 131 | setFont( QFont("Arial"), 14 ); |
132 | #endif | 132 | #endif |
133 | mServerSocket = 0; | ||
134 | mClosed = false; | 133 | mClosed = false; |
135 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; | 134 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; |
136 | QString confFile = locateLocal("config","korganizerrc"); | 135 | QString confFile = locateLocal("config","korganizerrc"); |
137 | QFileInfo finf ( confFile ); | 136 | QFileInfo finf ( confFile ); |
138 | bool showWarning = !finf.exists(); | 137 | bool showWarning = !finf.exists(); |
139 | setIcon(SmallIcon( "ko24" ) ); | 138 | setIcon(SmallIcon( "ko24" ) ); |
140 | mBlockAtStartup = true; | 139 | mBlockAtStartup = true; |
141 | mFlagKeyPressed = false; | 140 | mFlagKeyPressed = false; |
142 | setCaption("KOrganizer/Pi"); | 141 | setCaption("KOrganizer/Pi"); |
143 | KOPrefs *p = KOPrefs::instance(); | 142 | KOPrefs *p = KOPrefs::instance(); |
144 | KPimGlobalPrefs::instance()->setGlobalConfig(); | 143 | KPimGlobalPrefs::instance()->setGlobalConfig(); |
145 | if ( p->mHourSize > 18 ) | 144 | if ( p->mHourSize > 18 ) |
146 | p->mHourSize = 18; | 145 | p->mHourSize = 18; |
147 | QMainWindow::ToolBarDock tbd; | 146 | QMainWindow::ToolBarDock tbd; |
148 | if ( p->mToolBarHor ) { | 147 | if ( p->mToolBarHor ) { |
149 | if ( p->mToolBarUp ) | 148 | if ( p->mToolBarUp ) |
150 | tbd = Bottom; | 149 | tbd = Bottom; |
151 | else | 150 | else |
152 | tbd = Top; | 151 | tbd = Top; |
153 | } | 152 | } |
154 | else { | 153 | else { |
155 | if ( p->mToolBarUp ) | 154 | if ( p->mToolBarUp ) |
156 | tbd = Right; | 155 | tbd = Right; |
157 | else | 156 | else |
158 | tbd = Left; | 157 | tbd = Left; |
159 | } | 158 | } |
160 | if ( KOPrefs::instance()->mUseAppColors ) | 159 | if ( KOPrefs::instance()->mUseAppColors ) |
161 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 160 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
162 | globalFlagBlockStartup = 1; | 161 | globalFlagBlockStartup = 1; |
163 | iconToolBar = new QPEToolBar( this ); | 162 | iconToolBar = new QPEToolBar( this ); |
164 | addToolBar (iconToolBar , tbd ); | 163 | addToolBar (iconToolBar , tbd ); |
165 | mCalendarModifiedFlag = false; | 164 | mCalendarModifiedFlag = false; |
166 | 165 | ||
167 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); | 166 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); |
168 | splash->setAlignment ( AlignCenter ); | 167 | splash->setAlignment ( AlignCenter ); |
169 | setCentralWidget( splash ); | 168 | setCentralWidget( splash ); |
170 | #ifndef DESKTOP_VERSION | 169 | #ifndef DESKTOP_VERSION |
171 | showMaximized(); | 170 | showMaximized(); |
172 | #endif | 171 | #endif |
173 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); | 172 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); |
174 | setDefaultPreferences(); | 173 | setDefaultPreferences(); |
175 | mCalendar = new CalendarLocal(); | 174 | mCalendar = new CalendarLocal(); |
176 | mView = new CalendarView( mCalendar, this,"mCalendar " ); | 175 | mView = new CalendarView( mCalendar, this,"mCalendar " ); |
177 | mView->hide(); | 176 | mView->hide(); |
178 | //mView->resize(splash->size() ); | 177 | //mView->resize(splash->size() ); |
179 | initActions(); | 178 | initActions(); |
180 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); | 179 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); |
181 | mSyncManager->setBlockSave(false); | 180 | mSyncManager->setBlockSave(false); |
182 | mView->setSyncManager(mSyncManager); | 181 | mView->setSyncManager(mSyncManager); |
183 | #ifndef DESKTOP_VERSION | 182 | #ifndef DESKTOP_VERSION |
184 | iconToolBar->show(); | 183 | iconToolBar->show(); |
185 | qApp->processEvents(); | 184 | qApp->processEvents(); |
186 | #endif | 185 | #endif |
187 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); | 186 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); |
188 | int vh = height() ; | 187 | int vh = height() ; |
189 | int vw = width(); | 188 | int vw = width(); |
190 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); | 189 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); |
191 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 190 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
192 | vh -= iconToolBar->height(); | 191 | vh -= iconToolBar->height(); |
193 | } else { | 192 | } else { |
194 | vw -= iconToolBar->height(); | 193 | vw -= iconToolBar->height(); |
195 | } | 194 | } |
196 | //mView->setMaximumSize( splash->size() ); | 195 | //mView->setMaximumSize( splash->size() ); |
197 | //mView->resize( splash->size() ); | 196 | //mView->resize( splash->size() ); |
198 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 197 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
199 | mView->readSettings(); | 198 | mView->readSettings(); |
200 | bool newFile = false; | 199 | bool newFile = false; |
201 | if( !QFile::exists( defaultFileName() ) ) { | 200 | if( !QFile::exists( defaultFileName() ) ) { |
202 | QFileInfo finfo ( defaultFileName() ); | 201 | QFileInfo finfo ( defaultFileName() ); |
203 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); | 202 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); |
204 | qDebug("oldfile %s ", oldFile.latin1()); | 203 | qDebug("oldfile %s ", oldFile.latin1()); |
205 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; | 204 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; |
206 | finfo.setFile( oldFile ); | 205 | finfo.setFile( oldFile ); |
207 | if (finfo.exists() ) { | 206 | if (finfo.exists() ) { |
208 | KMessageBox::information( this, message); | 207 | KMessageBox::information( this, message); |
209 | mView->openCalendar( oldFile ); | 208 | mView->openCalendar( oldFile ); |
210 | qApp->processEvents(); | 209 | qApp->processEvents(); |
211 | } else { | 210 | } else { |
212 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); | 211 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); |
213 | finfo.setFile( oldFile ); | 212 | finfo.setFile( oldFile ); |
214 | if (finfo.exists() ) { | 213 | if (finfo.exists() ) { |
215 | KMessageBox::information( this, message); | 214 | KMessageBox::information( this, message); |
216 | mView->openCalendar( oldFile ); | 215 | mView->openCalendar( oldFile ); |
217 | qApp->processEvents(); | 216 | qApp->processEvents(); |
218 | } | 217 | } |
219 | } | 218 | } |
220 | mView->saveCalendar( defaultFileName() ); | 219 | mView->saveCalendar( defaultFileName() ); |
221 | newFile = true; | 220 | newFile = true; |
222 | } | 221 | } |
223 | 222 | ||
224 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 223 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
225 | mView->openCalendar( defaultFileName() ); | 224 | mView->openCalendar( defaultFileName() ); |
226 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 225 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
227 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); | 226 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); |
228 | 227 | ||
229 | if ( KOPrefs::instance()->mLanguageChanged ) { | 228 | if ( KOPrefs::instance()->mLanguageChanged ) { |
230 | KOPrefs::instance()->setCategoryDefaults(); | 229 | KOPrefs::instance()->setCategoryDefaults(); |
231 | int count = mView->addCategories(); | 230 | int count = mView->addCategories(); |
232 | KOPrefs::instance()->mLanguageChanged = false; | 231 | KOPrefs::instance()->mLanguageChanged = false; |
233 | } | 232 | } |
234 | processIncidenceSelection( 0 ); | 233 | processIncidenceSelection( 0 ); |
235 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), | 234 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), |
236 | SLOT( processIncidenceSelection( Incidence * ) ) ); | 235 | SLOT( processIncidenceSelection( Incidence * ) ) ); |
237 | connect( mView, SIGNAL( modifiedChanged( bool ) ), | 236 | connect( mView, SIGNAL( modifiedChanged( bool ) ), |
238 | SLOT( slotModifiedChanged( bool ) ) ); | 237 | SLOT( slotModifiedChanged( bool ) ) ); |
239 | 238 | ||
240 | 239 | ||
241 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); | 240 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); |
242 | mView->setModified( false ); | 241 | mView->setModified( false ); |
243 | mBlockAtStartup = false; | 242 | mBlockAtStartup = false; |
244 | mView->setModified( false ); | 243 | mView->setModified( false ); |
245 | setCentralWidget( mView ); | 244 | setCentralWidget( mView ); |
246 | globalFlagBlockStartup = 0; | 245 | globalFlagBlockStartup = 0; |
247 | mView->show(); | 246 | mView->show(); |
248 | delete splash; | 247 | delete splash; |
249 | if ( newFile ) | 248 | if ( newFile ) |
250 | mView->updateConfig(); | 249 | mView->updateConfig(); |
251 | // qApp->processEvents(); | 250 | // qApp->processEvents(); |
252 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 251 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
253 | //fillSyncMenu(); | 252 | //fillSyncMenu(); |
254 | 253 | ||
255 | 254 | ||
256 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); | 255 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); |
257 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 256 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); |
258 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 257 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
259 | mSyncManager->setDefaultFileName( defaultFileName()); | 258 | mSyncManager->setDefaultFileName( defaultFileName()); |
260 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); | 259 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); |
261 | mSyncManager->fillSyncMenu(); | 260 | mSyncManager->fillSyncMenu(); |
262 | 261 | ||
263 | 262 | ||
264 | 263 | ||
265 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); | 264 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); |
266 | if ( showWarning ) { | 265 | if ( showWarning ) { |
267 | KMessageBox::information( this, | 266 | KMessageBox::information( this, |
268 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); | 267 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); |
269 | qApp->processEvents(); | 268 | qApp->processEvents(); |
270 | mView->dialogManager()->showSyncOptions(); | 269 | mView->dialogManager()->showSyncOptions(); |
271 | } | 270 | } |
272 | 271 | ||
273 | //US listen for result adressed from Ka/Pi | 272 | //US listen for result adressed from Ka/Pi |
274 | #ifndef DESKTOP_VERSION | 273 | #ifndef DESKTOP_VERSION |
275 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 274 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
276 | #endif | 275 | #endif |
277 | } | 276 | } |
278 | MainWindow::~MainWindow() | 277 | MainWindow::~MainWindow() |
279 | { | 278 | { |
280 | //qDebug("MainWindow::~MainWindow() "); | 279 | //qDebug("MainWindow::~MainWindow() "); |
281 | //save toolbar location | 280 | //save toolbar location |
282 | delete mServerSocket; | ||
283 | delete mCalendar; | 281 | delete mCalendar; |
284 | delete KOPrefs::instance(); | 282 | delete mSyncManager; |
285 | delete KIncidenceFormatter::instance(); | ||
286 | 283 | ||
287 | 284 | ||
288 | } | 285 | } |
289 | void MainWindow::showMaximized () | 286 | void MainWindow::showMaximized () |
290 | { | 287 | { |
291 | #ifndef DESKTOP_VERSION | 288 | #ifndef DESKTOP_VERSION |
292 | if ( ! globalFlagBlockStartup ) | 289 | if ( ! globalFlagBlockStartup ) |
293 | if ( mClosed ) | 290 | if ( mClosed ) |
294 | mView->goToday(); | 291 | mView->goToday(); |
295 | #endif | 292 | #endif |
296 | QWidget::showMaximized () ; | 293 | QWidget::showMaximized () ; |
297 | mClosed = false; | 294 | mClosed = false; |
298 | } | 295 | } |
299 | void MainWindow::closeEvent( QCloseEvent* ce ) | 296 | void MainWindow::closeEvent( QCloseEvent* ce ) |
300 | { | 297 | { |
301 | 298 | ||
302 | 299 | ||
303 | 300 | ||
304 | if ( ! KOPrefs::instance()->mAskForQuit ) { | 301 | if ( ! KOPrefs::instance()->mAskForQuit ) { |
305 | saveOnClose(); | 302 | saveOnClose(); |
306 | mClosed = true; | 303 | mClosed = true; |
307 | ce->accept(); | 304 | ce->accept(); |
308 | return; | 305 | return; |
309 | 306 | ||
310 | } | 307 | } |
311 | 308 | ||
312 | switch( QMessageBox::information( this, "KO/Pi", | 309 | switch( QMessageBox::information( this, "KO/Pi", |
313 | i18n("Do you really want\nto close KO/Pi?"), | 310 | i18n("Do you really want\nto close KO/Pi?"), |
314 | i18n("Close"), i18n("No"), | 311 | i18n("Close"), i18n("No"), |
315 | 0, 0 ) ) { | 312 | 0, 0 ) ) { |
316 | case 0: | 313 | case 0: |
317 | saveOnClose(); | 314 | saveOnClose(); |
318 | mClosed = true; | 315 | mClosed = true; |
319 | ce->accept(); | 316 | ce->accept(); |
320 | break; | 317 | break; |
321 | case 1: | 318 | case 1: |
322 | ce->ignore(); | 319 | ce->ignore(); |
323 | break; | 320 | break; |
324 | case 2: | 321 | case 2: |
325 | 322 | ||
326 | default: | 323 | default: |
327 | break; | 324 | break; |
328 | } | 325 | } |
329 | 326 | ||
330 | 327 | ||
331 | } | 328 | } |
332 | 329 | ||
333 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) | 330 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) |
334 | { | 331 | { |
335 | QDataStream stream( data, IO_ReadOnly ); | 332 | QDataStream stream( data, IO_ReadOnly ); |
336 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); | 333 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); |
337 | //QString datamess; | 334 | //QString datamess; |
338 | //qDebug("message "); | 335 | //qDebug("message "); |
339 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); | 336 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); |
340 | 337 | ||
341 | if ( cmsg == "-writeFile" ) { | 338 | if ( cmsg == "-writeFile" ) { |
342 | // I made from the "-writeFile" an "-writeAlarm" | 339 | // I made from the "-writeFile" an "-writeAlarm" |
343 | mView->viewManager()->showWhatsNextView(); | 340 | mView->viewManager()->showWhatsNextView(); |
344 | mCalendar->checkAlarmForIncidence( 0, true); | 341 | mCalendar->checkAlarmForIncidence( 0, true); |
345 | showMaximized(); | 342 | showMaximized(); |
346 | raise(); | 343 | raise(); |
347 | return; | 344 | return; |
348 | } | 345 | } |
349 | 346 | ||
350 | if ( cmsg == "-writeFile" ) { | 347 | if ( cmsg == "-writeFile" ) { |
351 | // I made from the "-writeFile" an "-writeAlarm" | 348 | // I made from the "-writeFile" an "-writeAlarm" |
352 | mView->viewManager()->showWhatsNextView(); | 349 | mView->viewManager()->showWhatsNextView(); |
353 | mCalendar->checkAlarmForIncidence( 0, true); | 350 | mCalendar->checkAlarmForIncidence( 0, true); |
354 | showMaximized(); | 351 | showMaximized(); |
355 | raise(); | 352 | raise(); |
356 | return; | 353 | return; |
357 | 354 | ||
358 | } | 355 | } |
359 | if ( cmsg == "-writeFileSilent" ) { | 356 | if ( cmsg == "-writeFileSilent" ) { |
360 | // I made from the "-writeFile" an "-writeAlarm" | 357 | // I made from the "-writeFile" an "-writeAlarm" |
361 | // mView->viewManager()->showWhatsNextView(); | 358 | // mView->viewManager()->showWhatsNextView(); |
362 | mCalendar->checkAlarmForIncidence( 0, true); | 359 | mCalendar->checkAlarmForIncidence( 0, true); |
363 | //showMaximized(); | 360 | //showMaximized(); |
364 | //raise(); | 361 | //raise(); |
365 | hide(); | 362 | hide(); |
366 | return; | 363 | return; |
367 | } | 364 | } |
368 | if ( cmsg == "-newCountdown" ) { | 365 | if ( cmsg == "-newCountdown" ) { |
369 | qDebug("newCountdown "); | 366 | qDebug("newCountdown "); |
370 | 367 | ||
371 | } | 368 | } |
372 | QString msg ; | 369 | QString msg ; |
373 | QString allmsg = cmsg; | 370 | QString allmsg = cmsg; |
374 | while ( allmsg.length() > 0 ) { | 371 | while ( allmsg.length() > 0 ) { |
375 | int nextC = allmsg.find( "-", 1 ); | 372 | int nextC = allmsg.find( "-", 1 ); |
376 | if ( nextC == -1 ) { | 373 | if ( nextC == -1 ) { |
377 | msg = allmsg; | 374 | msg = allmsg; |
378 | allmsg = ""; | 375 | allmsg = ""; |
379 | } else{ | 376 | } else{ |
380 | msg = allmsg.left( nextC ); | 377 | msg = allmsg.left( nextC ); |
381 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); | 378 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); |
382 | } | 379 | } |
383 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); | 380 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); |
384 | if ( msg == "-newEvent" ) { | 381 | if ( msg == "-newEvent" ) { |
385 | mView->newEvent(); | 382 | mView->newEvent(); |
386 | } | 383 | } |
387 | if ( msg == "-newTodo" ) { | 384 | if ( msg == "-newTodo" ) { |
388 | mView->newTodo(); | 385 | mView->newTodo(); |
389 | 386 | ||
390 | } | 387 | } |
391 | if ( msg == "-showWN" ) { | 388 | if ( msg == "-showWN" ) { |
392 | mView->viewManager()->showWhatsNextView(); | 389 | mView->viewManager()->showWhatsNextView(); |
393 | } | 390 | } |
394 | if ( msg == "-showTodo" ) { | 391 | if ( msg == "-showTodo" ) { |
395 | mView->viewManager()->showTodoView(); | 392 | mView->viewManager()->showTodoView(); |
396 | } | 393 | } |
397 | if ( msg == "-showList" ) { | 394 | if ( msg == "-showList" ) { |
398 | mView->viewManager()->showListView(); | 395 | mView->viewManager()->showListView(); |
399 | } | 396 | } |
400 | else if ( msg == "-showDay" ) { | 397 | else if ( msg == "-showDay" ) { |
401 | mView->viewManager()->showDayView(); | 398 | mView->viewManager()->showDayView(); |
402 | } | 399 | } |
403 | else if ( msg == "-showWWeek" ) { | 400 | else if ( msg == "-showWWeek" ) { |
404 | mView->viewManager()->showWorkWeekView(); | 401 | mView->viewManager()->showWorkWeekView(); |
405 | } | 402 | } |
406 | else if ( msg == "-ringSync" ) { | 403 | else if ( msg == "-ringSync" ) { |
407 | mSyncManager->multiSync( false ); | 404 | mSyncManager->multiSync( false ); |
408 | } | 405 | } |
409 | else if ( msg == "-showWeek" ) { | 406 | else if ( msg == "-showWeek" ) { |
410 | mView->viewManager()->showWeekView(); | 407 | mView->viewManager()->showWeekView(); |
411 | } | 408 | } |
412 | else if ( msg == "-showTodo" ) { | 409 | else if ( msg == "-showTodo" ) { |
413 | mView->viewManager()->showTodoView(); | 410 | mView->viewManager()->showTodoView(); |
414 | } | 411 | } |
415 | else if ( msg == "-showJournal" ) { | 412 | else if ( msg == "-showJournal" ) { |
416 | mView->dateNavigator()->selectDates( 1 ); | 413 | mView->dateNavigator()->selectDates( 1 ); |
417 | mView->dateNavigator()->selectToday(); | 414 | mView->dateNavigator()->selectToday(); |
418 | mView->viewManager()->showJournalView(); | 415 | mView->viewManager()->showJournalView(); |
419 | } | 416 | } |
420 | else if ( msg == "-showKO" ) { | 417 | else if ( msg == "-showKO" ) { |
421 | mView->viewManager()->showNextXView(); | 418 | mView->viewManager()->showNextXView(); |
422 | } | 419 | } |
423 | else if ( msg == "-showWNext" || msg == "nextView()" ) { | 420 | else if ( msg == "-showWNext" || msg == "nextView()" ) { |
424 | mView->viewManager()->showWhatsNextView(); | 421 | mView->viewManager()->showWhatsNextView(); |
425 | } | 422 | } |
426 | else if ( msg == "-showNextXView" ) { | 423 | else if ( msg == "-showNextXView" ) { |
427 | mView->viewManager()->showNextXView(); | 424 | mView->viewManager()->showNextXView(); |
428 | } | 425 | } |
429 | 426 | ||
430 | 427 | ||
431 | } | 428 | } |
432 | 429 | ||
433 | showMaximized(); | 430 | showMaximized(); |
434 | raise(); | 431 | raise(); |
435 | } | 432 | } |
436 | 433 | ||
437 | QPixmap MainWindow::loadPixmap( QString name ) | 434 | QPixmap MainWindow::loadPixmap( QString name ) |
438 | { | 435 | { |
439 | return SmallIcon( name ); | 436 | return SmallIcon( name ); |
440 | 437 | ||
441 | } | 438 | } |
442 | void MainWindow::initActions() | 439 | void MainWindow::initActions() |
443 | { | 440 | { |
444 | //KOPrefs::instance()->mShowFullMenu | 441 | //KOPrefs::instance()->mShowFullMenu |
445 | iconToolBar->clear(); | 442 | iconToolBar->clear(); |
446 | KOPrefs *p = KOPrefs::instance(); | 443 | KOPrefs *p = KOPrefs::instance(); |
447 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); | 444 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); |
448 | 445 | ||
449 | QPopupMenu *viewMenu = new QPopupMenu( this ); | 446 | QPopupMenu *viewMenu = new QPopupMenu( this ); |
450 | QPopupMenu *actionMenu = new QPopupMenu( this ); | 447 | QPopupMenu *actionMenu = new QPopupMenu( this ); |
451 | QPopupMenu *importMenu = new QPopupMenu( this ); | 448 | QPopupMenu *importMenu = new QPopupMenu( this ); |
452 | selectFilterMenu = new QPopupMenu( this ); | 449 | selectFilterMenu = new QPopupMenu( this ); |
453 | selectFilterMenu->setCheckable( true ); | 450 | selectFilterMenu->setCheckable( true ); |
454 | syncMenu = new QPopupMenu( this ); | 451 | syncMenu = new QPopupMenu( this ); |
455 | configureAgendaMenu = new QPopupMenu( this ); | 452 | configureAgendaMenu = new QPopupMenu( this ); |
456 | configureToolBarMenu = new QPopupMenu( this ); | 453 | configureToolBarMenu = new QPopupMenu( this ); |
457 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 454 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
458 | if ( KOPrefs::instance()->mShowFullMenu ) { | 455 | if ( KOPrefs::instance()->mShowFullMenu ) { |
459 | QMenuBar *menuBar1; | 456 | QMenuBar *menuBar1; |
460 | menuBar1 = menuBar(); | 457 | menuBar1 = menuBar(); |
461 | menuBar1->insertItem( i18n("File"), importMenu ); | 458 | menuBar1->insertItem( i18n("File"), importMenu ); |
462 | menuBar1->insertItem( i18n("View"), viewMenu ); | 459 | menuBar1->insertItem( i18n("View"), viewMenu ); |
463 | menuBar1->insertItem( i18n("Actions"), actionMenu ); | 460 | menuBar1->insertItem( i18n("Actions"), actionMenu ); |
464 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); | 461 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); |
465 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 462 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
466 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 463 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
467 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); | 464 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); |
468 | menuBar1->insertItem( i18n("Help"), helpMenu ); | 465 | menuBar1->insertItem( i18n("Help"), helpMenu ); |
469 | } else { | 466 | } else { |
470 | QPEMenuBar *menuBar1; | 467 | QPEMenuBar *menuBar1; |
471 | menuBar1 = new QPEMenuBar( iconToolBar ); | 468 | menuBar1 = new QPEMenuBar( iconToolBar ); |
472 | QPopupMenu *menuBar = new QPopupMenu( this ); | 469 | QPopupMenu *menuBar = new QPopupMenu( this ); |
473 | menuBar1->insertItem( i18n("ME"), menuBar); | 470 | menuBar1->insertItem( i18n("ME"), menuBar); |
474 | menuBar->insertItem( i18n("File"), importMenu ); | 471 | menuBar->insertItem( i18n("File"), importMenu ); |
475 | menuBar->insertItem( i18n("View"), viewMenu ); | 472 | menuBar->insertItem( i18n("View"), viewMenu ); |
476 | menuBar->insertItem( i18n("Actions"), actionMenu ); | 473 | menuBar->insertItem( i18n("Actions"), actionMenu ); |
477 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); | 474 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); |
478 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 475 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
479 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 476 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
480 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); | 477 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); |
481 | menuBar->insertItem( i18n("Help"), helpMenu ); | 478 | menuBar->insertItem( i18n("Help"), helpMenu ); |
482 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); | 479 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); |
483 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); | 480 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); |
484 | } | 481 | } |
485 | connect ( syncMenu, SIGNAL( activated ( int ) ), this, SLOT (slotSyncMenu( int ) ) ); | ||
486 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); | 482 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); |
487 | connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) ); | 483 | connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) ); |
488 | 484 | ||
489 | // ****************** | 485 | // ****************** |
490 | QAction *action; | 486 | QAction *action; |
491 | QIconSet icon; | 487 | QIconSet icon; |
492 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); | 488 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); |
493 | configureToolBarMenu->setCheckable( true ); | 489 | configureToolBarMenu->setCheckable( true ); |
494 | 490 | ||
495 | QString pathString = ""; | 491 | QString pathString = ""; |
496 | if ( !p->mToolBarMiniIcons ) { | 492 | if ( !p->mToolBarMiniIcons ) { |
497 | if ( QApplication::desktop()->width() < 480 ) | 493 | if ( QApplication::desktop()->width() < 480 ) |
498 | pathString += "icons16/"; | 494 | pathString += "icons16/"; |
499 | } else | 495 | } else |
500 | pathString += "iconsmini/"; | 496 | pathString += "iconsmini/"; |
501 | configureAgendaMenu->setCheckable( true ); | 497 | configureAgendaMenu->setCheckable( true ); |
502 | configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 ); | 498 | configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 ); |
503 | configureAgendaMenu->insertSeparator(); | 499 | configureAgendaMenu->insertSeparator(); |
504 | configureAgendaMenu->insertItem(i18n("Tiny"), 4 ); | 500 | configureAgendaMenu->insertItem(i18n("Tiny"), 4 ); |
505 | configureAgendaMenu->insertItem(i18n("Small"), 6 ); | 501 | configureAgendaMenu->insertItem(i18n("Small"), 6 ); |
506 | configureAgendaMenu->insertItem(i18n("Medium"), 8 ); | 502 | configureAgendaMenu->insertItem(i18n("Medium"), 8 ); |
507 | configureAgendaMenu->insertItem(i18n("Normal"), 10 ); | 503 | configureAgendaMenu->insertItem(i18n("Normal"), 10 ); |
508 | configureAgendaMenu->insertItem(i18n("Large"), 12 ); | 504 | configureAgendaMenu->insertItem(i18n("Large"), 12 ); |
509 | configureAgendaMenu->insertItem(i18n("Big"), 14 ); | 505 | configureAgendaMenu->insertItem(i18n("Big"), 14 ); |
510 | configureAgendaMenu->insertItem(i18n("Bigger"), 16 ); | 506 | configureAgendaMenu->insertItem(i18n("Bigger"), 16 ); |
511 | configureAgendaMenu->insertItem(i18n("Biggest"), 18 ); | 507 | configureAgendaMenu->insertItem(i18n("Biggest"), 18 ); |
512 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); | 508 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); |
513 | 509 | ||
514 | icon = loadPixmap( pathString + "configure" ); | 510 | icon = loadPixmap( pathString + "configure" ); |
515 | action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); | 511 | action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); |
516 | action->addTo( actionMenu ); | 512 | action->addTo( actionMenu ); |
517 | connect( action, SIGNAL( activated() ), | 513 | connect( action, SIGNAL( activated() ), |
518 | mView, SLOT( edit_options() ) ); | 514 | mView, SLOT( edit_options() ) ); |
519 | actionMenu->insertSeparator(); | 515 | actionMenu->insertSeparator(); |
520 | icon = loadPixmap( pathString + "newevent" ); | 516 | icon = loadPixmap( pathString + "newevent" ); |
521 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); | 517 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); |
522 | configureToolBarMenu->insertSeparator(); | 518 | configureToolBarMenu->insertSeparator(); |
523 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); | 519 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); |
524 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); | 520 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); |
525 | ne_action->addTo( actionMenu ); | 521 | ne_action->addTo( actionMenu ); |
526 | connect( ne_action, SIGNAL( activated() ), | 522 | connect( ne_action, SIGNAL( activated() ), |
527 | mView, SLOT( newEvent() ) ); | 523 | mView, SLOT( newEvent() ) ); |
528 | icon = loadPixmap( pathString + "newtodo" ); | 524 | icon = loadPixmap( pathString + "newtodo" ); |
529 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); | 525 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); |
530 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); | 526 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); |
531 | nt_action->addTo( actionMenu ); | 527 | nt_action->addTo( actionMenu ); |
532 | connect( nt_action, SIGNAL( activated() ), | 528 | connect( nt_action, SIGNAL( activated() ), |
533 | mView, SLOT( newTodo() ) ); | 529 | mView, SLOT( newTodo() ) ); |
534 | icon = loadPixmap( pathString + "navi" ); | 530 | icon = loadPixmap( pathString + "navi" ); |
535 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); | 531 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); |
536 | action->addTo( viewMenu ); | 532 | action->addTo( viewMenu ); |
537 | connect( action, SIGNAL( activated() ), | 533 | connect( action, SIGNAL( activated() ), |
538 | mView, SLOT( toggleDateNavigatorWidget() ) ); | 534 | mView, SLOT( toggleDateNavigatorWidget() ) ); |
539 | icon = loadPixmap( pathString + "filter" ); | 535 | icon = loadPixmap( pathString + "filter" ); |
540 | action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); | 536 | action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); |
541 | action->addTo( viewMenu ); | 537 | action->addTo( viewMenu ); |
542 | connect( action, SIGNAL( activated() ), | 538 | connect( action, SIGNAL( activated() ), |
543 | mView, SLOT( toggleFilter() ) ); | 539 | mView, SLOT( toggleFilter() ) ); |
544 | 540 | ||
545 | 541 | ||
546 | viewMenu->insertSeparator(); | 542 | viewMenu->insertSeparator(); |
547 | icon = loadPixmap( pathString + "picker" ); | 543 | icon = loadPixmap( pathString + "picker" ); |
548 | action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); | 544 | action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); |
549 | action->addTo( viewMenu ); | 545 | action->addTo( viewMenu ); |
550 | connect( action, SIGNAL( activated() ), | 546 | connect( action, SIGNAL( activated() ), |
551 | mView, SLOT( showDatePicker() ) ); | 547 | mView, SLOT( showDatePicker() ) ); |
552 | action->addTo( iconToolBar ); | 548 | action->addTo( iconToolBar ); |
553 | viewMenu->insertSeparator(); | 549 | viewMenu->insertSeparator(); |
554 | icon = loadPixmap( pathString + "list" ); | 550 | icon = loadPixmap( pathString + "list" ); |
555 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); | 551 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); |
556 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); | 552 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); |
557 | showlist_action->addTo( viewMenu ); | 553 | showlist_action->addTo( viewMenu ); |
558 | connect( showlist_action, SIGNAL( activated() ), | 554 | connect( showlist_action, SIGNAL( activated() ), |
559 | mView->viewManager(), SLOT( showListView() ) ); | 555 | mView->viewManager(), SLOT( showListView() ) ); |
560 | 556 | ||
561 | 557 | ||
562 | icon = loadPixmap( pathString + "day" ); | 558 | icon = loadPixmap( pathString + "day" ); |
563 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); | 559 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); |
564 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); | 560 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); |
565 | day1_action->addTo( viewMenu ); | 561 | day1_action->addTo( viewMenu ); |
566 | // action->addTo( toolBar ); | 562 | // action->addTo( toolBar ); |
567 | connect( day1_action, SIGNAL( activated() ), | 563 | connect( day1_action, SIGNAL( activated() ), |
568 | mView->viewManager(), SLOT( showDayView() ) ); | 564 | mView->viewManager(), SLOT( showDayView() ) ); |
569 | 565 | ||
570 | icon = loadPixmap( pathString + "workweek" ); | 566 | icon = loadPixmap( pathString + "workweek" ); |
571 | configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); | 567 | configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); |
572 | QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); | 568 | QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); |
573 | day5_action->addTo( viewMenu ); | 569 | day5_action->addTo( viewMenu ); |
574 | connect( day5_action, SIGNAL( activated() ), | 570 | connect( day5_action, SIGNAL( activated() ), |
575 | mView->viewManager(), SLOT( showWorkWeekView() ) ); | 571 | mView->viewManager(), SLOT( showWorkWeekView() ) ); |
576 | 572 | ||
577 | icon = loadPixmap( pathString + "week" ); | 573 | icon = loadPixmap( pathString + "week" ); |
578 | configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); | 574 | configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); |
579 | QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); | 575 | QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); |
580 | day7_action->addTo( viewMenu ); | 576 | day7_action->addTo( viewMenu ); |
581 | connect( day7_action, SIGNAL( activated() ), | 577 | connect( day7_action, SIGNAL( activated() ), |
582 | mView->viewManager(), SLOT( showWeekView() ) ); | 578 | mView->viewManager(), SLOT( showWeekView() ) ); |
583 | 579 | ||
584 | icon = loadPixmap( pathString + "month" ); | 580 | icon = loadPixmap( pathString + "month" ); |
585 | configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); | 581 | configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); |
586 | QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); | 582 | QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); |
587 | month_action->addTo( viewMenu ); | 583 | month_action->addTo( viewMenu ); |
588 | connect( month_action, SIGNAL( activated() ), | 584 | connect( month_action, SIGNAL( activated() ), |
589 | mView->viewManager(), SLOT( showMonthView() ) ); | 585 | mView->viewManager(), SLOT( showMonthView() ) ); |
590 | 586 | ||
591 | icon = loadPixmap( pathString + "todo" ); | 587 | icon = loadPixmap( pathString + "todo" ); |
592 | configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); | 588 | configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); |
593 | QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); | 589 | QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); |
594 | todoview_action->addTo( viewMenu ); | 590 | todoview_action->addTo( viewMenu ); |
595 | connect( todoview_action, SIGNAL( activated() ), | 591 | connect( todoview_action, SIGNAL( activated() ), |
596 | mView->viewManager(), SLOT( showTodoView() ) ); | 592 | mView->viewManager(), SLOT( showTodoView() ) ); |
597 | 593 | ||
598 | icon = loadPixmap( pathString + "journal" ); | 594 | icon = loadPixmap( pathString + "journal" ); |
599 | configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); | 595 | configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); |
600 | QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); | 596 | QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); |
601 | viewjournal_action->addTo( viewMenu ); | 597 | viewjournal_action->addTo( viewMenu ); |
602 | connect( viewjournal_action, SIGNAL( activated() ), | 598 | connect( viewjournal_action, SIGNAL( activated() ), |
603 | mView->viewManager(), SLOT( showJournalView() ) ); | 599 | mView->viewManager(), SLOT( showJournalView() ) ); |
604 | 600 | ||
605 | icon = loadPixmap( pathString + "xdays" ); | 601 | icon = loadPixmap( pathString + "xdays" ); |
606 | configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); | 602 | configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); |
607 | QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); | 603 | QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); |
608 | xdays_action->addTo( viewMenu ); | 604 | xdays_action->addTo( viewMenu ); |
609 | connect( xdays_action, SIGNAL( activated() ), | 605 | connect( xdays_action, SIGNAL( activated() ), |
610 | mView->viewManager(), SLOT( showNextXView() ) ); | 606 | mView->viewManager(), SLOT( showNextXView() ) ); |
611 | 607 | ||
612 | icon = loadPixmap( pathString + "whatsnext" ); | 608 | icon = loadPixmap( pathString + "whatsnext" ); |
613 | configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); | 609 | configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); |
614 | QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); | 610 | QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); |
615 | whatsnext_action->addTo( viewMenu ); | 611 | whatsnext_action->addTo( viewMenu ); |
616 | connect( whatsnext_action, SIGNAL( activated() ), | 612 | connect( whatsnext_action, SIGNAL( activated() ), |
617 | mView->viewManager(), SLOT( showWhatsNextView() ) ); | 613 | mView->viewManager(), SLOT( showWhatsNextView() ) ); |
618 | 614 | ||
619 | #if 0 | 615 | #if 0 |
620 | action = new QAction( "view_timespan", "Time Span", 0, this ); | 616 | action = new QAction( "view_timespan", "Time Span", 0, this ); |
621 | action->addTo( viewMenu ); | 617 | action->addTo( viewMenu ); |
622 | connect( action, SIGNAL( activated() ), | 618 | connect( action, SIGNAL( activated() ), |
623 | mView->viewManager(), SLOT( showTimeSpanView() ) ); | 619 | mView->viewManager(), SLOT( showTimeSpanView() ) ); |
624 | #endif | 620 | #endif |
625 | 621 | ||
626 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, | 622 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, |
627 | this ); | 623 | this ); |
628 | mNewSubTodoAction->addTo( actionMenu ); | 624 | mNewSubTodoAction->addTo( actionMenu ); |
629 | connect( mNewSubTodoAction, SIGNAL( activated() ), | 625 | connect( mNewSubTodoAction, SIGNAL( activated() ), |
630 | mView, SLOT( newSubTodo() ) ); | 626 | mView, SLOT( newSubTodo() ) ); |
631 | 627 | ||
632 | actionMenu->insertSeparator(); | 628 | actionMenu->insertSeparator(); |
633 | 629 | ||
634 | mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); | 630 | mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); |
635 | mShowAction->addTo( actionMenu ); | 631 | mShowAction->addTo( actionMenu ); |
636 | connect( mShowAction, SIGNAL( activated() ), | 632 | connect( mShowAction, SIGNAL( activated() ), |
637 | mView, SLOT( showIncidence() ) ); | 633 | mView, SLOT( showIncidence() ) ); |
638 | 634 | ||
639 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); | 635 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); |
640 | mEditAction->addTo( actionMenu ); | 636 | mEditAction->addTo( actionMenu ); |
641 | connect( mEditAction, SIGNAL( activated() ), | 637 | connect( mEditAction, SIGNAL( activated() ), |
642 | mView, SLOT( editIncidence() ) ); | 638 | mView, SLOT( editIncidence() ) ); |
643 | 639 | ||
644 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); | 640 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); |
645 | mDeleteAction->addTo( actionMenu ); | 641 | mDeleteAction->addTo( actionMenu ); |
646 | connect( mDeleteAction, SIGNAL( activated() ), | 642 | connect( mDeleteAction, SIGNAL( activated() ), |
647 | mView, SLOT( deleteIncidence() ) ); | 643 | mView, SLOT( deleteIncidence() ) ); |
648 | 644 | ||
649 | 645 | ||
650 | mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); | 646 | mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); |
651 | mCloneAction->addTo( actionMenu ); | 647 | mCloneAction->addTo( actionMenu ); |
652 | connect( mCloneAction, SIGNAL( activated() ), | 648 | connect( mCloneAction, SIGNAL( activated() ), |
653 | mView, SLOT( cloneIncidence() ) ); | 649 | mView, SLOT( cloneIncidence() ) ); |
654 | mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); | 650 | mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); |
655 | mMoveAction->addTo( actionMenu ); | 651 | mMoveAction->addTo( actionMenu ); |
656 | connect( mMoveAction, SIGNAL( activated() ), | 652 | connect( mMoveAction, SIGNAL( activated() ), |
657 | mView, SLOT( moveIncidence() ) ); | 653 | mView, SLOT( moveIncidence() ) ); |
658 | mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); | 654 | mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); |
659 | mBeamAction->addTo( actionMenu ); | 655 | mBeamAction->addTo( actionMenu ); |
660 | connect( mBeamAction, SIGNAL( activated() ), | 656 | connect( mBeamAction, SIGNAL( activated() ), |
661 | mView, SLOT( beamIncidence() ) ); | 657 | mView, SLOT( beamIncidence() ) ); |
662 | mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); | 658 | mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); |
663 | mCancelAction->addTo( actionMenu ); | 659 | mCancelAction->addTo( actionMenu ); |
664 | connect( mCancelAction, SIGNAL( activated() ), | 660 | connect( mCancelAction, SIGNAL( activated() ), |
665 | mView, SLOT( toggleCancelIncidence() ) ); | 661 | mView, SLOT( toggleCancelIncidence() ) ); |
666 | 662 | ||
667 | actionMenu->insertSeparator(); | 663 | actionMenu->insertSeparator(); |
668 | 664 | ||
669 | action = new QAction( "purge_completed", i18n("Purge Completed"), 0, | 665 | action = new QAction( "purge_completed", i18n("Purge Completed"), 0, |
670 | this ); | 666 | this ); |
671 | action->addTo( actionMenu ); | 667 | action->addTo( actionMenu ); |
672 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); | 668 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); |
673 | 669 | ||
674 | icon = loadPixmap( pathString + "search" ); | 670 | icon = loadPixmap( pathString + "search" ); |
675 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); | 671 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); |
676 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); | 672 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); |
677 | search_action->addTo( actionMenu ); | 673 | search_action->addTo( actionMenu ); |
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h index ee7bd87..e3383ed 100644 --- a/korganizer/mainwindow.h +++ b/korganizer/mainwindow.h | |||
@@ -1,130 +1,128 @@ | |||
1 | #ifndef KORGE_MAINWINDOW_H | 1 | #ifndef KORGE_MAINWINDOW_H |
2 | #define KORGE_MAINWINDOW_H | 2 | #define KORGE_MAINWINDOW_H |
3 | 3 | ||
4 | #include <qmainwindow.h> | 4 | #include <qmainwindow.h> |
5 | #include <qtimer.h> | 5 | #include <qtimer.h> |
6 | #include <qdict.h> | 6 | #include <qdict.h> |
7 | #include <qfile.h> | 7 | #include <qfile.h> |
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 | ||
15 | class QAction; | 15 | class QAction; |
16 | class CalendarView; | 16 | class CalendarView; |
17 | class KSyncProfile; | 17 | class KSyncProfile; |
18 | #ifdef DESKTOP_VERSION | 18 | #ifdef DESKTOP_VERSION |
19 | 19 | ||
20 | #define QPEToolBar QToolBar | 20 | #define QPEToolBar QToolBar |
21 | #define QPEMenuBar QMenuBar | 21 | #define QPEMenuBar QMenuBar |
22 | #endif | 22 | #endif |
23 | class QPEToolBar; | 23 | class QPEToolBar; |
24 | 24 | ||
25 | 25 | ||
26 | namespace KCal { | 26 | namespace KCal { |
27 | class CalendarLocal; | 27 | class CalendarLocal; |
28 | } | 28 | } |
29 | 29 | ||
30 | using namespace KCal; | 30 | using namespace KCal; |
31 | 31 | ||
32 | class MainWindow : public QMainWindow | 32 | class MainWindow : public QMainWindow |
33 | { | 33 | { |
34 | Q_OBJECT | 34 | Q_OBJECT |
35 | public: | 35 | public: |
36 | MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); | 36 | MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); |
37 | ~MainWindow(); | 37 | ~MainWindow(); |
38 | public slots: | 38 | public slots: |
39 | virtual void showMaximized (); | 39 | virtual void showMaximized (); |
40 | void configureAgenda( int ); | 40 | void configureAgenda( int ); |
41 | void recieve( const QCString& msg, const QByteArray& data ); | 41 | void recieve( const QCString& msg, const QByteArray& data ); |
42 | static QString defaultFileName(); | 42 | static QString defaultFileName(); |
43 | static QString syncFileName(); | 43 | static QString syncFileName(); |
44 | static QString resourcePath(); | 44 | static QString resourcePath(); |
45 | protected slots: | 45 | protected slots: |
46 | void setCaptionToDates(); | 46 | void setCaptionToDates(); |
47 | void about(); | 47 | void about(); |
48 | void licence(); | 48 | void licence(); |
49 | void faq(); | 49 | void faq(); |
50 | void usertrans(); | 50 | void usertrans(); |
51 | void features(); | 51 | void features(); |
52 | void synchowto(); | 52 | void synchowto(); |
53 | void whatsNew(); | 53 | void whatsNew(); |
54 | void keyBindings(); | 54 | void keyBindings(); |
55 | void aboutAutoSaving();; | 55 | void aboutAutoSaving();; |
56 | void aboutKnownBugs(); | 56 | void aboutKnownBugs(); |
57 | 57 | ||
58 | void processIncidenceSelection( Incidence * ); | 58 | void processIncidenceSelection( Incidence * ); |
59 | 59 | ||
60 | void importQtopia(); | 60 | void importQtopia(); |
61 | void importBday(); | 61 | void importBday(); |
62 | void importOL(); | 62 | void importOL(); |
63 | void importIcal(); | 63 | void importIcal(); |
64 | void importFile( QString, bool ); | 64 | void importFile( QString, bool ); |
65 | void quickImportIcal(); | 65 | void quickImportIcal(); |
66 | 66 | ||
67 | void slotModifiedChanged( bool ); | 67 | void slotModifiedChanged( bool ); |
68 | 68 | ||
69 | void save(); | 69 | void save(); |
70 | void configureToolBar( int ); | 70 | void configureToolBar( int ); |
71 | void printSel(); | 71 | void printSel(); |
72 | void printCal(); | 72 | void printCal(); |
73 | void saveCalendar(); | 73 | void saveCalendar(); |
74 | void loadCalendar(); | 74 | void loadCalendar(); |
75 | void exportVCalendar(); | 75 | void exportVCalendar(); |
76 | void fillFilterMenu(); | 76 | void fillFilterMenu(); |
77 | void selectFilter( int ); | 77 | void selectFilter( int ); |
78 | void exportToPhone( int ); | 78 | void exportToPhone( int ); |
79 | 79 | ||
80 | 80 | ||
81 | protected: | 81 | protected: |
82 | void displayText( QString, QString); | 82 | void displayText( QString, QString); |
83 | void displayFile( QString, QString); | 83 | void displayFile( QString, QString); |
84 | 84 | ||
85 | void enableIncidenceActions( bool ); | 85 | void enableIncidenceActions( bool ); |
86 | 86 | ||
87 | private slots: | 87 | private slots: |
88 | QSocket* piSocket; | 88 | QSocket* piSocket; |
89 | QString piFileString; | 89 | QString piFileString; |
90 | QTime piTime; | 90 | QTime piTime; |
91 | void getFile( bool ); | 91 | void getFile( bool ); |
92 | void syncFileRequest(); | 92 | void syncFileRequest(); |
93 | private: | 93 | private: |
94 | KSyncManager* mSyncManager; | 94 | KSyncManager* mSyncManager; |
95 | //QTimer* mTimerCommandSocket; | ||
96 | KServerSocket * mServerSocket; | ||
97 | bool mClosed; | 95 | bool mClosed; |
98 | void saveOnClose(); | 96 | void saveOnClose(); |
99 | bool mFlagKeyPressed; | 97 | bool mFlagKeyPressed; |
100 | bool mBlockAtStartup; | 98 | bool mBlockAtStartup; |
101 | QPEToolBar *iconToolBar; | 99 | QPEToolBar *iconToolBar; |
102 | void initActions(); | 100 | void initActions(); |
103 | void setDefaultPreferences(); | 101 | void setDefaultPreferences(); |
104 | void keyPressEvent ( QKeyEvent * ) ; | 102 | void keyPressEvent ( QKeyEvent * ) ; |
105 | void keyReleaseEvent ( QKeyEvent * ) ; | 103 | void keyReleaseEvent ( QKeyEvent * ) ; |
106 | QPopupMenu *configureToolBarMenu; | 104 | QPopupMenu *configureToolBarMenu; |
107 | QPopupMenu *selectFilterMenu; | 105 | QPopupMenu *selectFilterMenu; |
108 | QPopupMenu *configureAgendaMenu, *syncMenu; | 106 | QPopupMenu *configureAgendaMenu, *syncMenu; |
109 | CalendarLocal *mCalendar; | 107 | CalendarLocal *mCalendar; |
110 | CalendarView *mView; | 108 | CalendarView *mView; |
111 | QAction *mNewSubTodoAction; | 109 | QAction *mNewSubTodoAction; |
112 | 110 | ||
113 | QAction *mShowAction; | 111 | QAction *mShowAction; |
114 | QAction *mEditAction; | 112 | QAction *mEditAction; |
115 | QAction *mDeleteAction; | 113 | QAction *mDeleteAction; |
116 | QAction *mCloneAction; | 114 | QAction *mCloneAction; |
117 | QAction *mMoveAction; | 115 | QAction *mMoveAction; |
118 | QAction *mBeamAction; | 116 | QAction *mBeamAction; |
119 | QAction *mCancelAction; | 117 | QAction *mCancelAction; |
120 | 118 | ||
121 | void closeEvent( QCloseEvent* ce ); | 119 | void closeEvent( QCloseEvent* ce ); |
122 | SimpleAlarmClient mAlarmClient; | 120 | SimpleAlarmClient mAlarmClient; |
123 | QTimer mSaveTimer; | 121 | QTimer mSaveTimer; |
124 | //bool mBlockSaveFlag; | 122 | //bool mBlockSaveFlag; |
125 | bool mCalendarModifiedFlag; | 123 | bool mCalendarModifiedFlag; |
126 | QPixmap loadPixmap( QString ); | 124 | QPixmap loadPixmap( QString ); |
127 | }; | 125 | }; |
128 | 126 | ||
129 | 127 | ||
130 | #endif | 128 | #endif |