summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/main.cpp6
-rw-r--r--korganizer/mainwindow.cpp6
-rw-r--r--korganizer/mainwindow.h2
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
21int main( int argc, char **argv ) 22int 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,1253 +1,1249 @@
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
65using namespace KCal; 65using 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
73class KOex2phonePrefs : public QDialog 73class 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
119public: 119public:
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
125int globalFlagBlockStartup; 125int globalFlagBlockStartup;
126MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : 126MainWindow::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}
278MainWindow::~MainWindow() 277MainWindow::~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}
289void MainWindow::showMaximized () 286void 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}
299void MainWindow::closeEvent( QCloseEvent* ce ) 296void 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
333void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 330void 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
437QPixmap MainWindow::loadPixmap( QString name ) 434QPixmap MainWindow::loadPixmap( QString name )
438{ 435{
439 return SmallIcon( name ); 436 return SmallIcon( name );
440 437
441} 438}
442void MainWindow::initActions() 439void 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 );
678 connect( search_action, SIGNAL( activated() ), 674 connect( search_action, SIGNAL( activated() ),
679 mView->dialogManager(), SLOT( showSearchDialog() ) ); 675 mView->dialogManager(), SLOT( showSearchDialog() ) );
680 676
681 icon = loadPixmap( pathString + "today" ); 677 icon = loadPixmap( pathString + "today" );
682 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 678 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
683 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 679 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
684 today_action->addTo( actionMenu ); 680 today_action->addTo( actionMenu );
685 connect( today_action, SIGNAL( activated() ), 681 connect( today_action, SIGNAL( activated() ),
686 mView, SLOT( goToday() ) ); 682 mView, SLOT( goToday() ) );
687 683
688 if ( KOPrefs::instance()->mShowFullMenu ) { 684 if ( KOPrefs::instance()->mShowFullMenu ) {
689 actionMenu->insertSeparator(); 685 actionMenu->insertSeparator();
690 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 686 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
691 687
692 } 688 }
693 // actionMenu->insertSeparator(); 689 // actionMenu->insertSeparator();
694 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, 690 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
695 this ); 691 this );
696 action->addTo( importMenu ); 692 action->addTo( importMenu );
697 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); 693 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
698 action = new QAction( "import_quick", i18n("Import last file"), 0, 694 action = new QAction( "import_quick", i18n("Import last file"), 0,
699 this ); 695 this );
700 action->addTo( importMenu ); 696 action->addTo( importMenu );
701 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); 697 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
702 importMenu->insertSeparator(); 698 importMenu->insertSeparator();
703 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, 699 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
704 this ); 700 this );
705 action->addTo( importMenu ); 701 action->addTo( importMenu );
706 connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); 702 connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
707#ifndef DESKTOP_VERSION 703#ifndef DESKTOP_VERSION
708 importMenu->insertSeparator(); 704 importMenu->insertSeparator();
709 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, 705 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
710 this ); 706 this );
711 action->addTo( importMenu ); 707 action->addTo( importMenu );
712 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); 708 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
713#else 709#else
714#ifdef _WIN32_ 710#ifdef _WIN32_
715 importMenu->insertSeparator(); 711 importMenu->insertSeparator();
716 action = new QAction( "import_ol", i18n("Import from OL"), 0, 712 action = new QAction( "import_ol", i18n("Import from OL"), 0,
717 this ); 713 this );
718 action->addTo( importMenu ); 714 action->addTo( importMenu );
719 connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); 715 connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
720#endif 716#endif
721#endif 717#endif
722 718
723 importMenu->insertSeparator(); 719 importMenu->insertSeparator();
724 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, 720 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
725 this ); 721 this );
726 action->addTo( importMenu ); 722 action->addTo( importMenu );
727 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); 723 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
728 724
729 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, 725 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0,
730 this ); 726 this );
731 action->addTo( importMenu ); 727 action->addTo( importMenu );
732 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); 728 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
733 729
734 importMenu->insertSeparator(); 730 importMenu->insertSeparator();
735 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, 731 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0,
736 this ); 732 this );
737 action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); 733 action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) );
738 734
739 735
740 //LR 736 //LR
741 QPopupMenu *ex2phone = new QPopupMenu( this ); 737 QPopupMenu *ex2phone = new QPopupMenu( this );
742 ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 738 ex2phone->insertItem(i18n("Complete calendar..."), 1 );
743 ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 739 ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
744 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); 740 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) );
745 importMenu->insertItem( i18n("Export to phone"), ex2phone ); 741 importMenu->insertItem( i18n("Export to phone"), ex2phone );
746 742
747 importMenu->insertSeparator(); 743 importMenu->insertSeparator();
748 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 744 action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
749 this ); 745 this );
750 action->addTo( importMenu ); 746 action->addTo( importMenu );
751 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 747 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
752#ifndef DESKTOP_VERSION 748#ifndef DESKTOP_VERSION
753 importMenu->insertSeparator(); 749 importMenu->insertSeparator();
754 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, 750 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
755 this ); 751 this );
756 action->addTo( importMenu ); 752 action->addTo( importMenu );
757 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); 753 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
758 754
759 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, 755 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0,
760 this ); 756 this );
761 action->addTo( importMenu ); 757 action->addTo( importMenu );
762 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); 758 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
763#else 759#else
764 importMenu->insertSeparator(); 760 importMenu->insertSeparator();
765 icon = loadPixmap( pathString + "print" ); 761 icon = loadPixmap( pathString + "print" );
766 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); 762 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
767 action->addTo( importMenu ); 763 action->addTo( importMenu );
768 connect( action, SIGNAL( activated() ), 764 connect( action, SIGNAL( activated() ),
769 this, SLOT( printCal() ) ); 765 this, SLOT( printCal() ) );
770 766
771 icon = loadPixmap( pathString + "print" ); 767 icon = loadPixmap( pathString + "print" );
772 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); 768 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
773 action->addTo( importMenu ); 769 action->addTo( importMenu );
774 connect( action, SIGNAL( activated() ), 770 connect( action, SIGNAL( activated() ),
775 this, SLOT( printSel() ) ); 771 this, SLOT( printSel() ) );
776#endif 772#endif
777 importMenu->insertSeparator(); 773 importMenu->insertSeparator();
778 action = new QAction( "beam all", i18n("Save"), 0, 774 action = new QAction( "beam all", i18n("Save"), 0,
779 this ); 775 this );
780 action->addTo( importMenu ); 776 action->addTo( importMenu );
781 connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); 777 connect( action, SIGNAL( activated() ), this, SLOT( save() ) );
782 action = new QAction( "beam all", i18n("Exit (+save)"), 0, 778 action = new QAction( "beam all", i18n("Exit (+save)"), 0,
783 this ); 779 this );
784 action->addTo( importMenu ); 780 action->addTo( importMenu );
785 connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); 781 connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
786 782
787 //menuBar->insertItem( "Configure",configureMenu ); 783 //menuBar->insertItem( "Configure",configureMenu );
788 //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); 784 //configureMenu->insertItem( "Toolbar",configureToolBarMenu );
789 icon = loadPixmap( "korganizer/korganizer" ); 785 icon = loadPixmap( "korganizer/korganizer" );
790 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); 786 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
791 action->addTo( helpMenu ); 787 action->addTo( helpMenu );
792 connect( action, SIGNAL( activated() ), 788 connect( action, SIGNAL( activated() ),
793 SLOT( keyBindings() ) ); 789 SLOT( keyBindings() ) );
794 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); 790 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this );
795 action->addTo( helpMenu ); 791 action->addTo( helpMenu );
796 connect( action, SIGNAL( activated() ), 792 connect( action, SIGNAL( activated() ),
797 SLOT( features() ) ); 793 SLOT( features() ) );
798 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); 794 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this );
799 action->addTo( helpMenu ); 795 action->addTo( helpMenu );
800 connect( action, SIGNAL( activated() ), 796 connect( action, SIGNAL( activated() ),
801 SLOT( aboutAutoSaving() ) ); 797 SLOT( aboutAutoSaving() ) );
802 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); 798 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this );
803 action->addTo( helpMenu ); 799 action->addTo( helpMenu );
804 connect( action, SIGNAL( activated() ), 800 connect( action, SIGNAL( activated() ),
805 SLOT( aboutKnownBugs() ) ); 801 SLOT( aboutKnownBugs() ) );
806 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); 802 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this );
807 action->addTo( helpMenu ); 803 action->addTo( helpMenu );
808 connect( action, SIGNAL( activated() ), 804 connect( action, SIGNAL( activated() ),
809 SLOT( usertrans() ) ); 805 SLOT( usertrans() ) );
810 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); 806 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this );
811 action->addTo( helpMenu ); 807 action->addTo( helpMenu );
812 connect( action, SIGNAL( activated() ), 808 connect( action, SIGNAL( activated() ),
813 SLOT( synchowto() ) ); 809 SLOT( synchowto() ) );
814 action = new QAction( "Whats New", i18n("What's new?"), 0,this ); 810 action = new QAction( "Whats New", i18n("What's new?"), 0,this );
815 action->addTo( helpMenu ); 811 action->addTo( helpMenu );
816 connect( action, SIGNAL( activated() ), 812 connect( action, SIGNAL( activated() ),
817 SLOT( whatsNew() ) ); 813 SLOT( whatsNew() ) );
818 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); 814 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this );
819 action->addTo( helpMenu ); 815 action->addTo( helpMenu );
820 connect( action, SIGNAL( activated() ), 816 connect( action, SIGNAL( activated() ),
821 SLOT( faq() ) ); 817 SLOT( faq() ) );
822 818
823 819
824 action = new QAction( "about", i18n("About..."), 0, this ); 820 action = new QAction( "about", i18n("About..."), 0, this );
825 action->addTo( helpMenu ); 821 action->addTo( helpMenu );
826 connect( action, SIGNAL( activated() ), 822 connect( action, SIGNAL( activated() ),
827 SLOT( about() ) ); 823 SLOT( about() ) );
828 action = new QAction( "licence", i18n("Licence..."), 0, this ); 824 action = new QAction( "licence", i18n("Licence..."), 0, this );
829 action->addTo( helpMenu ); 825 action->addTo( helpMenu );
830 connect( action, SIGNAL( activated() ), 826 connect( action, SIGNAL( activated() ),
831 SLOT( licence() ) ); 827 SLOT( licence() ) );
832 //menuBar->insertSeparator(); 828 //menuBar->insertSeparator();
833 829
834 // ****************************************************** 830 // ******************************************************
835 // menubar icons 831 // menubar icons
836 832
837 833
838 iconToolBar->setHorizontalStretchable (true ); 834 iconToolBar->setHorizontalStretchable (true );
839 //menuBar->insertItem( iconToolBar ); 835 //menuBar->insertItem( iconToolBar );
840 //xdays_action 836 //xdays_action
841 if (p-> mShowIconNewEvent) 837 if (p-> mShowIconNewEvent)
842 ne_action->addTo( iconToolBar ); 838 ne_action->addTo( iconToolBar );
843 if (p->mShowIconNewTodo ) 839 if (p->mShowIconNewTodo )
844 nt_action->addTo( iconToolBar ); 840 nt_action->addTo( iconToolBar );
845 if (p-> mShowIconSearch) 841 if (p-> mShowIconSearch)
846 search_action->addTo( iconToolBar ); 842 search_action->addTo( iconToolBar );
847 if (p-> mShowIconNext) 843 if (p-> mShowIconNext)
848 whatsnext_action->addTo( iconToolBar ); 844 whatsnext_action->addTo( iconToolBar );
849 if (p-> mShowIconNextDays) 845 if (p-> mShowIconNextDays)
850 xdays_action->addTo( iconToolBar ); 846 xdays_action->addTo( iconToolBar );
851 if (p-> mShowIconList) 847 if (p-> mShowIconList)
852 showlist_action->addTo( iconToolBar ); 848 showlist_action->addTo( iconToolBar );
853 if (p-> mShowIconDay1) 849 if (p-> mShowIconDay1)
854 day1_action->addTo( iconToolBar ); 850 day1_action->addTo( iconToolBar );
855 if (p-> mShowIconDay5) 851 if (p-> mShowIconDay5)
856 day5_action->addTo( iconToolBar ); 852 day5_action->addTo( iconToolBar );
857 if (p-> mShowIconDay7) 853 if (p-> mShowIconDay7)
858 day7_action->addTo( iconToolBar ); 854 day7_action->addTo( iconToolBar );
859 if (p-> mShowIconMonth) 855 if (p-> mShowIconMonth)
860 month_action->addTo( iconToolBar ); 856 month_action->addTo( iconToolBar );
861 if (p-> mShowIconTodoview) 857 if (p-> mShowIconTodoview)
862 todoview_action->addTo( iconToolBar ); 858 todoview_action->addTo( iconToolBar );
863 if (p-> mShowIconJournal) 859 if (p-> mShowIconJournal)
864 viewjournal_action->addTo( iconToolBar ); 860 viewjournal_action->addTo( iconToolBar );
865 icon = loadPixmap( pathString + "2leftarrowB" ); 861 icon = loadPixmap( pathString + "2leftarrowB" );
866 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); 862 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14);
867 if (p-> mShowIconBackFast) { 863 if (p-> mShowIconBackFast) {
868 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); 864 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
869 connect( action, SIGNAL( activated() ), 865 connect( action, SIGNAL( activated() ),
870 mView, SLOT( goPreviousMonth() ) ); 866 mView, SLOT( goPreviousMonth() ) );
871 action->addTo( iconToolBar ); 867 action->addTo( iconToolBar );
872 } 868 }
873 icon = loadPixmap( pathString + "1leftarrowB" ); 869 icon = loadPixmap( pathString + "1leftarrowB" );
874 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); 870 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15);
875 if (p-> mShowIconBack) { 871 if (p-> mShowIconBack) {
876 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); 872 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
877 connect( action, SIGNAL( activated() ), 873 connect( action, SIGNAL( activated() ),
878 mView, SLOT( goPrevious() ) ); 874 mView, SLOT( goPrevious() ) );
879 action->addTo( iconToolBar ); 875 action->addTo( iconToolBar );
880 } 876 }
881 if (p-> mShowIconToday) 877 if (p-> mShowIconToday)
882 today_action->addTo( iconToolBar ); 878 today_action->addTo( iconToolBar );
883 icon = loadPixmap( pathString + "1rightarrowB" ); 879 icon = loadPixmap( pathString + "1rightarrowB" );
884 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); 880 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
885 if (p-> mShowIconForward) { 881 if (p-> mShowIconForward) {
886 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); 882 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
887 connect( action, SIGNAL( activated() ), 883 connect( action, SIGNAL( activated() ),
888 mView, SLOT( goNext() ) ); 884 mView, SLOT( goNext() ) );
889 action->addTo( iconToolBar ); 885 action->addTo( iconToolBar );
890 } 886 }
891 icon = loadPixmap( pathString + "2rightarrowB" ); 887 icon = loadPixmap( pathString + "2rightarrowB" );
892 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); 888 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
893 if (p-> mShowIconForwardFast) { 889 if (p-> mShowIconForwardFast) {
894 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); 890 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this );
895 connect( action, SIGNAL( activated() ), 891 connect( action, SIGNAL( activated() ),
896 mView, SLOT( goNextMonth() ) ); 892 mView, SLOT( goNextMonth() ) );
897 action->addTo( iconToolBar ); 893 action->addTo( iconToolBar );
898 } 894 }
899 895
900 896
901 configureToolBarMenu->insertItem(i18n("What's This?"), 300); 897 configureToolBarMenu->insertItem(i18n("What's This?"), 300);
902 898
903 if (p-> mShowIconNewEvent) 899 if (p-> mShowIconNewEvent)
904 configureToolBarMenu->setItemChecked( 10, true ); 900 configureToolBarMenu->setItemChecked( 10, true );
905 if (p->mShowIconNewTodo ) 901 if (p->mShowIconNewTodo )
906 configureToolBarMenu->setItemChecked( 20, true ); 902 configureToolBarMenu->setItemChecked( 20, true );
907 if (p-> mShowIconSearch) 903 if (p-> mShowIconSearch)
908 configureToolBarMenu->setItemChecked( 120, true ); 904 configureToolBarMenu->setItemChecked( 120, true );
909 if (p-> mShowIconList) 905 if (p-> mShowIconList)
910 configureToolBarMenu->setItemChecked( 30, true ); 906 configureToolBarMenu->setItemChecked( 30, true );
911 if (p-> mShowIconDay1) 907 if (p-> mShowIconDay1)
912 configureToolBarMenu->setItemChecked( 40, true ); 908 configureToolBarMenu->setItemChecked( 40, true );
913 if (p-> mShowIconDay5) 909 if (p-> mShowIconDay5)
914 configureToolBarMenu->setItemChecked( 50, true ); 910 configureToolBarMenu->setItemChecked( 50, true );
915 if (p-> mShowIconDay7) 911 if (p-> mShowIconDay7)
916 configureToolBarMenu->setItemChecked( 60, true ); 912 configureToolBarMenu->setItemChecked( 60, true );
917 if (p-> mShowIconMonth) 913 if (p-> mShowIconMonth)
918 configureToolBarMenu->setItemChecked( 70, true ); 914 configureToolBarMenu->setItemChecked( 70, true );
919 if (p-> mShowIconTodoview) 915 if (p-> mShowIconTodoview)
920 configureToolBarMenu->setItemChecked( 80, true ); 916 configureToolBarMenu->setItemChecked( 80, true );
921 if (p-> mShowIconBackFast) 917 if (p-> mShowIconBackFast)
922 configureToolBarMenu->setItemChecked( 200, true ); 918 configureToolBarMenu->setItemChecked( 200, true );
923 if (p-> mShowIconBack) 919 if (p-> mShowIconBack)
924 configureToolBarMenu->setItemChecked( 210, true ); 920 configureToolBarMenu->setItemChecked( 210, true );
925 if (p-> mShowIconToday) 921 if (p-> mShowIconToday)
926 configureToolBarMenu->setItemChecked( 130, true ); 922 configureToolBarMenu->setItemChecked( 130, true );
927 if (p-> mShowIconForward) 923 if (p-> mShowIconForward)
928 configureToolBarMenu->setItemChecked( 220, true ); 924 configureToolBarMenu->setItemChecked( 220, true );
929 if (p-> mShowIconForwardFast) 925 if (p-> mShowIconForwardFast)
930 configureToolBarMenu->setItemChecked( 230, true ); 926 configureToolBarMenu->setItemChecked( 230, true );
931 if (p-> mShowIconNextDays) 927 if (p-> mShowIconNextDays)
932 configureToolBarMenu->setItemChecked( 100, true ); 928 configureToolBarMenu->setItemChecked( 100, true );
933 if (p-> mShowIconNext) 929 if (p-> mShowIconNext)
934 configureToolBarMenu->setItemChecked( 110, true ); 930 configureToolBarMenu->setItemChecked( 110, true );
935 if (p-> mShowIconJournal) 931 if (p-> mShowIconJournal)
936 configureToolBarMenu->setItemChecked( 90, true ); 932 configureToolBarMenu->setItemChecked( 90, true );
937 if (p-> mShowIconWhatsThis) 933 if (p-> mShowIconWhatsThis)
938 configureToolBarMenu->setItemChecked( 300, true ); 934 configureToolBarMenu->setItemChecked( 300, true );
939 935
940 QLabel* dummy = new QLabel( iconToolBar ); 936 QLabel* dummy = new QLabel( iconToolBar );
941 dummy->setBackgroundColor( iconToolBar->backgroundColor() ); 937 dummy->setBackgroundColor( iconToolBar->backgroundColor() );
942 if (!p-> mShowIconStretch) 938 if (!p-> mShowIconStretch)
943 iconToolBar->setStretchableWidget ( dummy ) ; 939 iconToolBar->setStretchableWidget ( dummy ) ;
944 else 940 else
945 configureToolBarMenu->setItemChecked( 5, true ); 941 configureToolBarMenu->setItemChecked( 5, true );
946 if (p-> mShowIconWhatsThis) 942 if (p-> mShowIconWhatsThis)
947 QWhatsThis::whatsThisButton ( iconToolBar ); 943 QWhatsThis::whatsThisButton ( iconToolBar );
948 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); 944 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) );
949 configureAgenda( p->mHourSize ); 945 configureAgenda( p->mHourSize );
950 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); 946 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) );
951} 947}
952 948
953void MainWindow::exportToPhone( int mode ) 949void MainWindow::exportToPhone( int mode )
954{ 950{
955 951
956 //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 952 //ex2phone->insertItem(i18n("Complete calendar..."), 1 );
957 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 953 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
958 KOex2phonePrefs ex2phone; 954 KOex2phonePrefs ex2phone;
959 955
960 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 956 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
961 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 957 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
962 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 958 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
963 if ( mode == 1 ) 959 if ( mode == 1 )
964 ex2phone.setCaption(i18n("Export complete calendar")); 960 ex2phone.setCaption(i18n("Export complete calendar"));
965 if ( mode == 2 ) 961 if ( mode == 2 )
966 ex2phone.setCaption(i18n("Export filtered calendar")); 962 ex2phone.setCaption(i18n("Export filtered calendar"));
967 963
968 if ( !ex2phone.exec() ) { 964 if ( !ex2phone.exec() ) {
969 return; 965 return;
970 } 966 }
971 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 967 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
972 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 968 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
973 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 969 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
974 970
975 int inFuture = 0; 971 int inFuture = 0;
976 if ( ex2phone.mWriteBackFuture->isChecked() ) 972 if ( ex2phone.mWriteBackFuture->isChecked() )
977 inFuture = ex2phone.mWriteBackFutureWeeks->value(); 973 inFuture = ex2phone.mWriteBackFutureWeeks->value();
978 QPtrList<Incidence> delSel; 974 QPtrList<Incidence> delSel;
979 if ( mode == 1 ) 975 if ( mode == 1 )
980 delSel = mCalendar->rawIncidences(); 976 delSel = mCalendar->rawIncidences();
981 if ( mode == 2 ) 977 if ( mode == 2 )
982 delSel = mCalendar->incidences(); 978 delSel = mCalendar->incidences();
983 CalendarLocal* cal = new CalendarLocal(); 979 CalendarLocal* cal = new CalendarLocal();
984 cal->setLocalTime(); 980 cal->setLocalTime();
985 Incidence *incidence = delSel.first(); 981 Incidence *incidence = delSel.first();
986 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 982 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
987 QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); 983 QDateTime end = cur.addDays( ( inFuture +1 ) *7 );
988 while ( incidence ) { 984 while ( incidence ) {
989 if ( incidence->type() != "Journal" ) { 985 if ( incidence->type() != "Journal" ) {
990 bool add = true; 986 bool add = true;
991 if ( inFuture ) { 987 if ( inFuture ) {
992 QDateTime dt; 988 QDateTime dt;
993 if ( incidence->type() == "Todo" ) { 989 if ( incidence->type() == "Todo" ) {
994 Todo * t = (Todo*)incidence; 990 Todo * t = (Todo*)incidence;
995 if ( t->hasDueDate() ) 991 if ( t->hasDueDate() )
996 dt = t->dtDue(); 992 dt = t->dtDue();
997 else 993 else
998 dt = cur.addSecs( 62 ); 994 dt = cur.addSecs( 62 );
999 } 995 }
1000 else { 996 else {
1001 bool ok; 997 bool ok;
1002 dt = incidence->getNextOccurence( cur, &ok ); 998 dt = incidence->getNextOccurence( cur, &ok );
1003 if ( !ok ) 999 if ( !ok )
1004 dt = cur.addSecs( -62 ); 1000 dt = cur.addSecs( -62 );
1005 } 1001 }
1006 if ( dt < cur || dt > end ) { 1002 if ( dt < cur || dt > end ) {
1007 add = false; 1003 add = false;
1008 } 1004 }
1009 } 1005 }
1010 if ( add ) { 1006 if ( add ) {
1011 Incidence *in = incidence->clone(); 1007 Incidence *in = incidence->clone();
1012 cal->addIncidence( in ); 1008 cal->addIncidence( in );
1013 } 1009 }
1014 } 1010 }
1015 incidence = delSel.next(); 1011 incidence = delSel.next();
1016 } 1012 }
1017 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 1013 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
1018 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 1014 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
1019 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1015 KPimGlobalPrefs::instance()->mEx2PhoneModel );
1020 1016
1021 setCaption( i18n("Writing to phone...")); 1017 setCaption( i18n("Writing to phone..."));
1022 if ( PhoneFormat::writeToPhone( cal ) ) 1018 if ( PhoneFormat::writeToPhone( cal ) )
1023 setCaption( i18n("Export to phone successful!")); 1019 setCaption( i18n("Export to phone successful!"));
1024 else 1020 else
1025 setCaption( i18n("Error exporting to phone!")); 1021 setCaption( i18n("Error exporting to phone!"));
1026 delete cal; 1022 delete cal;
1027} 1023}
1028 1024
1029 1025
1030void MainWindow::setDefaultPreferences() 1026void MainWindow::setDefaultPreferences()
1031{ 1027{
1032 KOPrefs *p = KOPrefs::instance(); 1028 KOPrefs *p = KOPrefs::instance();
1033 1029
1034 p->mCompactDialogs = true; 1030 p->mCompactDialogs = true;
1035 p->mConfirm = true; 1031 p->mConfirm = true;
1036 // p->mEnableQuickTodo = false; 1032 // p->mEnableQuickTodo = false;
1037 1033
1038} 1034}
1039 1035
1040QString MainWindow::resourcePath() 1036QString MainWindow::resourcePath()
1041{ 1037{
1042 return KGlobal::iconLoader()->iconPath(); 1038 return KGlobal::iconLoader()->iconPath();
1043} 1039}
1044 1040
1045void MainWindow::displayText( QString text ,QString cap ) 1041void MainWindow::displayText( QString text ,QString cap )
1046{ 1042{
1047 QDialog dia( this, "name", true ); ; 1043 QDialog dia( this, "name", true ); ;
1048 dia.setCaption( cap ); 1044 dia.setCaption( cap );
1049 QVBoxLayout* lay = new QVBoxLayout( &dia ); 1045 QVBoxLayout* lay = new QVBoxLayout( &dia );
1050 lay->setSpacing( 3 ); 1046 lay->setSpacing( 3 );
1051 lay->setMargin( 3 ); 1047 lay->setMargin( 3 );
1052 QTextBrowser tb ( &dia ); 1048 QTextBrowser tb ( &dia );
1053 lay->addWidget( &tb ); 1049 lay->addWidget( &tb );
1054 tb.setText( text ); 1050 tb.setText( text );
1055#ifdef DESKTOP_VERSION 1051#ifdef DESKTOP_VERSION
1056 dia.resize( 640, 480); 1052 dia.resize( 640, 480);
1057#else 1053#else
1058 dia.showMaximized(); 1054 dia.showMaximized();
1059#endif 1055#endif
1060 dia.exec(); 1056 dia.exec();
1061} 1057}
1062void MainWindow::displayFile( QString fn, QString cap ) 1058void MainWindow::displayFile( QString fn, QString cap )
1063{ 1059{
1064 QString fileName = resourcePath() + fn; 1060 QString fileName = resourcePath() + fn;
1065 QString text; 1061 QString text;
1066 QFile file( fileName ); 1062 QFile file( fileName );
1067 if (!file.open( IO_ReadOnly ) ) { 1063 if (!file.open( IO_ReadOnly ) ) {
1068 return ; 1064 return ;
1069 1065
1070 } 1066 }
1071 QTextStream ts( &file ); 1067 QTextStream ts( &file );
1072 text = ts.read(); 1068 text = ts.read();
1073 file.close(); 1069 file.close();
1074 displayText( text, cap); 1070 displayText( text, cap);
1075} 1071}
1076void MainWindow::features() 1072void MainWindow::features()
1077{ 1073{
1078 1074
1079 displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") ); 1075 displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") );
1080} 1076}
1081 1077
1082void MainWindow::usertrans() 1078void MainWindow::usertrans()
1083{ 1079{
1084 1080
1085 displayFile( "usertranslationHOWTO.txt",i18n("KO/Pi User translation HowTo") ); 1081 displayFile( "usertranslationHOWTO.txt",i18n("KO/Pi User translation HowTo") );
1086} 1082}
1087 1083
1088void MainWindow::synchowto() 1084void MainWindow::synchowto()
1089{ 1085{
1090#if 0 1086#if 0
1091 QPtrList<Incidence> er = mCalendar->rawIncidences(); 1087 QPtrList<Incidence> er = mCalendar->rawIncidences();
1092 Incidence* inR = er.first(); 1088 Incidence* inR = er.first();
1093 VCalFormat vf; 1089 VCalFormat vf;
1094 QString strout; 1090 QString strout;
1095 while ( inR ) { 1091 while ( inR ) {
1096 if ( inR->type() == "Todo" ) 1092 if ( inR->type() == "Todo" )
1097 strout = vf.todoToString( (Todo *) inR ); 1093 strout = vf.todoToString( (Todo *) inR );
1098 if ( inR->type() == "Event" ) 1094 if ( inR->type() == "Event" )
1099 strout = vf.eventToString( (Event *) inR ); 1095 strout = vf.eventToString( (Event *) inR );
1100 qDebug("incidence: \n%s\n ente\n\n",strout.latin1() ); 1096 qDebug("incidence: \n%s\n ente\n\n",strout.latin1() );
1101 inR = er.next(); 1097 inR = er.next();
1102 } 1098 }
1103#endif 1099#endif
1104 displayFile( "howtoSYNC.txt",i18n("KO/Pi Synchronization HowTo") ); 1100 displayFile( "howtoSYNC.txt",i18n("KO/Pi Synchronization HowTo") );
1105} 1101}
1106void MainWindow::faq() 1102void MainWindow::faq()
1107{ 1103{
1108 displayFile( "kopiFAQ.txt",i18n("KO/Pi FAQ") ); 1104 displayFile( "kopiFAQ.txt",i18n("KO/Pi FAQ") );
1109 1105
1110} 1106}
1111void MainWindow::whatsNew() 1107void MainWindow::whatsNew()
1112{ 1108{
1113 displayFile( "kopiWhatsNew.txt",i18n("KO/Pi Version Info") ); 1109 displayFile( "kopiWhatsNew.txt",i18n("KO/Pi Version Info") );
1114 1110
1115} 1111}
1116void MainWindow::licence() 1112void MainWindow::licence()
1117{ 1113{
1118 KApplication::showLicence(); 1114 KApplication::showLicence();
1119 1115
1120} 1116}
1121void MainWindow::about() 1117void MainWindow::about()
1122{ 1118{
1123 QString version; 1119 QString version;
1124#include <../version> 1120#include <../version>
1125 QMessageBox::about( this, i18n("About KOrganizer/Pi"), 1121 QMessageBox::about( this, i18n("About KOrganizer/Pi"),
1126 i18n("KOrganizer/Platform-independent\n") + 1122 i18n("KOrganizer/Platform-independent\n") +
1127 "(KO/Pi) " + version + " - " + 1123 "(KO/Pi) " + version + " - " +
1128 1124
1129#ifdef DESKTOP_VERSION 1125#ifdef DESKTOP_VERSION
1130 i18n("Desktop Edition\n") + 1126 i18n("Desktop Edition\n") +
1131#else 1127#else
1132 i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") + 1128 i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") +
1133#endif 1129#endif
1134 i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") ); 1130 i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") );
1135} 1131}
1136void MainWindow::keyBindings() 1132void MainWindow::keyBindings()
1137{ 1133{
1138 QString cap = i18n("Key bindings KOrganizer/Pi"); 1134 QString cap = i18n("Key bindings KOrganizer/Pi");
1139 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + 1135 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") +
1140 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ 1136 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+
1141 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + 1137 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") +
1142 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ 1138 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+
1143 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ 1139 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+
1144 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ 1140 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+
1145 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ 1141 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+
1146 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ 1142 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+
1147 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ 1143 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+
1148 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ 1144 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+
1149 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ 1145 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+
1150 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ 1146 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+
1151 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ 1147 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+
1152 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ 1148 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+
1153 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ 1149 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+
1154 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ 1150 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+
1155 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ 1151 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+
1156 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ 1152 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+
1157 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ 1153 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+
1158 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ 1154 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+
1159 i18n("<p><h3>In agenda view:</h3></p>\n") + 1155 i18n("<p><h3>In agenda view:</h3></p>\n") +
1160 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ 1156 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+
1161 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ 1157 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+
1162 i18n("<p><h3>In todo view:</h3></p>\n") + 1158 i18n("<p><h3>In todo view:</h3></p>\n") +
1163 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ 1159 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+
1164 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1160 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1165 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ 1161 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+
1166 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ 1162 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+
1167 i18n("<p><h3>In list view:</h3></p>\n") + 1163 i18n("<p><h3>In list view:</h3></p>\n") +
1168 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1164 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1169 i18n("<p><b>return</b>: Select item+one step down</p>\n")+ 1165 i18n("<p><b>return</b>: Select item+one step down</p>\n")+
1170 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ 1166 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+
1171 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ 1167 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+
1172 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ 1168 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+
1173 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ 1169 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+
1174 i18n("<p><h3>In event/todo viewer:</h3></p>\n") + 1170 i18n("<p><h3>In event/todo viewer:</h3></p>\n") +
1175 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ 1171 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+
1176 i18n("<p><b>A</b>: Show agenda view.</p>\n")+ 1172 i18n("<p><b>A</b>: Show agenda view.</p>\n")+
1177 i18n("<p><b>E</b>: Edit item</p>\n") + 1173 i18n("<p><b>E</b>: Edit item</p>\n") +
1178 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + 1174 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") +
1179 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + 1175 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") +
1180 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ 1176 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+
1181 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ 1177 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+
1182 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ 1178 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+
1183 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ 1179 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+
1184 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ 1180 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+
1185 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + 1181 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") +
1186 i18n("<p><b>White</b>: Item readonly</p>\n"); 1182 i18n("<p><b>White</b>: Item readonly</p>\n");
1187 displayText( text, cap); 1183 displayText( text, cap);
1188 1184
1189} 1185}
1190void MainWindow::aboutAutoSaving() 1186void MainWindow::aboutAutoSaving()
1191{ 1187{
1192 QMessageBox* msg; 1188 QMessageBox* msg;
1193 msg = new QMessageBox( i18n("Auto Saving in KOrganizer/Pi"), 1189 msg = new QMessageBox( i18n("Auto Saving in KOrganizer/Pi"),
1194 i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configureable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"), QMessageBox::NoIcon, 1190 i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configureable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"), QMessageBox::NoIcon,
1195 QMessageBox::Ok, 1191 QMessageBox::Ok,
1196 QMessageBox::NoButton, 1192 QMessageBox::NoButton,
1197 QMessageBox::NoButton); 1193 QMessageBox::NoButton);
1198 msg->exec(); 1194 msg->exec();
1199 delete msg; 1195 delete msg;
1200 1196
1201 1197
1202} 1198}
1203void MainWindow::aboutKnownBugs() 1199void MainWindow::aboutKnownBugs()
1204{ 1200{
1205 QMessageBox* msg; 1201 QMessageBox* msg;
1206 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), 1202 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"),
1207 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ 1203 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+
1208 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ 1204 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+
1209 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + 1205 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") +
1210 i18n("\nor report them in the bugtracker on\n") + 1206 i18n("\nor report them in the bugtracker on\n") +
1211 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), 1207 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"),
1212 QMessageBox::NoIcon, 1208 QMessageBox::NoIcon,
1213 QMessageBox::Ok, 1209 QMessageBox::Ok,
1214 QMessageBox::NoButton, 1210 QMessageBox::NoButton,
1215 QMessageBox::NoButton); 1211 QMessageBox::NoButton);
1216 msg->exec(); 1212 msg->exec();
1217 delete msg; 1213 delete msg;
1218 1214
1219} 1215}
1220 1216
1221QString MainWindow::defaultFileName() 1217QString MainWindow::defaultFileName()
1222{ 1218{
1223 return locateLocal( "data", "korganizer/mycalendar.ics" ); 1219 return locateLocal( "data", "korganizer/mycalendar.ics" );
1224} 1220}
1225QString MainWindow::syncFileName() 1221QString MainWindow::syncFileName()
1226{ 1222{
1227#ifdef _WIN32_ 1223#ifdef _WIN32_
1228 return locateLocal( "tmp", "synccalendar.ics" ); 1224 return locateLocal( "tmp", "synccalendar.ics" );
1229#else 1225#else
1230 return QString( "/tmp/kopitempfile.ics" ); 1226 return QString( "/tmp/kopitempfile.ics" );
1231#endif 1227#endif
1232} 1228}
1233 1229
1234void MainWindow::processIncidenceSelection( Incidence *incidence ) 1230void MainWindow::processIncidenceSelection( Incidence *incidence )
1235{ 1231{
1236 if ( !incidence ) { 1232 if ( !incidence ) {
1237 enableIncidenceActions( false ); 1233 enableIncidenceActions( false );
1238 1234
1239 mNewSubTodoAction->setEnabled( false ); 1235 mNewSubTodoAction->setEnabled( false );
1240 setCaptionToDates(); 1236 setCaptionToDates();
1241 return; 1237 return;
1242 1238
1243 } 1239 }
1244 1240
1245 //KGlobal::locale()->formatDateTime(nextA, true); 1241 //KGlobal::locale()->formatDateTime(nextA, true);
1246 QString startString = ""; 1242 QString startString = "";
1247 if ( incidence->type() != "Todo" ) { 1243 if ( incidence->type() != "Todo" ) {
1248 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1244 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1249 if ( incidence->doesFloat() ) { 1245 if ( incidence->doesFloat() ) {
1250 startString += ": "+incidence->dtStartDateStr( true ); 1246 startString += ": "+incidence->dtStartDateStr( true );
1251 startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); 1247 startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
1252 1248
1253 } else { 1249 } else {
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
15class QAction; 15class QAction;
16class CalendarView; 16class CalendarView;
17class KSyncProfile; 17class 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
23class QPEToolBar; 23class QPEToolBar;
24 24
25 25
26namespace KCal { 26namespace KCal {
27class CalendarLocal; 27class CalendarLocal;
28} 28}
29 29
30using namespace KCal; 30using namespace KCal;
31 31
32class MainWindow : public QMainWindow 32class 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