author | zautrix <zautrix> | 2004-10-06 16:20:25 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-06 16:20:25 (UTC) |
commit | 656636acfb8c607901c97c4f55129e29e1df9913 (patch) (unidiff) | |
tree | 25efd61a6b691822a11f43719efcbf69ce7d5c25 /korganizer | |
parent | a22de800110d8350a5200a994b041e47d51bf4c6 (diff) | |
download | kdepimpi-656636acfb8c607901c97c4f55129e29e1df9913.zip kdepimpi-656636acfb8c607901c97c4f55129e29e1df9913.tar.gz kdepimpi-656636acfb8c607901c97c4f55129e29e1df9913.tar.bz2 |
more fixes
-rw-r--r-- | korganizer/mainwindow.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 2f286e0..ec69b11 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -1,553 +1,554 @@ | |||
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 <libkcal/kincidenceformatter.h> | 43 | #include <libkcal/kincidenceformatter.h> |
43 | #include <libkdepim/kpimglobalprefs.h> | 44 | #include <libkdepim/kpimglobalprefs.h> |
44 | 45 | ||
45 | #include "calendarview.h" | 46 | #include "calendarview.h" |
46 | #include "koviewmanager.h" | 47 | #include "koviewmanager.h" |
47 | #include "datenavigator.h" | 48 | #include "datenavigator.h" |
48 | #include "koagendaview.h" | 49 | #include "koagendaview.h" |
49 | #include "koagenda.h" | 50 | #include "koagenda.h" |
50 | #include "kodialogmanager.h" | 51 | #include "kodialogmanager.h" |
51 | #include "kdialogbase.h" | 52 | #include "kdialogbase.h" |
52 | #include "kapplication.h" | 53 | #include "kapplication.h" |
53 | #include "kofilterview.h" | 54 | #include "kofilterview.h" |
54 | #include "kstandarddirs.h" | 55 | #include "kstandarddirs.h" |
55 | #include "koprefs.h" | 56 | #include "koprefs.h" |
56 | #include "kfiledialog.h" | 57 | #include "kfiledialog.h" |
57 | #include "koglobals.h" | 58 | #include "koglobals.h" |
58 | #include "kglobal.h" | 59 | #include "kglobal.h" |
59 | #include "klocale.h" | 60 | #include "klocale.h" |
60 | #include "kconfig.h" | 61 | #include "kconfig.h" |
61 | #include "simplealarmclient.h" | 62 | #include "simplealarmclient.h" |
62 | #include "externalapphandler.h" | 63 | #include "externalapphandler.h" |
63 | 64 | ||
64 | using namespace KCal; | 65 | using namespace KCal; |
65 | #ifndef _WIN32_ | 66 | #ifndef _WIN32_ |
66 | #include <unistd.h> | 67 | #include <unistd.h> |
67 | #else | 68 | #else |
68 | #include "koimportoldialog.h" | 69 | #include "koimportoldialog.h" |
69 | #endif | 70 | #endif |
70 | #include "mainwindow.h" | 71 | #include "mainwindow.h" |
71 | 72 | ||
72 | class KOex2phonePrefs : public QDialog | 73 | class KOex2phonePrefs : public QDialog |
73 | { | 74 | { |
74 | public: | 75 | public: |
75 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : | 76 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : |
76 | QDialog( parent, name, true ) | 77 | QDialog( parent, name, true ) |
77 | { | 78 | { |
78 | setCaption( i18n("Export to phone options") ); | 79 | setCaption( i18n("Export to phone options") ); |
79 | QVBoxLayout* lay = new QVBoxLayout( this ); | 80 | QVBoxLayout* lay = new QVBoxLayout( this ); |
80 | lay->setSpacing( 3 ); | 81 | lay->setSpacing( 3 ); |
81 | lay->setMargin( 3 ); | 82 | lay->setMargin( 3 ); |
82 | QLabel *lab; | 83 | QLabel *lab; |
83 | 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 ) ); |
84 | lab->setAlignment (AlignHCenter ); | 85 | lab->setAlignment (AlignHCenter ); |
85 | QHBox* temphb; | 86 | QHBox* temphb; |
86 | temphb = new QHBox( this ); | 87 | temphb = new QHBox( this ); |
87 | new QLabel( i18n("I/O device: "), temphb ); | 88 | new QLabel( i18n("I/O device: "), temphb ); |
88 | mPhoneDevice = new QLineEdit( temphb); | 89 | mPhoneDevice = new QLineEdit( temphb); |
89 | lay->addWidget( temphb ); | 90 | lay->addWidget( temphb ); |
90 | temphb = new QHBox( this ); | 91 | temphb = new QHBox( this ); |
91 | new QLabel( i18n("Connection: "), temphb ); | 92 | new QLabel( i18n("Connection: "), temphb ); |
92 | mPhoneConnection = new QLineEdit( temphb); | 93 | mPhoneConnection = new QLineEdit( temphb); |
93 | lay->addWidget( temphb ); | 94 | lay->addWidget( temphb ); |
94 | temphb = new QHBox( this ); | 95 | temphb = new QHBox( this ); |
95 | new QLabel( i18n("Model(opt.): "), temphb ); | 96 | new QLabel( i18n("Model(opt.): "), temphb ); |
96 | mPhoneModel = new QLineEdit( temphb); | 97 | mPhoneModel = new QLineEdit( temphb); |
97 | lay->addWidget( temphb ); | 98 | lay->addWidget( temphb ); |
98 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); | 99 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); |
99 | mWriteBackFuture->setChecked( true ); | 100 | mWriteBackFuture->setChecked( true ); |
100 | lay->addWidget( mWriteBackFuture ); | 101 | lay->addWidget( mWriteBackFuture ); |
101 | temphb = new QHBox( this ); | 102 | temphb = new QHBox( this ); |
102 | new QLabel( i18n("Max. weeks in future: ") , temphb ); | 103 | new QLabel( i18n("Max. weeks in future: ") , temphb ); |
103 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); | 104 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); |
104 | mWriteBackFutureWeeks->setValue( 8 ); | 105 | mWriteBackFutureWeeks->setValue( 8 ); |
105 | lay->addWidget( temphb ); | 106 | lay->addWidget( temphb ); |
106 | 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 ) ); |
107 | lab->setAlignment (AlignHCenter ); | 108 | lab->setAlignment (AlignHCenter ); |
108 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); | 109 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); |
109 | lay->addWidget( ok ); | 110 | lay->addWidget( ok ); |
110 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 111 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
111 | lay->addWidget( cancel ); | 112 | lay->addWidget( cancel ); |
112 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 113 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
113 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 114 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
114 | resize( 220, 240 ); | 115 | resize( 220, 240 ); |
115 | 116 | ||
116 | } | 117 | } |
117 | 118 | ||
118 | public: | 119 | public: |
119 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; | 120 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; |
120 | QCheckBox* mWriteBackFuture; | 121 | QCheckBox* mWriteBackFuture; |
121 | QSpinBox* mWriteBackFutureWeeks; | 122 | QSpinBox* mWriteBackFutureWeeks; |
122 | }; | 123 | }; |
123 | 124 | ||
124 | int globalFlagBlockStartup; | 125 | int globalFlagBlockStartup; |
125 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | 126 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : |
126 | QMainWindow( parent, name ) | 127 | QMainWindow( parent, name ) |
127 | { | 128 | { |
128 | mPassWordPiSync = "abc"; | 129 | mPassWordPiSync = "abc"; |
129 | #ifdef DESKTOP_VERSION | 130 | #ifdef DESKTOP_VERSION |
130 | setFont( QFont("Arial"), 14 ); | 131 | setFont( QFont("Arial"), 14 ); |
131 | #endif | 132 | #endif |
132 | mSyncActionDialog = 0; | 133 | mSyncActionDialog = 0; |
133 | mServerSocket = 0; | 134 | mServerSocket = 0; |
134 | mClosed = false; | 135 | mClosed = false; |
135 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; | 136 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; |
136 | QString confFile = locateLocal("config","korganizerrc"); | 137 | QString confFile = locateLocal("config","korganizerrc"); |
137 | QFileInfo finf ( confFile ); | 138 | QFileInfo finf ( confFile ); |
138 | bool showWarning = !finf.exists(); | 139 | bool showWarning = !finf.exists(); |
139 | setIcon(SmallIcon( "ko24" ) ); | 140 | setIcon(SmallIcon( "ko24" ) ); |
140 | mBlockAtStartup = true; | 141 | mBlockAtStartup = true; |
141 | mFlagKeyPressed = false; | 142 | mFlagKeyPressed = false; |
142 | setCaption("KOrganizer/Pi"); | 143 | setCaption("KOrganizer/Pi"); |
143 | KOPrefs *p = KOPrefs::instance(); | 144 | KOPrefs *p = KOPrefs::instance(); |
144 | KPimGlobalPrefs::instance()->setGlobalConfig(); | 145 | KPimGlobalPrefs::instance()->setGlobalConfig(); |
145 | // if ( QApplication::desktop()->height() > 480 ) { | 146 | // if ( QApplication::desktop()->height() > 480 ) { |
146 | // if ( p->mHourSize == 4 ) | 147 | // if ( p->mHourSize == 4 ) |
147 | // p->mHourSize = 6; | 148 | // p->mHourSize = 6; |
148 | // } | 149 | // } |
149 | if ( p->mHourSize > 18 ) | 150 | if ( p->mHourSize > 18 ) |
150 | p->mHourSize = 18; | 151 | p->mHourSize = 18; |
151 | QMainWindow::ToolBarDock tbd; | 152 | QMainWindow::ToolBarDock tbd; |
152 | if ( p->mToolBarHor ) { | 153 | if ( p->mToolBarHor ) { |
153 | if ( p->mToolBarUp ) | 154 | if ( p->mToolBarUp ) |
154 | tbd = Bottom; | 155 | tbd = Bottom; |
155 | else | 156 | else |
156 | tbd = Top; | 157 | tbd = Top; |
157 | } | 158 | } |
158 | else { | 159 | else { |
159 | if ( p->mToolBarUp ) | 160 | if ( p->mToolBarUp ) |
160 | tbd = Right; | 161 | tbd = Right; |
161 | else | 162 | else |
162 | tbd = Left; | 163 | tbd = Left; |
163 | } | 164 | } |
164 | if ( KOPrefs::instance()->mUseAppColors ) | 165 | if ( KOPrefs::instance()->mUseAppColors ) |
165 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 166 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
166 | globalFlagBlockStartup = 1; | 167 | globalFlagBlockStartup = 1; |
167 | iconToolBar = new QPEToolBar( this ); | 168 | iconToolBar = new QPEToolBar( this ); |
168 | addToolBar (iconToolBar , tbd ); | 169 | addToolBar (iconToolBar , tbd ); |
169 | mBlockSaveFlag = false; | 170 | mBlockSaveFlag = false; |
170 | mCalendarModifiedFlag = false; | 171 | mCalendarModifiedFlag = false; |
171 | 172 | ||
172 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); | 173 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); |
173 | splash->setAlignment ( AlignCenter ); | 174 | splash->setAlignment ( AlignCenter ); |
174 | setCentralWidget( splash ); | 175 | setCentralWidget( splash ); |
175 | #ifndef DESKTOP_VERSION | 176 | #ifndef DESKTOP_VERSION |
176 | showMaximized(); | 177 | showMaximized(); |
177 | #endif | 178 | #endif |
178 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); | 179 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); |
179 | setDefaultPreferences(); | 180 | setDefaultPreferences(); |
180 | mCalendar = new CalendarLocal(); | 181 | mCalendar = new CalendarLocal(); |
181 | mView = new CalendarView( mCalendar, this,"mCalendar " ); | 182 | mView = new CalendarView( mCalendar, this,"mCalendar " ); |
182 | mView->hide(); | 183 | mView->hide(); |
183 | //mView->resize(splash->size() ); | 184 | //mView->resize(splash->size() ); |
184 | initActions(); | 185 | initActions(); |
185 | #ifndef DESKTOP_VERSION | 186 | #ifndef DESKTOP_VERSION |
186 | iconToolBar->show(); | 187 | iconToolBar->show(); |
187 | qApp->processEvents(); | 188 | qApp->processEvents(); |
188 | #endif | 189 | #endif |
189 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); | 190 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); |
190 | int vh = height() ; | 191 | int vh = height() ; |
191 | int vw = width(); | 192 | int vw = width(); |
192 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); | 193 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); |
193 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 194 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
194 | vh -= iconToolBar->height(); | 195 | vh -= iconToolBar->height(); |
195 | } else { | 196 | } else { |
196 | vw -= iconToolBar->height(); | 197 | vw -= iconToolBar->height(); |
197 | } | 198 | } |
198 | //mView->setMaximumSize( splash->size() ); | 199 | //mView->setMaximumSize( splash->size() ); |
199 | //mView->resize( splash->size() ); | 200 | //mView->resize( splash->size() ); |
200 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 201 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
201 | mView->readSettings(); | 202 | mView->readSettings(); |
202 | bool newFile = false; | 203 | bool newFile = false; |
203 | if( !QFile::exists( defaultFileName() ) ) { | 204 | if( !QFile::exists( defaultFileName() ) ) { |
204 | QFileInfo finfo ( defaultFileName() ); | 205 | QFileInfo finfo ( defaultFileName() ); |
205 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); | 206 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); |
206 | qDebug("oldfile %s ", oldFile.latin1()); | 207 | qDebug("oldfile %s ", oldFile.latin1()); |
207 | 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"; | 208 | 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"; |
208 | finfo.setFile( oldFile ); | 209 | finfo.setFile( oldFile ); |
209 | if (finfo.exists() ) { | 210 | if (finfo.exists() ) { |
210 | KMessageBox::information( this, message); | 211 | KMessageBox::information( this, message); |
211 | mView->openCalendar( oldFile ); | 212 | mView->openCalendar( oldFile ); |
212 | qApp->processEvents(); | 213 | qApp->processEvents(); |
213 | } else { | 214 | } else { |
214 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); | 215 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); |
215 | finfo.setFile( oldFile ); | 216 | finfo.setFile( oldFile ); |
216 | if (finfo.exists() ) { | 217 | if (finfo.exists() ) { |
217 | KMessageBox::information( this, message); | 218 | KMessageBox::information( this, message); |
218 | mView->openCalendar( oldFile ); | 219 | mView->openCalendar( oldFile ); |
219 | qApp->processEvents(); | 220 | qApp->processEvents(); |
220 | } | 221 | } |
221 | } | 222 | } |
222 | mView->saveCalendar( defaultFileName() ); | 223 | mView->saveCalendar( defaultFileName() ); |
223 | newFile = true; | 224 | newFile = true; |
224 | } | 225 | } |
225 | 226 | ||
226 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 227 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
227 | mView->openCalendar( defaultFileName() ); | 228 | mView->openCalendar( defaultFileName() ); |
228 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 229 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
229 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); | 230 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); |
230 | 231 | ||
231 | if ( KOPrefs::instance()->mLanguageChanged ) { | 232 | if ( KOPrefs::instance()->mLanguageChanged ) { |
232 | KOPrefs::instance()->setCategoryDefaults(); | 233 | KOPrefs::instance()->setCategoryDefaults(); |
233 | int count = mView->addCategories(); | 234 | int count = mView->addCategories(); |
234 | KOPrefs::instance()->mLanguageChanged = false; | 235 | KOPrefs::instance()->mLanguageChanged = false; |
235 | } | 236 | } |
236 | processIncidenceSelection( 0 ); | 237 | processIncidenceSelection( 0 ); |
237 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), | 238 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), |
238 | SLOT( processIncidenceSelection( Incidence * ) ) ); | 239 | SLOT( processIncidenceSelection( Incidence * ) ) ); |
239 | connect( mView, SIGNAL( modifiedChanged( bool ) ), | 240 | connect( mView, SIGNAL( modifiedChanged( bool ) ), |
240 | SLOT( slotModifiedChanged( bool ) ) ); | 241 | SLOT( slotModifiedChanged( bool ) ) ); |
241 | 242 | ||
242 | 243 | ||
243 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); | 244 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); |
244 | mView->setModified( false ); | 245 | mView->setModified( false ); |
245 | mBlockAtStartup = false; | 246 | mBlockAtStartup = false; |
246 | mView->setModified( false ); | 247 | mView->setModified( false ); |
247 | setCentralWidget( mView ); | 248 | setCentralWidget( mView ); |
248 | globalFlagBlockStartup = 0; | 249 | globalFlagBlockStartup = 0; |
249 | mView->show(); | 250 | mView->show(); |
250 | delete splash; | 251 | delete splash; |
251 | if ( newFile ) | 252 | if ( newFile ) |
252 | mView->updateConfig(); | 253 | mView->updateConfig(); |
253 | // qApp->processEvents(); | 254 | // qApp->processEvents(); |
254 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 255 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
255 | fillSyncMenu(); | 256 | fillSyncMenu(); |
256 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); | 257 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); |
257 | if ( showWarning ) { | 258 | if ( showWarning ) { |
258 | KMessageBox::information( this, | 259 | KMessageBox::information( this, |
259 | "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"); | 260 | "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"); |
260 | qApp->processEvents(); | 261 | qApp->processEvents(); |
261 | mView->dialogManager()->showSyncOptions(); | 262 | mView->dialogManager()->showSyncOptions(); |
262 | } | 263 | } |
263 | 264 | ||
264 | //US listen for result adressed from Ka/Pi | 265 | //US listen for result adressed from Ka/Pi |
265 | #ifndef DESKTOP_VERSION | 266 | #ifndef DESKTOP_VERSION |
266 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 267 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
267 | #endif | 268 | #endif |
268 | } | 269 | } |
269 | MainWindow::~MainWindow() | 270 | MainWindow::~MainWindow() |
270 | { | 271 | { |
271 | //qDebug("MainWindow::~MainWindow() "); | 272 | //qDebug("MainWindow::~MainWindow() "); |
272 | //save toolbar location | 273 | //save toolbar location |
273 | delete mServerSocket; | 274 | delete mServerSocket; |
274 | delete mCalendar; | 275 | delete mCalendar; |
275 | delete KOPrefs::instance(); | 276 | delete KOPrefs::instance(); |
276 | delete KIncidenceFormatter::instance(); | 277 | delete KIncidenceFormatter::instance(); |
277 | 278 | ||
278 | 279 | ||
279 | } | 280 | } |
280 | void MainWindow::showMaximized () | 281 | void MainWindow::showMaximized () |
281 | { | 282 | { |
282 | #ifndef DESKTOP_VERSION | 283 | #ifndef DESKTOP_VERSION |
283 | if ( ! globalFlagBlockStartup ) | 284 | if ( ! globalFlagBlockStartup ) |
284 | if ( mClosed ) | 285 | if ( mClosed ) |
285 | mView->goToday(); | 286 | mView->goToday(); |
286 | #endif | 287 | #endif |
287 | QWidget::showMaximized () ; | 288 | QWidget::showMaximized () ; |
288 | mClosed = false; | 289 | mClosed = false; |
289 | } | 290 | } |
290 | void MainWindow::closeEvent( QCloseEvent* ce ) | 291 | void MainWindow::closeEvent( QCloseEvent* ce ) |
291 | { | 292 | { |
292 | 293 | ||
293 | 294 | ||
294 | 295 | ||
295 | if ( ! KOPrefs::instance()->mAskForQuit ) { | 296 | if ( ! KOPrefs::instance()->mAskForQuit ) { |
296 | saveOnClose(); | 297 | saveOnClose(); |
297 | mClosed = true; | 298 | mClosed = true; |
298 | ce->accept(); | 299 | ce->accept(); |
299 | return; | 300 | return; |
300 | 301 | ||
301 | } | 302 | } |
302 | 303 | ||
303 | switch( QMessageBox::information( this, "KO/Pi", | 304 | switch( QMessageBox::information( this, "KO/Pi", |
304 | i18n("Do you really want\nto close KO/Pi?"), | 305 | i18n("Do you really want\nto close KO/Pi?"), |
305 | i18n("Close"), i18n("No"), | 306 | i18n("Close"), i18n("No"), |
306 | 0, 0 ) ) { | 307 | 0, 0 ) ) { |
307 | case 0: | 308 | case 0: |
308 | saveOnClose(); | 309 | saveOnClose(); |
309 | mClosed = true; | 310 | mClosed = true; |
310 | ce->accept(); | 311 | ce->accept(); |
311 | break; | 312 | break; |
312 | case 1: | 313 | case 1: |
313 | ce->ignore(); | 314 | ce->ignore(); |
314 | break; | 315 | break; |
315 | case 2: | 316 | case 2: |
316 | 317 | ||
317 | default: | 318 | default: |
318 | break; | 319 | break; |
319 | } | 320 | } |
320 | 321 | ||
321 | 322 | ||
322 | } | 323 | } |
323 | 324 | ||
324 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) | 325 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) |
325 | { | 326 | { |
326 | QDataStream stream( data, IO_ReadOnly ); | 327 | QDataStream stream( data, IO_ReadOnly ); |
327 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); | 328 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); |
328 | //QString datamess; | 329 | //QString datamess; |
329 | //qDebug("message "); | 330 | //qDebug("message "); |
330 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); | 331 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); |
331 | 332 | ||
332 | if ( cmsg == "-writeFile" ) { | 333 | if ( cmsg == "-writeFile" ) { |
333 | // I made from the "-writeFile" an "-writeAlarm" | 334 | // I made from the "-writeFile" an "-writeAlarm" |
334 | mView->viewManager()->showWhatsNextView(); | 335 | mView->viewManager()->showWhatsNextView(); |
335 | mCalendar->checkAlarmForIncidence( 0, true); | 336 | mCalendar->checkAlarmForIncidence( 0, true); |
336 | showMaximized(); | 337 | showMaximized(); |
337 | raise(); | 338 | raise(); |
338 | return; | 339 | return; |
339 | } | 340 | } |
340 | 341 | ||
341 | if ( cmsg == "-writeFile" ) { | 342 | if ( cmsg == "-writeFile" ) { |
342 | // I made from the "-writeFile" an "-writeAlarm" | 343 | // I made from the "-writeFile" an "-writeAlarm" |
343 | mView->viewManager()->showWhatsNextView(); | 344 | mView->viewManager()->showWhatsNextView(); |
344 | mCalendar->checkAlarmForIncidence( 0, true); | 345 | mCalendar->checkAlarmForIncidence( 0, true); |
345 | showMaximized(); | 346 | showMaximized(); |
346 | raise(); | 347 | raise(); |
347 | return; | 348 | return; |
348 | 349 | ||
349 | } | 350 | } |
350 | if ( cmsg == "-writeFileSilent" ) { | 351 | if ( cmsg == "-writeFileSilent" ) { |
351 | // I made from the "-writeFile" an "-writeAlarm" | 352 | // I made from the "-writeFile" an "-writeAlarm" |
352 | // mView->viewManager()->showWhatsNextView(); | 353 | // mView->viewManager()->showWhatsNextView(); |
353 | mCalendar->checkAlarmForIncidence( 0, true); | 354 | mCalendar->checkAlarmForIncidence( 0, true); |
354 | //showMaximized(); | 355 | //showMaximized(); |
355 | //raise(); | 356 | //raise(); |
356 | hide(); | 357 | hide(); |
357 | return; | 358 | return; |
358 | } | 359 | } |
359 | if ( cmsg == "-newCountdown" ) { | 360 | if ( cmsg == "-newCountdown" ) { |
360 | qDebug("newCountdown "); | 361 | qDebug("newCountdown "); |
361 | 362 | ||
362 | } | 363 | } |
363 | QString msg ; | 364 | QString msg ; |
364 | QString allmsg = cmsg; | 365 | QString allmsg = cmsg; |
365 | while ( allmsg.length() > 0 ) { | 366 | while ( allmsg.length() > 0 ) { |
366 | int nextC = allmsg.find( "-", 1 ); | 367 | int nextC = allmsg.find( "-", 1 ); |
367 | if ( nextC == -1 ) { | 368 | if ( nextC == -1 ) { |
368 | msg = allmsg; | 369 | msg = allmsg; |
369 | allmsg = ""; | 370 | allmsg = ""; |
370 | } else{ | 371 | } else{ |
371 | msg = allmsg.left( nextC ); | 372 | msg = allmsg.left( nextC ); |
372 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); | 373 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); |
373 | } | 374 | } |
374 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); | 375 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); |
375 | if ( msg == "-newEvent" ) { | 376 | if ( msg == "-newEvent" ) { |
376 | mView->newEvent(); | 377 | mView->newEvent(); |
377 | } | 378 | } |
378 | if ( msg == "-newTodo" ) { | 379 | if ( msg == "-newTodo" ) { |
379 | mView->newTodo(); | 380 | mView->newTodo(); |
380 | 381 | ||
381 | } | 382 | } |
382 | if ( msg == "-showWN" ) { | 383 | if ( msg == "-showWN" ) { |
383 | mView->viewManager()->showWhatsNextView(); | 384 | mView->viewManager()->showWhatsNextView(); |
384 | } | 385 | } |
385 | if ( msg == "-showTodo" ) { | 386 | if ( msg == "-showTodo" ) { |
386 | mView->viewManager()->showTodoView(); | 387 | mView->viewManager()->showTodoView(); |
387 | } | 388 | } |
388 | if ( msg == "-showList" ) { | 389 | if ( msg == "-showList" ) { |
389 | mView->viewManager()->showListView(); | 390 | mView->viewManager()->showListView(); |
390 | } | 391 | } |
391 | else if ( msg == "-showDay" ) { | 392 | else if ( msg == "-showDay" ) { |
392 | mView->viewManager()->showDayView(); | 393 | mView->viewManager()->showDayView(); |
393 | } | 394 | } |
394 | else if ( msg == "-showWWeek" ) { | 395 | else if ( msg == "-showWWeek" ) { |
395 | mView->viewManager()->showWorkWeekView(); | 396 | mView->viewManager()->showWorkWeekView(); |
396 | } | 397 | } |
397 | else if ( msg == "-ringSync" ) { | 398 | else if ( msg == "-ringSync" ) { |
398 | multiSync( false ); | 399 | multiSync( false ); |
399 | } | 400 | } |
400 | else if ( msg == "-showWeek" ) { | 401 | else if ( msg == "-showWeek" ) { |
401 | mView->viewManager()->showWeekView(); | 402 | mView->viewManager()->showWeekView(); |
402 | } | 403 | } |
403 | else if ( msg == "-showTodo" ) { | 404 | else if ( msg == "-showTodo" ) { |
404 | mView->viewManager()->showTodoView(); | 405 | mView->viewManager()->showTodoView(); |
405 | } | 406 | } |
406 | else if ( msg == "-showJournal" ) { | 407 | else if ( msg == "-showJournal" ) { |
407 | mView->dateNavigator()->selectDates( 1 ); | 408 | mView->dateNavigator()->selectDates( 1 ); |
408 | mView->dateNavigator()->selectToday(); | 409 | mView->dateNavigator()->selectToday(); |
409 | mView->viewManager()->showJournalView(); | 410 | mView->viewManager()->showJournalView(); |
410 | } | 411 | } |
411 | else if ( msg == "-showKO" ) { | 412 | else if ( msg == "-showKO" ) { |
412 | mView->viewManager()->showNextXView(); | 413 | mView->viewManager()->showNextXView(); |
413 | } | 414 | } |
414 | else if ( msg == "-showWNext" || msg == "nextView()" ) { | 415 | else if ( msg == "-showWNext" || msg == "nextView()" ) { |
415 | mView->viewManager()->showWhatsNextView(); | 416 | mView->viewManager()->showWhatsNextView(); |
416 | } | 417 | } |
417 | else if ( msg == "-showNextXView" ) { | 418 | else if ( msg == "-showNextXView" ) { |
418 | mView->viewManager()->showNextXView(); | 419 | mView->viewManager()->showNextXView(); |
419 | } | 420 | } |
420 | 421 | ||
421 | 422 | ||
422 | } | 423 | } |
423 | 424 | ||
424 | showMaximized(); | 425 | showMaximized(); |
425 | raise(); | 426 | raise(); |
426 | } | 427 | } |
427 | 428 | ||
428 | QPixmap MainWindow::loadPixmap( QString name ) | 429 | QPixmap MainWindow::loadPixmap( QString name ) |
429 | { | 430 | { |
430 | return SmallIcon( name ); | 431 | return SmallIcon( name ); |
431 | 432 | ||
432 | } | 433 | } |
433 | void MainWindow::initActions() | 434 | void MainWindow::initActions() |
434 | { | 435 | { |
435 | //KOPrefs::instance()->mShowFullMenu | 436 | //KOPrefs::instance()->mShowFullMenu |
436 | iconToolBar->clear(); | 437 | iconToolBar->clear(); |
437 | KOPrefs *p = KOPrefs::instance(); | 438 | KOPrefs *p = KOPrefs::instance(); |
438 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); | 439 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); |
439 | 440 | ||
440 | QPopupMenu *viewMenu = new QPopupMenu( this ); | 441 | QPopupMenu *viewMenu = new QPopupMenu( this ); |
441 | QPopupMenu *actionMenu = new QPopupMenu( this ); | 442 | QPopupMenu *actionMenu = new QPopupMenu( this ); |
442 | QPopupMenu *importMenu = new QPopupMenu( this ); | 443 | QPopupMenu *importMenu = new QPopupMenu( this ); |
443 | selectFilterMenu = new QPopupMenu( this ); | 444 | selectFilterMenu = new QPopupMenu( this ); |
444 | selectFilterMenu->setCheckable( true ); | 445 | selectFilterMenu->setCheckable( true ); |
445 | syncMenu = new QPopupMenu( this ); | 446 | syncMenu = new QPopupMenu( this ); |
446 | configureAgendaMenu = new QPopupMenu( this ); | 447 | configureAgendaMenu = new QPopupMenu( this ); |
447 | configureToolBarMenu = new QPopupMenu( this ); | 448 | configureToolBarMenu = new QPopupMenu( this ); |
448 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 449 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
449 | if ( KOPrefs::instance()->mShowFullMenu ) { | 450 | if ( KOPrefs::instance()->mShowFullMenu ) { |
450 | QMenuBar *menuBar1; | 451 | QMenuBar *menuBar1; |
451 | menuBar1 = menuBar(); | 452 | menuBar1 = menuBar(); |
452 | menuBar1->insertItem( i18n("File"), importMenu ); | 453 | menuBar1->insertItem( i18n("File"), importMenu ); |
453 | menuBar1->insertItem( i18n("View"), viewMenu ); | 454 | menuBar1->insertItem( i18n("View"), viewMenu ); |
454 | menuBar1->insertItem( i18n("Actions"), actionMenu ); | 455 | menuBar1->insertItem( i18n("Actions"), actionMenu ); |
455 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); | 456 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); |
456 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 457 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
457 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 458 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
458 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); | 459 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); |
459 | menuBar1->insertItem( i18n("Help"), helpMenu ); | 460 | menuBar1->insertItem( i18n("Help"), helpMenu ); |
460 | } else { | 461 | } else { |
461 | QPEMenuBar *menuBar1; | 462 | QPEMenuBar *menuBar1; |
462 | menuBar1 = new QPEMenuBar( iconToolBar ); | 463 | menuBar1 = new QPEMenuBar( iconToolBar ); |
463 | QPopupMenu *menuBar = new QPopupMenu( this ); | 464 | QPopupMenu *menuBar = new QPopupMenu( this ); |
464 | menuBar1->insertItem( i18n("ME"), menuBar); | 465 | menuBar1->insertItem( i18n("ME"), menuBar); |
465 | menuBar->insertItem( i18n("File"), importMenu ); | 466 | menuBar->insertItem( i18n("File"), importMenu ); |
466 | menuBar->insertItem( i18n("View"), viewMenu ); | 467 | menuBar->insertItem( i18n("View"), viewMenu ); |
467 | menuBar->insertItem( i18n("Actions"), actionMenu ); | 468 | menuBar->insertItem( i18n("Actions"), actionMenu ); |
468 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); | 469 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); |
469 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 470 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
470 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 471 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
471 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); | 472 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); |
472 | menuBar->insertItem( i18n("Help"), helpMenu ); | 473 | menuBar->insertItem( i18n("Help"), helpMenu ); |
473 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); | 474 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); |
474 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); | 475 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); |
475 | } | 476 | } |
476 | connect ( syncMenu, SIGNAL( activated ( int ) ), this, SLOT (slotSyncMenu( int ) ) ); | 477 | connect ( syncMenu, SIGNAL( activated ( int ) ), this, SLOT (slotSyncMenu( int ) ) ); |
477 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); | 478 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); |
478 | connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) ); | 479 | connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) ); |
479 | 480 | ||
480 | // ****************** | 481 | // ****************** |
481 | QAction *action; | 482 | QAction *action; |
482 | QIconSet icon; | 483 | QIconSet icon; |
483 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); | 484 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); |
484 | configureToolBarMenu->setCheckable( true ); | 485 | configureToolBarMenu->setCheckable( true ); |
485 | 486 | ||
486 | QString pathString = ""; | 487 | QString pathString = ""; |
487 | if ( !p->mToolBarMiniIcons ) { | 488 | if ( !p->mToolBarMiniIcons ) { |
488 | if ( QApplication::desktop()->width() < 480 ) | 489 | if ( QApplication::desktop()->width() < 480 ) |
489 | pathString += "icons16/"; | 490 | pathString += "icons16/"; |
490 | } else | 491 | } else |
491 | pathString += "iconsmini/"; | 492 | pathString += "iconsmini/"; |
492 | configureAgendaMenu->setCheckable( true ); | 493 | configureAgendaMenu->setCheckable( true ); |
493 | configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 ); | 494 | configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 ); |
494 | configureAgendaMenu->insertSeparator(); | 495 | configureAgendaMenu->insertSeparator(); |
495 | configureAgendaMenu->insertItem(i18n("Tiny"), 4 ); | 496 | configureAgendaMenu->insertItem(i18n("Tiny"), 4 ); |
496 | configureAgendaMenu->insertItem(i18n("Small"), 6 ); | 497 | configureAgendaMenu->insertItem(i18n("Small"), 6 ); |
497 | configureAgendaMenu->insertItem(i18n("Medium"), 8 ); | 498 | configureAgendaMenu->insertItem(i18n("Medium"), 8 ); |
498 | configureAgendaMenu->insertItem(i18n("Normal"), 10 ); | 499 | configureAgendaMenu->insertItem(i18n("Normal"), 10 ); |
499 | configureAgendaMenu->insertItem(i18n("Large"), 12 ); | 500 | configureAgendaMenu->insertItem(i18n("Large"), 12 ); |
500 | configureAgendaMenu->insertItem(i18n("Big"), 14 ); | 501 | configureAgendaMenu->insertItem(i18n("Big"), 14 ); |
501 | configureAgendaMenu->insertItem(i18n("Bigger"), 16 ); | 502 | configureAgendaMenu->insertItem(i18n("Bigger"), 16 ); |
502 | configureAgendaMenu->insertItem(i18n("Biggest"), 18 ); | 503 | configureAgendaMenu->insertItem(i18n("Biggest"), 18 ); |
503 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); | 504 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); |
504 | 505 | ||
505 | icon = loadPixmap( pathString + "configure" ); | 506 | icon = loadPixmap( pathString + "configure" ); |
506 | action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); | 507 | action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); |
507 | action->addTo( actionMenu ); | 508 | action->addTo( actionMenu ); |
508 | connect( action, SIGNAL( activated() ), | 509 | connect( action, SIGNAL( activated() ), |
509 | mView, SLOT( edit_options() ) ); | 510 | mView, SLOT( edit_options() ) ); |
510 | actionMenu->insertSeparator(); | 511 | actionMenu->insertSeparator(); |
511 | icon = loadPixmap( pathString + "newevent" ); | 512 | icon = loadPixmap( pathString + "newevent" ); |
512 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); | 513 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); |
513 | configureToolBarMenu->insertSeparator(); | 514 | configureToolBarMenu->insertSeparator(); |
514 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); | 515 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); |
515 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); | 516 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); |
516 | ne_action->addTo( actionMenu ); | 517 | ne_action->addTo( actionMenu ); |
517 | connect( ne_action, SIGNAL( activated() ), | 518 | connect( ne_action, SIGNAL( activated() ), |
518 | mView, SLOT( newEvent() ) ); | 519 | mView, SLOT( newEvent() ) ); |
519 | icon = loadPixmap( pathString + "newtodo" ); | 520 | icon = loadPixmap( pathString + "newtodo" ); |
520 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); | 521 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); |
521 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); | 522 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); |
522 | nt_action->addTo( actionMenu ); | 523 | nt_action->addTo( actionMenu ); |
523 | connect( nt_action, SIGNAL( activated() ), | 524 | connect( nt_action, SIGNAL( activated() ), |
524 | mView, SLOT( newTodo() ) ); | 525 | mView, SLOT( newTodo() ) ); |
525 | icon = loadPixmap( pathString + "navi" ); | 526 | icon = loadPixmap( pathString + "navi" ); |
526 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); | 527 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); |
527 | action->addTo( viewMenu ); | 528 | action->addTo( viewMenu ); |
528 | connect( action, SIGNAL( activated() ), | 529 | connect( action, SIGNAL( activated() ), |
529 | mView, SLOT( toggleDateNavigatorWidget() ) ); | 530 | mView, SLOT( toggleDateNavigatorWidget() ) ); |
530 | icon = loadPixmap( pathString + "filter" ); | 531 | icon = loadPixmap( pathString + "filter" ); |
531 | action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); | 532 | action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); |
532 | action->addTo( viewMenu ); | 533 | action->addTo( viewMenu ); |
533 | connect( action, SIGNAL( activated() ), | 534 | connect( action, SIGNAL( activated() ), |
534 | mView, SLOT( toggleFilter() ) ); | 535 | mView, SLOT( toggleFilter() ) ); |
535 | 536 | ||
536 | 537 | ||
537 | viewMenu->insertSeparator(); | 538 | viewMenu->insertSeparator(); |
538 | icon = loadPixmap( pathString + "picker" ); | 539 | icon = loadPixmap( pathString + "picker" ); |
539 | action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); | 540 | action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); |
540 | action->addTo( viewMenu ); | 541 | action->addTo( viewMenu ); |
541 | connect( action, SIGNAL( activated() ), | 542 | connect( action, SIGNAL( activated() ), |
542 | mView, SLOT( showDatePicker() ) ); | 543 | mView, SLOT( showDatePicker() ) ); |
543 | action->addTo( iconToolBar ); | 544 | action->addTo( iconToolBar ); |
544 | viewMenu->insertSeparator(); | 545 | viewMenu->insertSeparator(); |
545 | icon = loadPixmap( pathString + "list" ); | 546 | icon = loadPixmap( pathString + "list" ); |
546 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); | 547 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); |
547 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); | 548 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); |
548 | showlist_action->addTo( viewMenu ); | 549 | showlist_action->addTo( viewMenu ); |
549 | connect( showlist_action, SIGNAL( activated() ), | 550 | connect( showlist_action, SIGNAL( activated() ), |
550 | mView->viewManager(), SLOT( showListView() ) ); | 551 | mView->viewManager(), SLOT( showListView() ) ); |
551 | 552 | ||
552 | 553 | ||
553 | icon = loadPixmap( pathString + "day" ); | 554 | icon = loadPixmap( pathString + "day" ); |
@@ -723,1026 +724,1026 @@ void MainWindow::initActions() | |||
723 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); | 724 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); |
724 | 725 | ||
725 | importMenu->insertSeparator(); | 726 | importMenu->insertSeparator(); |
726 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, | 727 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, |
727 | this ); | 728 | this ); |
728 | action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); | 729 | action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); |
729 | 730 | ||
730 | 731 | ||
731 | //LR | 732 | //LR |
732 | QPopupMenu *ex2phone = new QPopupMenu( this ); | 733 | QPopupMenu *ex2phone = new QPopupMenu( this ); |
733 | ex2phone->insertItem(i18n("Complete calendar..."), 1 ); | 734 | ex2phone->insertItem(i18n("Complete calendar..."), 1 ); |
734 | ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); | 735 | ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); |
735 | connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); | 736 | connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); |
736 | importMenu->insertItem( i18n("Export to phone"), ex2phone ); | 737 | importMenu->insertItem( i18n("Export to phone"), ex2phone ); |
737 | 738 | ||
738 | importMenu->insertSeparator(); | 739 | importMenu->insertSeparator(); |
739 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, | 740 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, |
740 | this ); | 741 | this ); |
741 | action->addTo( importMenu ); | 742 | action->addTo( importMenu ); |
742 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); | 743 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); |
743 | #ifndef DESKTOP_VERSION | 744 | #ifndef DESKTOP_VERSION |
744 | importMenu->insertSeparator(); | 745 | importMenu->insertSeparator(); |
745 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, | 746 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, |
746 | this ); | 747 | this ); |
747 | action->addTo( importMenu ); | 748 | action->addTo( importMenu ); |
748 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); | 749 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); |
749 | 750 | ||
750 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, | 751 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, |
751 | this ); | 752 | this ); |
752 | action->addTo( importMenu ); | 753 | action->addTo( importMenu ); |
753 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); | 754 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); |
754 | #else | 755 | #else |
755 | importMenu->insertSeparator(); | 756 | importMenu->insertSeparator(); |
756 | icon = loadPixmap( pathString + "print" ); | 757 | icon = loadPixmap( pathString + "print" ); |
757 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); | 758 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); |
758 | action->addTo( importMenu ); | 759 | action->addTo( importMenu ); |
759 | connect( action, SIGNAL( activated() ), | 760 | connect( action, SIGNAL( activated() ), |
760 | this, SLOT( printCal() ) ); | 761 | this, SLOT( printCal() ) ); |
761 | 762 | ||
762 | icon = loadPixmap( pathString + "print" ); | 763 | icon = loadPixmap( pathString + "print" ); |
763 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); | 764 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); |
764 | action->addTo( importMenu ); | 765 | action->addTo( importMenu ); |
765 | connect( action, SIGNAL( activated() ), | 766 | connect( action, SIGNAL( activated() ), |
766 | this, SLOT( printSel() ) ); | 767 | this, SLOT( printSel() ) ); |
767 | #endif | 768 | #endif |
768 | importMenu->insertSeparator(); | 769 | importMenu->insertSeparator(); |
769 | action = new QAction( "beam all", i18n("Save"), 0, | 770 | action = new QAction( "beam all", i18n("Save"), 0, |
770 | this ); | 771 | this ); |
771 | action->addTo( importMenu ); | 772 | action->addTo( importMenu ); |
772 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); | 773 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); |
773 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, | 774 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, |
774 | this ); | 775 | this ); |
775 | action->addTo( importMenu ); | 776 | action->addTo( importMenu ); |
776 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); | 777 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); |
777 | 778 | ||
778 | //menuBar->insertItem( "Configure",configureMenu ); | 779 | //menuBar->insertItem( "Configure",configureMenu ); |
779 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); | 780 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); |
780 | icon = loadPixmap( "korganizer/korganizer" ); | 781 | icon = loadPixmap( "korganizer/korganizer" ); |
781 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); | 782 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); |
782 | action->addTo( helpMenu ); | 783 | action->addTo( helpMenu ); |
783 | connect( action, SIGNAL( activated() ), | 784 | connect( action, SIGNAL( activated() ), |
784 | SLOT( keyBindings() ) ); | 785 | SLOT( keyBindings() ) ); |
785 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); | 786 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); |
786 | action->addTo( helpMenu ); | 787 | action->addTo( helpMenu ); |
787 | connect( action, SIGNAL( activated() ), | 788 | connect( action, SIGNAL( activated() ), |
788 | SLOT( features() ) ); | 789 | SLOT( features() ) ); |
789 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); | 790 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); |
790 | action->addTo( helpMenu ); | 791 | action->addTo( helpMenu ); |
791 | connect( action, SIGNAL( activated() ), | 792 | connect( action, SIGNAL( activated() ), |
792 | SLOT( aboutAutoSaving() ) ); | 793 | SLOT( aboutAutoSaving() ) ); |
793 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); | 794 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); |
794 | action->addTo( helpMenu ); | 795 | action->addTo( helpMenu ); |
795 | connect( action, SIGNAL( activated() ), | 796 | connect( action, SIGNAL( activated() ), |
796 | SLOT( aboutKnownBugs() ) ); | 797 | SLOT( aboutKnownBugs() ) ); |
797 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); | 798 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); |
798 | action->addTo( helpMenu ); | 799 | action->addTo( helpMenu ); |
799 | connect( action, SIGNAL( activated() ), | 800 | connect( action, SIGNAL( activated() ), |
800 | SLOT( usertrans() ) ); | 801 | SLOT( usertrans() ) ); |
801 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); | 802 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); |
802 | action->addTo( helpMenu ); | 803 | action->addTo( helpMenu ); |
803 | connect( action, SIGNAL( activated() ), | 804 | connect( action, SIGNAL( activated() ), |
804 | SLOT( synchowto() ) ); | 805 | SLOT( synchowto() ) ); |
805 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); | 806 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); |
806 | action->addTo( helpMenu ); | 807 | action->addTo( helpMenu ); |
807 | connect( action, SIGNAL( activated() ), | 808 | connect( action, SIGNAL( activated() ), |
808 | SLOT( whatsNew() ) ); | 809 | SLOT( whatsNew() ) ); |
809 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); | 810 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); |
810 | action->addTo( helpMenu ); | 811 | action->addTo( helpMenu ); |
811 | connect( action, SIGNAL( activated() ), | 812 | connect( action, SIGNAL( activated() ), |
812 | SLOT( faq() ) ); | 813 | SLOT( faq() ) ); |
813 | 814 | ||
814 | 815 | ||
815 | action = new QAction( "about", i18n("About..."), 0, this ); | 816 | action = new QAction( "about", i18n("About..."), 0, this ); |
816 | action->addTo( helpMenu ); | 817 | action->addTo( helpMenu ); |
817 | connect( action, SIGNAL( activated() ), | 818 | connect( action, SIGNAL( activated() ), |
818 | SLOT( about() ) ); | 819 | SLOT( about() ) ); |
819 | action = new QAction( "licence", i18n("Licence..."), 0, this ); | 820 | action = new QAction( "licence", i18n("Licence..."), 0, this ); |
820 | action->addTo( helpMenu ); | 821 | action->addTo( helpMenu ); |
821 | connect( action, SIGNAL( activated() ), | 822 | connect( action, SIGNAL( activated() ), |
822 | SLOT( licence() ) ); | 823 | SLOT( licence() ) ); |
823 | //menuBar->insertSeparator(); | 824 | //menuBar->insertSeparator(); |
824 | 825 | ||
825 | // ****************************************************** | 826 | // ****************************************************** |
826 | // menubar icons | 827 | // menubar icons |
827 | 828 | ||
828 | 829 | ||
829 | iconToolBar->setHorizontalStretchable (true ); | 830 | iconToolBar->setHorizontalStretchable (true ); |
830 | //menuBar->insertItem( iconToolBar ); | 831 | //menuBar->insertItem( iconToolBar ); |
831 | //xdays_action | 832 | //xdays_action |
832 | if (p-> mShowIconNewEvent) | 833 | if (p-> mShowIconNewEvent) |
833 | ne_action->addTo( iconToolBar ); | 834 | ne_action->addTo( iconToolBar ); |
834 | if (p->mShowIconNewTodo ) | 835 | if (p->mShowIconNewTodo ) |
835 | nt_action->addTo( iconToolBar ); | 836 | nt_action->addTo( iconToolBar ); |
836 | if (p-> mShowIconSearch) | 837 | if (p-> mShowIconSearch) |
837 | search_action->addTo( iconToolBar ); | 838 | search_action->addTo( iconToolBar ); |
838 | if (p-> mShowIconNext) | 839 | if (p-> mShowIconNext) |
839 | whatsnext_action->addTo( iconToolBar ); | 840 | whatsnext_action->addTo( iconToolBar ); |
840 | if (p-> mShowIconNextDays) | 841 | if (p-> mShowIconNextDays) |
841 | xdays_action->addTo( iconToolBar ); | 842 | xdays_action->addTo( iconToolBar ); |
842 | if (p-> mShowIconList) | 843 | if (p-> mShowIconList) |
843 | showlist_action->addTo( iconToolBar ); | 844 | showlist_action->addTo( iconToolBar ); |
844 | if (p-> mShowIconDay1) | 845 | if (p-> mShowIconDay1) |
845 | day1_action->addTo( iconToolBar ); | 846 | day1_action->addTo( iconToolBar ); |
846 | if (p-> mShowIconDay5) | 847 | if (p-> mShowIconDay5) |
847 | day5_action->addTo( iconToolBar ); | 848 | day5_action->addTo( iconToolBar ); |
848 | if (p-> mShowIconDay7) | 849 | if (p-> mShowIconDay7) |
849 | day7_action->addTo( iconToolBar ); | 850 | day7_action->addTo( iconToolBar ); |
850 | if (p-> mShowIconMonth) | 851 | if (p-> mShowIconMonth) |
851 | month_action->addTo( iconToolBar ); | 852 | month_action->addTo( iconToolBar ); |
852 | if (p-> mShowIconTodoview) | 853 | if (p-> mShowIconTodoview) |
853 | todoview_action->addTo( iconToolBar ); | 854 | todoview_action->addTo( iconToolBar ); |
854 | if (p-> mShowIconJournal) | 855 | if (p-> mShowIconJournal) |
855 | viewjournal_action->addTo( iconToolBar ); | 856 | viewjournal_action->addTo( iconToolBar ); |
856 | icon = loadPixmap( pathString + "2leftarrowB" ); | 857 | icon = loadPixmap( pathString + "2leftarrowB" ); |
857 | configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); | 858 | configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); |
858 | if (p-> mShowIconBackFast) { | 859 | if (p-> mShowIconBackFast) { |
859 | action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); | 860 | action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); |
860 | connect( action, SIGNAL( activated() ), | 861 | connect( action, SIGNAL( activated() ), |
861 | mView, SLOT( goPreviousMonth() ) ); | 862 | mView, SLOT( goPreviousMonth() ) ); |
862 | action->addTo( iconToolBar ); | 863 | action->addTo( iconToolBar ); |
863 | } | 864 | } |
864 | icon = loadPixmap( pathString + "1leftarrowB" ); | 865 | icon = loadPixmap( pathString + "1leftarrowB" ); |
865 | configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); | 866 | configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); |
866 | if (p-> mShowIconBack) { | 867 | if (p-> mShowIconBack) { |
867 | action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); | 868 | action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); |
868 | connect( action, SIGNAL( activated() ), | 869 | connect( action, SIGNAL( activated() ), |
869 | mView, SLOT( goPrevious() ) ); | 870 | mView, SLOT( goPrevious() ) ); |
870 | action->addTo( iconToolBar ); | 871 | action->addTo( iconToolBar ); |
871 | } | 872 | } |
872 | if (p-> mShowIconToday) | 873 | if (p-> mShowIconToday) |
873 | today_action->addTo( iconToolBar ); | 874 | today_action->addTo( iconToolBar ); |
874 | icon = loadPixmap( pathString + "1rightarrowB" ); | 875 | icon = loadPixmap( pathString + "1rightarrowB" ); |
875 | configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); | 876 | configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); |
876 | if (p-> mShowIconForward) { | 877 | if (p-> mShowIconForward) { |
877 | action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); | 878 | action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); |
878 | connect( action, SIGNAL( activated() ), | 879 | connect( action, SIGNAL( activated() ), |
879 | mView, SLOT( goNext() ) ); | 880 | mView, SLOT( goNext() ) ); |
880 | action->addTo( iconToolBar ); | 881 | action->addTo( iconToolBar ); |
881 | } | 882 | } |
882 | icon = loadPixmap( pathString + "2rightarrowB" ); | 883 | icon = loadPixmap( pathString + "2rightarrowB" ); |
883 | configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); | 884 | configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); |
884 | if (p-> mShowIconForwardFast) { | 885 | if (p-> mShowIconForwardFast) { |
885 | action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); | 886 | action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); |
886 | connect( action, SIGNAL( activated() ), | 887 | connect( action, SIGNAL( activated() ), |
887 | mView, SLOT( goNextMonth() ) ); | 888 | mView, SLOT( goNextMonth() ) ); |
888 | action->addTo( iconToolBar ); | 889 | action->addTo( iconToolBar ); |
889 | } | 890 | } |
890 | 891 | ||
891 | 892 | ||
892 | configureToolBarMenu->insertItem(i18n("What's This?"), 300); | 893 | configureToolBarMenu->insertItem(i18n("What's This?"), 300); |
893 | 894 | ||
894 | if (p-> mShowIconNewEvent) | 895 | if (p-> mShowIconNewEvent) |
895 | configureToolBarMenu->setItemChecked( 10, true ); | 896 | configureToolBarMenu->setItemChecked( 10, true ); |
896 | if (p->mShowIconNewTodo ) | 897 | if (p->mShowIconNewTodo ) |
897 | configureToolBarMenu->setItemChecked( 20, true ); | 898 | configureToolBarMenu->setItemChecked( 20, true ); |
898 | if (p-> mShowIconSearch) | 899 | if (p-> mShowIconSearch) |
899 | configureToolBarMenu->setItemChecked( 120, true ); | 900 | configureToolBarMenu->setItemChecked( 120, true ); |
900 | if (p-> mShowIconList) | 901 | if (p-> mShowIconList) |
901 | configureToolBarMenu->setItemChecked( 30, true ); | 902 | configureToolBarMenu->setItemChecked( 30, true ); |
902 | if (p-> mShowIconDay1) | 903 | if (p-> mShowIconDay1) |
903 | configureToolBarMenu->setItemChecked( 40, true ); | 904 | configureToolBarMenu->setItemChecked( 40, true ); |
904 | if (p-> mShowIconDay5) | 905 | if (p-> mShowIconDay5) |
905 | configureToolBarMenu->setItemChecked( 50, true ); | 906 | configureToolBarMenu->setItemChecked( 50, true ); |
906 | if (p-> mShowIconDay7) | 907 | if (p-> mShowIconDay7) |
907 | configureToolBarMenu->setItemChecked( 60, true ); | 908 | configureToolBarMenu->setItemChecked( 60, true ); |
908 | if (p-> mShowIconMonth) | 909 | if (p-> mShowIconMonth) |
909 | configureToolBarMenu->setItemChecked( 70, true ); | 910 | configureToolBarMenu->setItemChecked( 70, true ); |
910 | if (p-> mShowIconTodoview) | 911 | if (p-> mShowIconTodoview) |
911 | configureToolBarMenu->setItemChecked( 80, true ); | 912 | configureToolBarMenu->setItemChecked( 80, true ); |
912 | if (p-> mShowIconBackFast) | 913 | if (p-> mShowIconBackFast) |
913 | configureToolBarMenu->setItemChecked( 200, true ); | 914 | configureToolBarMenu->setItemChecked( 200, true ); |
914 | if (p-> mShowIconBack) | 915 | if (p-> mShowIconBack) |
915 | configureToolBarMenu->setItemChecked( 210, true ); | 916 | configureToolBarMenu->setItemChecked( 210, true ); |
916 | if (p-> mShowIconToday) | 917 | if (p-> mShowIconToday) |
917 | configureToolBarMenu->setItemChecked( 130, true ); | 918 | configureToolBarMenu->setItemChecked( 130, true ); |
918 | if (p-> mShowIconForward) | 919 | if (p-> mShowIconForward) |
919 | configureToolBarMenu->setItemChecked( 220, true ); | 920 | configureToolBarMenu->setItemChecked( 220, true ); |
920 | if (p-> mShowIconForwardFast) | 921 | if (p-> mShowIconForwardFast) |
921 | configureToolBarMenu->setItemChecked( 230, true ); | 922 | configureToolBarMenu->setItemChecked( 230, true ); |
922 | if (p-> mShowIconNextDays) | 923 | if (p-> mShowIconNextDays) |
923 | configureToolBarMenu->setItemChecked( 100, true ); | 924 | configureToolBarMenu->setItemChecked( 100, true ); |
924 | if (p-> mShowIconNext) | 925 | if (p-> mShowIconNext) |
925 | configureToolBarMenu->setItemChecked( 110, true ); | 926 | configureToolBarMenu->setItemChecked( 110, true ); |
926 | if (p-> mShowIconJournal) | 927 | if (p-> mShowIconJournal) |
927 | configureToolBarMenu->setItemChecked( 90, true ); | 928 | configureToolBarMenu->setItemChecked( 90, true ); |
928 | if (p-> mShowIconWhatsThis) | 929 | if (p-> mShowIconWhatsThis) |
929 | configureToolBarMenu->setItemChecked( 300, true ); | 930 | configureToolBarMenu->setItemChecked( 300, true ); |
930 | 931 | ||
931 | QLabel* dummy = new QLabel( iconToolBar ); | 932 | QLabel* dummy = new QLabel( iconToolBar ); |
932 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); | 933 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); |
933 | if (!p-> mShowIconStretch) | 934 | if (!p-> mShowIconStretch) |
934 | iconToolBar->setStretchableWidget ( dummy ) ; | 935 | iconToolBar->setStretchableWidget ( dummy ) ; |
935 | else | 936 | else |
936 | configureToolBarMenu->setItemChecked( 5, true ); | 937 | configureToolBarMenu->setItemChecked( 5, true ); |
937 | if (p-> mShowIconWhatsThis) | 938 | if (p-> mShowIconWhatsThis) |
938 | QWhatsThis::whatsThisButton ( iconToolBar ); | 939 | QWhatsThis::whatsThisButton ( iconToolBar ); |
939 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); | 940 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); |
940 | configureAgenda( p->mHourSize ); | 941 | configureAgenda( p->mHourSize ); |
941 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); | 942 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); |
942 | } | 943 | } |
943 | void MainWindow::fillSyncMenu() | 944 | void MainWindow::fillSyncMenu() |
944 | { | 945 | { |
945 | if ( syncMenu->count() ) | 946 | if ( syncMenu->count() ) |
946 | syncMenu->clear(); | 947 | syncMenu->clear(); |
947 | syncMenu->insertItem( i18n("Configure..."), 0 ); | 948 | syncMenu->insertItem( i18n("Configure..."), 0 ); |
948 | syncMenu->insertSeparator(); | 949 | syncMenu->insertSeparator(); |
949 | if ( mServerSocket == 0 ) { | 950 | if ( mServerSocket == 0 ) { |
950 | syncMenu->insertItem( i18n("Enable Pi-Sync"), 2 ); | 951 | syncMenu->insertItem( i18n("Enable Pi-Sync"), 2 ); |
951 | } else { | 952 | } else { |
952 | syncMenu->insertItem( i18n("Disable Pi-Sync"), 3 ); | 953 | syncMenu->insertItem( i18n("Disable Pi-Sync"), 3 ); |
953 | } | 954 | } |
954 | syncMenu->insertSeparator(); | 955 | syncMenu->insertSeparator(); |
955 | syncMenu->insertItem( i18n("Multiple sync"), 1 ); | 956 | syncMenu->insertItem( i18n("Multiple sync"), 1 ); |
956 | syncMenu->insertSeparator(); | 957 | syncMenu->insertSeparator(); |
957 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); | 958 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); |
958 | config.setGroup("General"); | 959 | config.setGroup("General"); |
959 | QStringList prof = config.readListEntry("SyncProfileNames"); | 960 | QStringList prof = config.readListEntry("SyncProfileNames"); |
960 | KOPrefs::instance()->mLocalMachineName = config.readEntry("LocalMachineName","undefined"); | 961 | KOPrefs::instance()->mLocalMachineName = config.readEntry("LocalMachineName","undefined"); |
961 | if ( prof.count() < 3 ) { | 962 | if ( prof.count() < 3 ) { |
962 | prof.clear(); | 963 | prof.clear(); |
963 | prof << i18n("Sharp_DTM"); | 964 | prof << i18n("Sharp_DTM"); |
964 | prof << i18n("Local_file"); | 965 | prof << i18n("Local_file"); |
965 | prof << i18n("Last_file"); | 966 | prof << i18n("Last_file"); |
966 | KSyncProfile* temp = new KSyncProfile (); | 967 | KSyncProfile* temp = new KSyncProfile (); |
967 | temp->setName( prof[0] ); | 968 | temp->setName( prof[0] ); |
968 | temp->writeConfig(&config); | 969 | temp->writeConfig(&config); |
969 | temp->setName( prof[1] ); | 970 | temp->setName( prof[1] ); |
970 | temp->writeConfig(&config); | 971 | temp->writeConfig(&config); |
971 | temp->setName( prof[2] ); | 972 | temp->setName( prof[2] ); |
972 | temp->writeConfig(&config); | 973 | temp->writeConfig(&config); |
973 | config.setGroup("General"); | 974 | config.setGroup("General"); |
974 | config.writeEntry("SyncProfileNames",prof); | 975 | config.writeEntry("SyncProfileNames",prof); |
975 | config.writeEntry("ExternSyncProfiles","Sharp_DTM"); | 976 | config.writeEntry("ExternSyncProfiles","Sharp_DTM"); |
976 | config.sync(); | 977 | config.sync(); |
977 | delete temp; | 978 | delete temp; |
978 | } | 979 | } |
979 | KOPrefs::instance()->mExternSyncProfiles = config.readListEntry("ExternSyncProfiles"); | 980 | KOPrefs::instance()->mExternSyncProfiles = config.readListEntry("ExternSyncProfiles"); |
980 | KOPrefs::instance()->mSyncProfileNames = prof; | 981 | KOPrefs::instance()->mSyncProfileNames = prof; |
981 | int i; | 982 | int i; |
982 | for ( i = 0; i < prof.count(); ++i ) { | 983 | for ( i = 0; i < prof.count(); ++i ) { |
983 | 984 | ||
984 | syncMenu->insertItem( prof[i], 1000+i ); | 985 | syncMenu->insertItem( prof[i], 1000+i ); |
985 | if ( i == 2 ) | 986 | if ( i == 2 ) |
986 | syncMenu->insertSeparator(); | 987 | syncMenu->insertSeparator(); |
987 | } | 988 | } |
988 | QDir app_dir; | 989 | QDir app_dir; |
989 | if ( !app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) { | 990 | if ( !app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) { |
990 | syncMenu->setItemEnabled( false , 1000 ); | 991 | syncMenu->setItemEnabled( false , 1000 ); |
991 | } | 992 | } |
992 | mView->setupExternSyncProfiles(); | 993 | mView->setupExternSyncProfiles(); |
993 | } | 994 | } |
994 | 995 | ||
995 | int MainWindow::ringSync() | 996 | int MainWindow::ringSync() |
996 | { | 997 | { |
997 | int syncedProfiles = 0; | 998 | int syncedProfiles = 0; |
998 | int i; | 999 | int i; |
999 | QTime timer; | 1000 | QTime timer; |
1000 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); | 1001 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); |
1001 | QStringList syncProfileNames = KOPrefs::instance()->mSyncProfileNames; | 1002 | QStringList syncProfileNames = KOPrefs::instance()->mSyncProfileNames; |
1002 | KSyncProfile* temp = new KSyncProfile (); | 1003 | KSyncProfile* temp = new KSyncProfile (); |
1003 | KOPrefs::instance()->mAskForPreferences = false; | 1004 | KOPrefs::instance()->mAskForPreferences = false; |
1004 | for ( i = 0; i < syncProfileNames.count(); ++i ) { | 1005 | for ( i = 0; i < syncProfileNames.count(); ++i ) { |
1005 | mCurrentSyncProfile = i; | 1006 | mCurrentSyncProfile = i; |
1006 | temp->setName(syncProfileNames[mCurrentSyncProfile]); | 1007 | temp->setName(syncProfileNames[mCurrentSyncProfile]); |
1007 | temp->readConfig(&config); | 1008 | temp->readConfig(&config); |
1008 | if ( temp->getIncludeInRingSync() && ( i < 1 || i > 2 )) { | 1009 | if ( temp->getIncludeInRingSync() && ( i < 1 || i > 2 )) { |
1009 | setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); | 1010 | setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); |
1010 | ++syncedProfiles; | 1011 | ++syncedProfiles; |
1011 | // KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); | 1012 | // KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); |
1012 | KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); | 1013 | KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); |
1013 | KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); | 1014 | KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); |
1014 | KOPrefs::instance()->mWriteBackInFuture = 0; | 1015 | KOPrefs::instance()->mWriteBackInFuture = 0; |
1015 | if ( temp->getWriteBackFuture() ) | 1016 | if ( temp->getWriteBackFuture() ) |
1016 | KOPrefs::instance()->mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); | 1017 | KOPrefs::instance()->mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); |
1017 | KOPrefs::instance()->mShowSyncSummary = false; | 1018 | KOPrefs::instance()->mShowSyncSummary = false; |
1018 | mView->setSyncDevice(syncProfileNames[i] ); | 1019 | mView->setSyncDevice(syncProfileNames[i] ); |
1019 | mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); | 1020 | mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); |
1020 | if ( i == 0 ) { | 1021 | if ( i == 0 ) { |
1021 | syncSharp(); | 1022 | syncSharp(); |
1022 | } else { | 1023 | } else { |
1023 | if ( temp->getIsLocalFileSync() ) { | 1024 | if ( temp->getIsLocalFileSync() ) { |
1024 | if ( syncWithFile( temp->getRemoteFileName( ), true ) ) | 1025 | if ( syncWithFile( temp->getRemoteFileName( ), true ) ) |
1025 | KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); | 1026 | KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); |
1026 | } else { | 1027 | } else { |
1027 | if ( temp->getIsPhoneSync() ) { | 1028 | if ( temp->getIsPhoneSync() ) { |
1028 | KOPrefs::instance()->mPhoneDevice = temp->getPhoneDevice( ) ; | 1029 | KOPrefs::instance()->mPhoneDevice = temp->getPhoneDevice( ) ; |
1029 | KOPrefs::instance()->mPhoneConnection = temp->getPhoneConnection( ); | 1030 | KOPrefs::instance()->mPhoneConnection = temp->getPhoneConnection( ); |
1030 | KOPrefs::instance()->mPhoneModel = temp->getPhoneModel( ); | 1031 | KOPrefs::instance()->mPhoneModel = temp->getPhoneModel( ); |
1031 | syncPhone(); | 1032 | syncPhone(); |
1032 | } else if ( temp->getIsPiSync() ) { | 1033 | } else if ( temp->getIsPiSync() ) { |
1033 | mPassWordPiSync = temp->getRemotePw(); | 1034 | mPassWordPiSync = temp->getRemotePw(); |
1034 | KOPrefs::instance()->mActiveSyncPort = temp->getRemotePort(); | 1035 | KOPrefs::instance()->mActiveSyncPort = temp->getRemotePort(); |
1035 | KOPrefs::instance()->mActiveSyncIP = temp->getRemoteIP(); | 1036 | KOPrefs::instance()->mActiveSyncIP = temp->getRemoteIP(); |
1036 | syncPi(); | 1037 | syncPi(); |
1037 | } else | 1038 | } else |
1038 | syncRemote( temp, false ); | 1039 | syncRemote( temp, false ); |
1039 | 1040 | ||
1040 | } | 1041 | } |
1041 | } | 1042 | } |
1042 | timer.start(); | 1043 | timer.start(); |
1043 | setCaption(i18n("Multiple sync in progress ... please wait!") ); | 1044 | setCaption(i18n("Multiple sync in progress ... please wait!") ); |
1044 | while ( timer.elapsed () < 2000 ) { | 1045 | while ( timer.elapsed () < 2000 ) { |
1045 | qApp->processEvents(); | 1046 | qApp->processEvents(); |
1046 | #ifndef _WIN32_ | 1047 | #ifndef _WIN32_ |
1047 | sleep (1); | 1048 | sleep (1); |
1048 | #endif | 1049 | #endif |
1049 | } | 1050 | } |
1050 | 1051 | ||
1051 | } | 1052 | } |
1052 | 1053 | ||
1053 | } | 1054 | } |
1054 | delete temp; | 1055 | delete temp; |
1055 | return syncedProfiles; | 1056 | return syncedProfiles; |
1056 | } | 1057 | } |
1057 | 1058 | ||
1058 | void MainWindow::multiSync( bool askforPrefs ) | 1059 | void MainWindow::multiSync( bool askforPrefs ) |
1059 | { | 1060 | { |
1060 | if (mBlockSaveFlag) | 1061 | if (mBlockSaveFlag) |
1061 | return; | 1062 | return; |
1062 | mBlockSaveFlag = true; | 1063 | mBlockSaveFlag = true; |
1063 | QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); | 1064 | QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); |
1064 | if ( QMessageBox::information( this, i18n("KO/Pi Sync"), | 1065 | if ( QMessageBox::information( this, i18n("KO/Pi Sync"), |
1065 | question, | 1066 | question, |
1066 | i18n("Yes"), i18n("No"), | 1067 | i18n("Yes"), i18n("No"), |
1067 | 0, 0 ) != 0 ) { | 1068 | 0, 0 ) != 0 ) { |
1068 | mBlockSaveFlag = false; | 1069 | mBlockSaveFlag = false; |
1069 | setCaption(i18n("Aborted! Nothing synced!")); | 1070 | setCaption(i18n("Aborted! Nothing synced!")); |
1070 | return; | 1071 | return; |
1071 | } | 1072 | } |
1072 | mView->setSyncDevice(i18n("Multiple profiles") ); | 1073 | mView->setSyncDevice(i18n("Multiple profiles") ); |
1073 | KOPrefs::instance()->mSyncAlgoPrefs = KOPrefs::instance()->mRingSyncAlgoPrefs; | 1074 | KOPrefs::instance()->mSyncAlgoPrefs = KOPrefs::instance()->mRingSyncAlgoPrefs; |
1074 | if ( askforPrefs ) { | 1075 | if ( askforPrefs ) { |
1075 | mView->edit_sync_options(); | 1076 | mView->edit_sync_options(); |
1076 | KOPrefs::instance()->mRingSyncAlgoPrefs = KOPrefs::instance()->mSyncAlgoPrefs; | 1077 | KOPrefs::instance()->mRingSyncAlgoPrefs = KOPrefs::instance()->mSyncAlgoPrefs; |
1077 | } | 1078 | } |
1078 | setCaption(i18n("Multiple sync started.") ); | 1079 | setCaption(i18n("Multiple sync started.") ); |
1079 | qApp->processEvents(); | 1080 | qApp->processEvents(); |
1080 | int num = ringSync() ; | 1081 | int num = ringSync() ; |
1081 | if ( num > 1 ) | 1082 | if ( num > 1 ) |
1082 | ringSync(); | 1083 | ringSync(); |
1083 | mBlockSaveFlag = false; | 1084 | mBlockSaveFlag = false; |
1084 | if ( num ) | 1085 | if ( num ) |
1085 | save(); | 1086 | save(); |
1086 | if ( num ) | 1087 | if ( num ) |
1087 | setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) ); | 1088 | setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) ); |
1088 | else | 1089 | else |
1089 | setCaption(i18n("Nothing synced! No profiles defined for multisync!")); | 1090 | setCaption(i18n("Nothing synced! No profiles defined for multisync!")); |
1090 | return; | 1091 | return; |
1091 | } | 1092 | } |
1092 | void MainWindow::slotSyncMenu( int action ) | 1093 | void MainWindow::slotSyncMenu( int action ) |
1093 | { | 1094 | { |
1094 | qDebug("syncaction %d ", action); | 1095 | qDebug("syncaction %d ", action); |
1095 | if ( action == 0 ) { | 1096 | if ( action == 0 ) { |
1096 | 1097 | ||
1097 | // seems to be a Qt2 event handling bug | 1098 | // seems to be a Qt2 event handling bug |
1098 | // syncmenu.clear causes a segfault at first time | 1099 | // syncmenu.clear causes a segfault at first time |
1099 | // when we call it after the main event loop, it is ok | 1100 | // when we call it after the main event loop, it is ok |
1100 | // same behaviour when calling OM/Pi via QCOP for the first time | 1101 | // same behaviour when calling OM/Pi via QCOP for the first time |
1101 | QTimer::singleShot ( 1, this, SLOT ( confSync() ) ); | 1102 | QTimer::singleShot ( 1, this, SLOT ( confSync() ) ); |
1102 | //confSync(); | 1103 | //confSync(); |
1103 | 1104 | ||
1104 | return; | 1105 | return; |
1105 | } | 1106 | } |
1106 | if ( action == 1 ) { | 1107 | if ( action == 1 ) { |
1107 | multiSync( true ); | 1108 | multiSync( true ); |
1108 | return; | 1109 | return; |
1109 | } | 1110 | } |
1110 | if ( action == 2 ) { | 1111 | if ( action == 2 ) { |
1111 | enableQuick(); | 1112 | enableQuick(); |
1112 | QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); | 1113 | QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); |
1113 | return; | 1114 | return; |
1114 | } | 1115 | } |
1115 | if ( action == 3 ) { | 1116 | if ( action == 3 ) { |
1116 | delete mServerSocket; | 1117 | delete mServerSocket; |
1117 | mServerSocket = 0; | 1118 | mServerSocket = 0; |
1118 | QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); | 1119 | QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); |
1119 | return; | 1120 | return; |
1120 | } | 1121 | } |
1121 | 1122 | ||
1122 | if (mBlockSaveFlag) | 1123 | if (mBlockSaveFlag) |
1123 | return; | 1124 | return; |
1124 | mBlockSaveFlag = true; | 1125 | mBlockSaveFlag = true; |
1125 | mCurrentSyncProfile = action - 1000 ; | 1126 | mCurrentSyncProfile = action - 1000 ; |
1126 | mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] ); | 1127 | mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] ); |
1127 | mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); | 1128 | mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); |
1128 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); | 1129 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); |
1129 | KSyncProfile* temp = new KSyncProfile (); | 1130 | KSyncProfile* temp = new KSyncProfile (); |
1130 | temp->setName(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); | 1131 | temp->setName(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); |
1131 | temp->readConfig(&config); | 1132 | temp->readConfig(&config); |
1132 | KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); | 1133 | KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); |
1133 | KOPrefs::instance()->mSyncAlgoPrefs = temp->getSyncPrefs(); | 1134 | KOPrefs::instance()->mSyncAlgoPrefs = temp->getSyncPrefs(); |
1134 | KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); | 1135 | KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); |
1135 | KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); | 1136 | KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); |
1136 | KOPrefs::instance()->mWriteBackInFuture = 0; | 1137 | KOPrefs::instance()->mWriteBackInFuture = 0; |
1137 | if ( temp->getWriteBackFuture() ) | 1138 | if ( temp->getWriteBackFuture() ) |
1138 | KOPrefs::instance()->mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); | 1139 | KOPrefs::instance()->mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); |
1139 | KOPrefs::instance()->mShowSyncSummary = temp->getShowSummaryAfterSync(); | 1140 | KOPrefs::instance()->mShowSyncSummary = temp->getShowSummaryAfterSync(); |
1140 | if ( action == 1000 ) { | 1141 | if ( action == 1000 ) { |
1141 | syncSharp(); | 1142 | syncSharp(); |
1142 | 1143 | ||
1143 | } else if ( action == 1001 ) { | 1144 | } else if ( action == 1001 ) { |
1144 | syncLocalFile(); | 1145 | syncLocalFile(); |
1145 | 1146 | ||
1146 | } else if ( action == 1002 ) { | 1147 | } else if ( action == 1002 ) { |
1147 | quickSyncLocalFile(); | 1148 | quickSyncLocalFile(); |
1148 | 1149 | ||
1149 | } else if ( action >= 1003 ) { | 1150 | } else if ( action >= 1003 ) { |
1150 | if ( temp->getIsLocalFileSync() ) { | 1151 | if ( temp->getIsLocalFileSync() ) { |
1151 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) | 1152 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) |
1152 | KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); | 1153 | KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); |
1153 | } else { | 1154 | } else { |
1154 | if ( temp->getIsPhoneSync() ) { | 1155 | if ( temp->getIsPhoneSync() ) { |
1155 | KOPrefs::instance()->mPhoneDevice = temp->getPhoneDevice( ) ; | 1156 | KOPrefs::instance()->mPhoneDevice = temp->getPhoneDevice( ) ; |
1156 | KOPrefs::instance()->mPhoneConnection = temp->getPhoneConnection( ); | 1157 | KOPrefs::instance()->mPhoneConnection = temp->getPhoneConnection( ); |
1157 | KOPrefs::instance()->mPhoneModel = temp->getPhoneModel( ); | 1158 | KOPrefs::instance()->mPhoneModel = temp->getPhoneModel( ); |
1158 | syncPhone(); | 1159 | syncPhone(); |
1159 | } else if ( temp->getIsPiSync() ) { | 1160 | } else if ( temp->getIsPiSync() ) { |
1160 | mPassWordPiSync = temp->getRemotePw(); | 1161 | mPassWordPiSync = temp->getRemotePw(); |
1161 | KOPrefs::instance()->mActiveSyncPort = temp->getRemotePort(); | 1162 | KOPrefs::instance()->mActiveSyncPort = temp->getRemotePort(); |
1162 | KOPrefs::instance()->mActiveSyncIP = temp->getRemoteIP(); | 1163 | KOPrefs::instance()->mActiveSyncIP = temp->getRemoteIP(); |
1163 | syncPi(); | 1164 | syncPi(); |
1164 | } else | 1165 | } else |
1165 | syncRemote( temp ); | 1166 | syncRemote( temp ); |
1166 | 1167 | ||
1167 | } | 1168 | } |
1168 | } | 1169 | } |
1169 | delete temp; | 1170 | delete temp; |
1170 | mBlockSaveFlag = false; | 1171 | mBlockSaveFlag = false; |
1171 | } | 1172 | } |
1172 | void MainWindow::exportToPhone( int mode ) | 1173 | void MainWindow::exportToPhone( int mode ) |
1173 | { | 1174 | { |
1174 | 1175 | ||
1175 | //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); | 1176 | //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); |
1176 | //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); | 1177 | //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); |
1177 | KOex2phonePrefs ex2phone; | 1178 | KOex2phonePrefs ex2phone; |
1178 | 1179 | ||
1179 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); | 1180 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); |
1180 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); | 1181 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); |
1181 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 1182 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
1182 | if ( mode == 1 ) | 1183 | if ( mode == 1 ) |
1183 | ex2phone.setCaption(i18n("Export complete calendar")); | 1184 | ex2phone.setCaption(i18n("Export complete calendar")); |
1184 | if ( mode == 2 ) | 1185 | if ( mode == 2 ) |
1185 | ex2phone.setCaption(i18n("Export filtered calendar")); | 1186 | ex2phone.setCaption(i18n("Export filtered calendar")); |
1186 | 1187 | ||
1187 | if ( !ex2phone.exec() ) { | 1188 | if ( !ex2phone.exec() ) { |
1188 | return; | 1189 | return; |
1189 | } | 1190 | } |
1190 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); | 1191 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); |
1191 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); | 1192 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); |
1192 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); | 1193 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); |
1193 | 1194 | ||
1194 | int inFuture = 0; | 1195 | int inFuture = 0; |
1195 | if ( ex2phone.mWriteBackFuture->isChecked() ) | 1196 | if ( ex2phone.mWriteBackFuture->isChecked() ) |
1196 | inFuture = ex2phone.mWriteBackFutureWeeks->value(); | 1197 | inFuture = ex2phone.mWriteBackFutureWeeks->value(); |
1197 | QPtrList<Incidence> delSel; | 1198 | QPtrList<Incidence> delSel; |
1198 | if ( mode == 1 ) | 1199 | if ( mode == 1 ) |
1199 | delSel = mCalendar->rawIncidences(); | 1200 | delSel = mCalendar->rawIncidences(); |
1200 | if ( mode == 2 ) | 1201 | if ( mode == 2 ) |
1201 | delSel = mCalendar->incidences(); | 1202 | delSel = mCalendar->incidences(); |
1202 | CalendarLocal* cal = new CalendarLocal(); | 1203 | CalendarLocal* cal = new CalendarLocal(); |
1203 | cal->setLocalTime(); | 1204 | cal->setLocalTime(); |
1204 | Incidence *incidence = delSel.first(); | 1205 | Incidence *incidence = delSel.first(); |
1205 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); | 1206 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); |
1206 | QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); | 1207 | QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); |
1207 | while ( incidence ) { | 1208 | while ( incidence ) { |
1208 | if ( incidence->type() != "Journal" ) { | 1209 | if ( incidence->type() != "Journal" ) { |
1209 | bool add = true; | 1210 | bool add = true; |
1210 | if ( inFuture ) { | 1211 | if ( inFuture ) { |
1211 | QDateTime dt; | 1212 | QDateTime dt; |
1212 | if ( incidence->type() == "Todo" ) { | 1213 | if ( incidence->type() == "Todo" ) { |
1213 | Todo * t = (Todo*)incidence; | 1214 | Todo * t = (Todo*)incidence; |
1214 | if ( t->hasDueDate() ) | 1215 | if ( t->hasDueDate() ) |
1215 | dt = t->dtDue(); | 1216 | dt = t->dtDue(); |
1216 | else | 1217 | else |
1217 | dt = cur.addSecs( 62 ); | 1218 | dt = cur.addSecs( 62 ); |
1218 | } | 1219 | } |
1219 | else { | 1220 | else { |
1220 | bool ok; | 1221 | bool ok; |
1221 | dt = incidence->getNextOccurence( cur, &ok ); | 1222 | dt = incidence->getNextOccurence( cur, &ok ); |
1222 | if ( !ok ) | 1223 | if ( !ok ) |
1223 | dt = cur.addSecs( -62 ); | 1224 | dt = cur.addSecs( -62 ); |
1224 | } | 1225 | } |
1225 | if ( dt < cur || dt > end ) { | 1226 | if ( dt < cur || dt > end ) { |
1226 | add = false; | 1227 | add = false; |
1227 | } | 1228 | } |
1228 | } | 1229 | } |
1229 | if ( add ) { | 1230 | if ( add ) { |
1230 | Incidence *in = incidence->clone(); | 1231 | Incidence *in = incidence->clone(); |
1231 | cal->addIncidence( in ); | 1232 | cal->addIncidence( in ); |
1232 | } | 1233 | } |
1233 | } | 1234 | } |
1234 | incidence = delSel.next(); | 1235 | incidence = delSel.next(); |
1235 | } | 1236 | } |
1236 | PhoneFormat::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, | 1237 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, |
1237 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, | 1238 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, |
1238 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 1239 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
1239 | 1240 | ||
1240 | setCaption( i18n("Writing to phone...")); | 1241 | setCaption( i18n("Writing to phone...")); |
1241 | if ( PhoneFormat::writeToPhone( cal ) ) | 1242 | if ( PhoneFormat::writeToPhone( cal ) ) |
1242 | setCaption( i18n("Export to phone successful!")); | 1243 | setCaption( i18n("Export to phone successful!")); |
1243 | else | 1244 | else |
1244 | setCaption( i18n("Error exporting to phone!")); | 1245 | setCaption( i18n("Error exporting to phone!")); |
1245 | delete cal; | 1246 | delete cal; |
1246 | } | 1247 | } |
1247 | 1248 | ||
1248 | 1249 | ||
1249 | void MainWindow::setDefaultPreferences() | 1250 | void MainWindow::setDefaultPreferences() |
1250 | { | 1251 | { |
1251 | KOPrefs *p = KOPrefs::instance(); | 1252 | KOPrefs *p = KOPrefs::instance(); |
1252 | 1253 | ||
1253 | p->mCompactDialogs = true; | 1254 | p->mCompactDialogs = true; |
1254 | p->mConfirm = true; | 1255 | p->mConfirm = true; |
1255 | // p->mEnableQuickTodo = false; | 1256 | // p->mEnableQuickTodo = false; |
1256 | 1257 | ||
1257 | } | 1258 | } |
1258 | 1259 | ||
1259 | QString MainWindow::resourcePath() | 1260 | QString MainWindow::resourcePath() |
1260 | { | 1261 | { |
1261 | return KGlobal::iconLoader()->iconPath(); | 1262 | return KGlobal::iconLoader()->iconPath(); |
1262 | } | 1263 | } |
1263 | 1264 | ||
1264 | void MainWindow::displayText( QString text ,QString cap ) | 1265 | void MainWindow::displayText( QString text ,QString cap ) |
1265 | { | 1266 | { |
1266 | QDialog dia( this, "name", true ); ; | 1267 | QDialog dia( this, "name", true ); ; |
1267 | dia.setCaption( cap ); | 1268 | dia.setCaption( cap ); |
1268 | QVBoxLayout* lay = new QVBoxLayout( &dia ); | 1269 | QVBoxLayout* lay = new QVBoxLayout( &dia ); |
1269 | lay->setSpacing( 3 ); | 1270 | lay->setSpacing( 3 ); |
1270 | lay->setMargin( 3 ); | 1271 | lay->setMargin( 3 ); |
1271 | QTextBrowser tb ( &dia ); | 1272 | QTextBrowser tb ( &dia ); |
1272 | lay->addWidget( &tb ); | 1273 | lay->addWidget( &tb ); |
1273 | tb.setText( text ); | 1274 | tb.setText( text ); |
1274 | #ifdef DESKTOP_VERSION | 1275 | #ifdef DESKTOP_VERSION |
1275 | dia.resize( 640, 480); | 1276 | dia.resize( 640, 480); |
1276 | #else | 1277 | #else |
1277 | dia.showMaximized(); | 1278 | dia.showMaximized(); |
1278 | #endif | 1279 | #endif |
1279 | dia.exec(); | 1280 | dia.exec(); |
1280 | } | 1281 | } |
1281 | void MainWindow::displayFile( QString fn, QString cap ) | 1282 | void MainWindow::displayFile( QString fn, QString cap ) |
1282 | { | 1283 | { |
1283 | QString fileName = resourcePath() + fn; | 1284 | QString fileName = resourcePath() + fn; |
1284 | QString text; | 1285 | QString text; |
1285 | QFile file( fileName ); | 1286 | QFile file( fileName ); |
1286 | if (!file.open( IO_ReadOnly ) ) { | 1287 | if (!file.open( IO_ReadOnly ) ) { |
1287 | return ; | 1288 | return ; |
1288 | 1289 | ||
1289 | } | 1290 | } |
1290 | QTextStream ts( &file ); | 1291 | QTextStream ts( &file ); |
1291 | text = ts.read(); | 1292 | text = ts.read(); |
1292 | file.close(); | 1293 | file.close(); |
1293 | displayText( text, cap); | 1294 | displayText( text, cap); |
1294 | } | 1295 | } |
1295 | void MainWindow::features() | 1296 | void MainWindow::features() |
1296 | { | 1297 | { |
1297 | 1298 | ||
1298 | displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") ); | 1299 | displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") ); |
1299 | } | 1300 | } |
1300 | 1301 | ||
1301 | void MainWindow::usertrans() | 1302 | void MainWindow::usertrans() |
1302 | { | 1303 | { |
1303 | 1304 | ||
1304 | displayFile( "usertranslationHOWTO.txt",i18n("KO/Pi User translation HowTo") ); | 1305 | displayFile( "usertranslationHOWTO.txt",i18n("KO/Pi User translation HowTo") ); |
1305 | } | 1306 | } |
1306 | 1307 | ||
1307 | void MainWindow::synchowto() | 1308 | void MainWindow::synchowto() |
1308 | { | 1309 | { |
1309 | #if 0 | 1310 | #if 0 |
1310 | QPtrList<Incidence> er = mCalendar->rawIncidences(); | 1311 | QPtrList<Incidence> er = mCalendar->rawIncidences(); |
1311 | Incidence* inR = er.first(); | 1312 | Incidence* inR = er.first(); |
1312 | VCalFormat vf; | 1313 | VCalFormat vf; |
1313 | QString strout; | 1314 | QString strout; |
1314 | while ( inR ) { | 1315 | while ( inR ) { |
1315 | if ( inR->type() == "Todo" ) | 1316 | if ( inR->type() == "Todo" ) |
1316 | strout = vf.todoToString( (Todo *) inR ); | 1317 | strout = vf.todoToString( (Todo *) inR ); |
1317 | if ( inR->type() == "Event" ) | 1318 | if ( inR->type() == "Event" ) |
1318 | strout = vf.eventToString( (Event *) inR ); | 1319 | strout = vf.eventToString( (Event *) inR ); |
1319 | qDebug("incidence: \n%s\n ente\n\n",strout.latin1() ); | 1320 | qDebug("incidence: \n%s\n ente\n\n",strout.latin1() ); |
1320 | inR = er.next(); | 1321 | inR = er.next(); |
1321 | } | 1322 | } |
1322 | #endif | 1323 | #endif |
1323 | displayFile( "howtoSYNC.txt",i18n("KO/Pi Synchronization HowTo") ); | 1324 | displayFile( "howtoSYNC.txt",i18n("KO/Pi Synchronization HowTo") ); |
1324 | } | 1325 | } |
1325 | void MainWindow::faq() | 1326 | void MainWindow::faq() |
1326 | { | 1327 | { |
1327 | displayFile( "kopiFAQ.txt",i18n("KO/Pi FAQ") ); | 1328 | displayFile( "kopiFAQ.txt",i18n("KO/Pi FAQ") ); |
1328 | 1329 | ||
1329 | } | 1330 | } |
1330 | void MainWindow::whatsNew() | 1331 | void MainWindow::whatsNew() |
1331 | { | 1332 | { |
1332 | displayFile( "kopiWhatsNew.txt",i18n("KO/Pi Version Info") ); | 1333 | displayFile( "kopiWhatsNew.txt",i18n("KO/Pi Version Info") ); |
1333 | 1334 | ||
1334 | } | 1335 | } |
1335 | void MainWindow::licence() | 1336 | void MainWindow::licence() |
1336 | { | 1337 | { |
1337 | KApplication::showLicence(); | 1338 | KApplication::showLicence(); |
1338 | 1339 | ||
1339 | } | 1340 | } |
1340 | void MainWindow::about() | 1341 | void MainWindow::about() |
1341 | { | 1342 | { |
1342 | QString version; | 1343 | QString version; |
1343 | #include <../version> | 1344 | #include <../version> |
1344 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), | 1345 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), |
1345 | i18n("KOrganizer/Platform-independent\n") + | 1346 | i18n("KOrganizer/Platform-independent\n") + |
1346 | "(KO/Pi) " + version + " - " + | 1347 | "(KO/Pi) " + version + " - " + |
1347 | 1348 | ||
1348 | #ifdef DESKTOP_VERSION | 1349 | #ifdef DESKTOP_VERSION |
1349 | i18n("Desktop Edition\n") + | 1350 | i18n("Desktop Edition\n") + |
1350 | #else | 1351 | #else |
1351 | i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") + | 1352 | i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") + |
1352 | #endif | 1353 | #endif |
1353 | 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") ); | 1354 | 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") ); |
1354 | } | 1355 | } |
1355 | void MainWindow::keyBindings() | 1356 | void MainWindow::keyBindings() |
1356 | { | 1357 | { |
1357 | QString cap = i18n("Key bindings KOrganizer/Pi"); | 1358 | QString cap = i18n("Key bindings KOrganizer/Pi"); |
1358 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + | 1359 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + |
1359 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ | 1360 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ |
1360 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + | 1361 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + |
1361 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ | 1362 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ |
1362 | i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ | 1363 | i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ |
1363 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ | 1364 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ |
1364 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ | 1365 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ |
1365 | i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ | 1366 | i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ |
1366 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ | 1367 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ |
1367 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ | 1368 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ |
1368 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ | 1369 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ |
1369 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ | 1370 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ |
1370 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ | 1371 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ |
1371 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ | 1372 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ |
1372 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ | 1373 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ |
1373 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ | 1374 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ |
1374 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ | 1375 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ |
1375 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ | 1376 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ |
1376 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ | 1377 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ |
1377 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ | 1378 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ |
1378 | i18n("<p><h3>In agenda view:</h3></p>\n") + | 1379 | i18n("<p><h3>In agenda view:</h3></p>\n") + |
1379 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ | 1380 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ |
1380 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ | 1381 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ |
1381 | i18n("<p><h3>In todo view:</h3></p>\n") + | 1382 | i18n("<p><h3>In todo view:</h3></p>\n") + |
1382 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ | 1383 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ |
1383 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1384 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1384 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ | 1385 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ |
1385 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ | 1386 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ |
1386 | i18n("<p><h3>In list view:</h3></p>\n") + | 1387 | i18n("<p><h3>In list view:</h3></p>\n") + |
1387 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1388 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1388 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ | 1389 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ |
1389 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ | 1390 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ |
1390 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ | 1391 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ |
1391 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ | 1392 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ |
1392 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ | 1393 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ |
1393 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + | 1394 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + |
1394 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ | 1395 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ |
1395 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ | 1396 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ |
1396 | i18n("<p><b>E</b>: Edit item</p>\n") + | 1397 | i18n("<p><b>E</b>: Edit item</p>\n") + |
1397 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + | 1398 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + |
1398 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + | 1399 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + |
1399 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ | 1400 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ |
1400 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ | 1401 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ |
1401 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ | 1402 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ |
1402 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ | 1403 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ |
1403 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ | 1404 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ |
1404 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + | 1405 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + |
1405 | i18n("<p><b>White</b>: Item readonly</p>\n"); | 1406 | i18n("<p><b>White</b>: Item readonly</p>\n"); |
1406 | displayText( text, cap); | 1407 | displayText( text, cap); |
1407 | 1408 | ||
1408 | } | 1409 | } |
1409 | void MainWindow::aboutAutoSaving() | 1410 | void MainWindow::aboutAutoSaving() |
1410 | { | 1411 | { |
1411 | QMessageBox* msg; | 1412 | QMessageBox* msg; |
1412 | msg = new QMessageBox( i18n("Auto Saving in KOrganizer/Pi"), | 1413 | msg = new QMessageBox( i18n("Auto Saving in KOrganizer/Pi"), |
1413 | 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, | 1414 | 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, |
1414 | QMessageBox::Ok, | 1415 | QMessageBox::Ok, |
1415 | QMessageBox::NoButton, | 1416 | QMessageBox::NoButton, |
1416 | QMessageBox::NoButton); | 1417 | QMessageBox::NoButton); |
1417 | msg->exec(); | 1418 | msg->exec(); |
1418 | delete msg; | 1419 | delete msg; |
1419 | 1420 | ||
1420 | 1421 | ||
1421 | } | 1422 | } |
1422 | void MainWindow::aboutKnownBugs() | 1423 | void MainWindow::aboutKnownBugs() |
1423 | { | 1424 | { |
1424 | QMessageBox* msg; | 1425 | QMessageBox* msg; |
1425 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), | 1426 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), |
1426 | 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")+ | 1427 | 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")+ |
1427 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ | 1428 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ |
1428 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + | 1429 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + |
1429 | i18n("\nor report them in the bugtracker on\n") + | 1430 | i18n("\nor report them in the bugtracker on\n") + |
1430 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), | 1431 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), |
1431 | QMessageBox::NoIcon, | 1432 | QMessageBox::NoIcon, |
1432 | QMessageBox::Ok, | 1433 | QMessageBox::Ok, |
1433 | QMessageBox::NoButton, | 1434 | QMessageBox::NoButton, |
1434 | QMessageBox::NoButton); | 1435 | QMessageBox::NoButton); |
1435 | msg->exec(); | 1436 | msg->exec(); |
1436 | delete msg; | 1437 | delete msg; |
1437 | 1438 | ||
1438 | } | 1439 | } |
1439 | 1440 | ||
1440 | QString MainWindow::defaultFileName() | 1441 | QString MainWindow::defaultFileName() |
1441 | { | 1442 | { |
1442 | return locateLocal( "data", "korganizer/mycalendar.ics" ); | 1443 | return locateLocal( "data", "korganizer/mycalendar.ics" ); |
1443 | } | 1444 | } |
1444 | QString MainWindow::syncFileName() | 1445 | QString MainWindow::syncFileName() |
1445 | { | 1446 | { |
1446 | #ifdef _WIN32_ | 1447 | #ifdef _WIN32_ |
1447 | return locateLocal( "tmp", "synccalendar.ics" ); | 1448 | return locateLocal( "tmp", "synccalendar.ics" ); |
1448 | #else | 1449 | #else |
1449 | return QString( "/tmp/kopitempfile.ics" ); | 1450 | return QString( "/tmp/kopitempfile.ics" ); |
1450 | #endif | 1451 | #endif |
1451 | } | 1452 | } |
1452 | 1453 | ||
1453 | void MainWindow::processIncidenceSelection( Incidence *incidence ) | 1454 | void MainWindow::processIncidenceSelection( Incidence *incidence ) |
1454 | { | 1455 | { |
1455 | if ( !incidence ) { | 1456 | if ( !incidence ) { |
1456 | enableIncidenceActions( false ); | 1457 | enableIncidenceActions( false ); |
1457 | 1458 | ||
1458 | mNewSubTodoAction->setEnabled( false ); | 1459 | mNewSubTodoAction->setEnabled( false ); |
1459 | setCaptionToDates(); | 1460 | setCaptionToDates(); |
1460 | return; | 1461 | return; |
1461 | 1462 | ||
1462 | } | 1463 | } |
1463 | 1464 | ||
1464 | //KGlobal::locale()->formatDateTime(nextA, true); | 1465 | //KGlobal::locale()->formatDateTime(nextA, true); |
1465 | QString startString = ""; | 1466 | QString startString = ""; |
1466 | if ( incidence->type() != "Todo" ) { | 1467 | if ( incidence->type() != "Todo" ) { |
1467 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { | 1468 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { |
1468 | if ( incidence->doesFloat() ) { | 1469 | if ( incidence->doesFloat() ) { |
1469 | startString += ": "+incidence->dtStartDateStr( true ); | 1470 | startString += ": "+incidence->dtStartDateStr( true ); |
1470 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); | 1471 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); |
1471 | 1472 | ||
1472 | } else { | 1473 | } else { |
1473 | startString = ": "+incidence->dtStartStr(true); | 1474 | startString = ": "+incidence->dtStartStr(true); |
1474 | startString += " --- "+((Event*)incidence)->dtEndStr(true); | 1475 | startString += " --- "+((Event*)incidence)->dtEndStr(true); |
1475 | 1476 | ||
1476 | } | 1477 | } |
1477 | 1478 | ||
1478 | } else { | 1479 | } else { |
1479 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) | 1480 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) |
1480 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ | 1481 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ |
1481 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); | 1482 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); |
1482 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); | 1483 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); |
1483 | } | 1484 | } |
1484 | 1485 | ||
1485 | } | 1486 | } |
1486 | else | 1487 | else |
1487 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); | 1488 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); |
1488 | if ( !incidence->location().isEmpty() ) | 1489 | if ( !incidence->location().isEmpty() ) |
1489 | startString += " (" +incidence->location()+")"; | 1490 | startString += " (" +incidence->location()+")"; |
1490 | setCaption( incidence->summary()+startString); | 1491 | setCaption( incidence->summary()+startString); |
1491 | 1492 | ||
1492 | enableIncidenceActions( true ); | 1493 | enableIncidenceActions( true ); |
1493 | 1494 | ||
1494 | if ( incidence->type() == "Event" ) { | 1495 | if ( incidence->type() == "Event" ) { |
1495 | mShowAction->setText( i18n("Show Event...") ); | 1496 | mShowAction->setText( i18n("Show Event...") ); |
1496 | mEditAction->setText( i18n("Edit Event...") ); | 1497 | mEditAction->setText( i18n("Edit Event...") ); |
1497 | mDeleteAction->setText( i18n("Delete Event...") ); | 1498 | mDeleteAction->setText( i18n("Delete Event...") ); |
1498 | 1499 | ||
1499 | mNewSubTodoAction->setEnabled( false ); | 1500 | mNewSubTodoAction->setEnabled( false ); |
1500 | } else if ( incidence->type() == "Todo" ) { | 1501 | } else if ( incidence->type() == "Todo" ) { |
1501 | mShowAction->setText( i18n("Show Todo...") ); | 1502 | mShowAction->setText( i18n("Show Todo...") ); |
1502 | mEditAction->setText( i18n("Edit Todo...") ); | 1503 | mEditAction->setText( i18n("Edit Todo...") ); |
1503 | mDeleteAction->setText( i18n("Delete Todo...") ); | 1504 | mDeleteAction->setText( i18n("Delete Todo...") ); |
1504 | 1505 | ||
1505 | mNewSubTodoAction->setEnabled( true ); | 1506 | mNewSubTodoAction->setEnabled( true ); |
1506 | } else { | 1507 | } else { |
1507 | mShowAction->setText( i18n("Show...") ); | 1508 | mShowAction->setText( i18n("Show...") ); |
1508 | mShowAction->setText( i18n("Edit...") ); | 1509 | mShowAction->setText( i18n("Edit...") ); |
1509 | mShowAction->setText( i18n("Delete...") ); | 1510 | mShowAction->setText( i18n("Delete...") ); |
1510 | 1511 | ||
1511 | mNewSubTodoAction->setEnabled( false ); | 1512 | mNewSubTodoAction->setEnabled( false ); |
1512 | } | 1513 | } |
1513 | } | 1514 | } |
1514 | 1515 | ||
1515 | void MainWindow::enableIncidenceActions( bool enabled ) | 1516 | void MainWindow::enableIncidenceActions( bool enabled ) |
1516 | { | 1517 | { |
1517 | mShowAction->setEnabled( enabled ); | 1518 | mShowAction->setEnabled( enabled ); |
1518 | mEditAction->setEnabled( enabled ); | 1519 | mEditAction->setEnabled( enabled ); |
1519 | mDeleteAction->setEnabled( enabled ); | 1520 | mDeleteAction->setEnabled( enabled ); |
1520 | 1521 | ||
1521 | mCloneAction->setEnabled( enabled ); | 1522 | mCloneAction->setEnabled( enabled ); |
1522 | mMoveAction->setEnabled( enabled ); | 1523 | mMoveAction->setEnabled( enabled ); |
1523 | mBeamAction->setEnabled( enabled ); | 1524 | mBeamAction->setEnabled( enabled ); |
1524 | mCancelAction->setEnabled( enabled ); | 1525 | mCancelAction->setEnabled( enabled ); |
1525 | } | 1526 | } |
1526 | 1527 | ||
1527 | void MainWindow::importOL() | 1528 | void MainWindow::importOL() |
1528 | { | 1529 | { |
1529 | #ifdef _WIN32_ | 1530 | #ifdef _WIN32_ |
1530 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); | 1531 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); |
1531 | id->exec(); | 1532 | id->exec(); |
1532 | delete id; | 1533 | delete id; |
1533 | mView->updateView(); | 1534 | mView->updateView(); |
1534 | #endif | 1535 | #endif |
1535 | } | 1536 | } |
1536 | void MainWindow::importBday() | 1537 | void MainWindow::importBday() |
1537 | { | 1538 | { |
1538 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1539 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1539 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), | 1540 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), |
1540 | i18n("Import!"), i18n("Cancel"), 0, | 1541 | i18n("Import!"), i18n("Cancel"), 0, |
1541 | 0, 1 ); | 1542 | 0, 1 ); |
1542 | if ( result == 0 ) { | 1543 | if ( result == 0 ) { |
1543 | mView->importBday(); | 1544 | mView->importBday(); |
1544 | 1545 | ||
1545 | } | 1546 | } |
1546 | 1547 | ||
1547 | 1548 | ||
1548 | } | 1549 | } |
1549 | void MainWindow::importQtopia() | 1550 | void MainWindow::importQtopia() |
1550 | { | 1551 | { |
1551 | #ifndef DESKTOP_VERSION | 1552 | #ifndef DESKTOP_VERSION |
1552 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1553 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1553 | i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"), | 1554 | i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"), |
1554 | i18n("Import!"), i18n("Cancel"), 0, | 1555 | i18n("Import!"), i18n("Cancel"), 0, |
1555 | 0, 1 ); | 1556 | 0, 1 ); |
1556 | if ( result == 0 ) { | 1557 | if ( result == 0 ) { |
1557 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); | 1558 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); |
1558 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); | 1559 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); |
1559 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; | 1560 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; |
1560 | mView->importQtopia( categories, datebook, todolist ); | 1561 | mView->importQtopia( categories, datebook, todolist ); |
1561 | } | 1562 | } |
1562 | #else | 1563 | #else |
1563 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1564 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1564 | i18n("Not supported \non desktop!\n"), | 1565 | i18n("Not supported \non desktop!\n"), |
1565 | i18n("Ok"), i18n("Cancel"), 0, | 1566 | i18n("Ok"), i18n("Cancel"), 0, |
1566 | 0, 1 ); | 1567 | 0, 1 ); |
1567 | 1568 | ||
1568 | #endif | 1569 | #endif |
1569 | } | 1570 | } |
1570 | 1571 | ||
1571 | void MainWindow::saveOnClose() | 1572 | void MainWindow::saveOnClose() |
1572 | { | 1573 | { |
1573 | KOPrefs *p = KOPrefs::instance(); | 1574 | KOPrefs *p = KOPrefs::instance(); |
1574 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); | 1575 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); |
1575 | p->mToolBarUp = iconToolBar->x() > width()/2 || | 1576 | p->mToolBarUp = iconToolBar->x() > width()/2 || |
1576 | iconToolBar->y() > height()/2; | 1577 | iconToolBar->y() > height()/2; |
1577 | mView->writeSettings(); | 1578 | mView->writeSettings(); |
1578 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) | 1579 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) |
1579 | save(); | 1580 | save(); |
1580 | } | 1581 | } |
1581 | void MainWindow::slotModifiedChanged( bool changed ) | 1582 | void MainWindow::slotModifiedChanged( bool changed ) |
1582 | { | 1583 | { |
1583 | if ( mBlockAtStartup ) | 1584 | if ( mBlockAtStartup ) |
1584 | return; | 1585 | return; |
1585 | int msec; | 1586 | int msec; |
1586 | // we store the changes after 1 minute, | 1587 | // we store the changes after 1 minute, |
1587 | // and for safety reasons after 10 minutes again | 1588 | // and for safety reasons after 10 minutes again |
1588 | if ( !mBlockSaveFlag ) | 1589 | if ( !mBlockSaveFlag ) |
1589 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; | 1590 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; |
1590 | else | 1591 | else |
1591 | msec = 1000 * 600; | 1592 | msec = 1000 * 600; |
1592 | mSaveTimer.start( msec, true ); // 1 minute | 1593 | mSaveTimer.start( msec, true ); // 1 minute |
1593 | qDebug("KO: Saving File in %d secs!", msec/1000); | 1594 | qDebug("KO: Saving File in %d secs!", msec/1000); |
1594 | mCalendarModifiedFlag = true; | 1595 | mCalendarModifiedFlag = true; |
1595 | } | 1596 | } |
1596 | void MainWindow::save() | 1597 | void MainWindow::save() |
1597 | { | 1598 | { |
1598 | if ( mBlockSaveFlag ) | 1599 | if ( mBlockSaveFlag ) |
1599 | return; | 1600 | return; |
1600 | bool store = mBlockSaveFlag; | 1601 | bool store = mBlockSaveFlag; |
1601 | mBlockSaveFlag = true; | 1602 | mBlockSaveFlag = true; |
1602 | if ( mView->checkFileVersion( defaultFileName()) ) { | 1603 | if ( mView->checkFileVersion( defaultFileName()) ) { |
1603 | 1604 | ||
1604 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 1605 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
1605 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); | 1606 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); |
1606 | qDebug("KO: Start saving data to file!"); | 1607 | qDebug("KO: Start saving data to file!"); |
1607 | mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1)); | 1608 | mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1)); |
1608 | mView->saveCalendar( defaultFileName() ); | 1609 | mView->saveCalendar( defaultFileName() ); |
1609 | 1610 | ||
1610 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 1611 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
1611 | mView->watchSavedFile(); | 1612 | mView->watchSavedFile(); |
1612 | qDebug("KO: Needed %d ms for saving.",msNeeded ); | 1613 | qDebug("KO: Needed %d ms for saving.",msNeeded ); |
1613 | QString savemes; | 1614 | QString savemes; |
1614 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); | 1615 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); |
1615 | setCaption(savemes); | 1616 | setCaption(savemes); |
1616 | } else | 1617 | } else |
1617 | setCaption(i18n("Saving cancelled!")); | 1618 | setCaption(i18n("Saving cancelled!")); |
1618 | mCalendarModifiedFlag = false; | 1619 | mCalendarModifiedFlag = false; |
1619 | mBlockSaveFlag = store; | 1620 | mBlockSaveFlag = store; |
1620 | } | 1621 | } |
1621 | 1622 | ||
1622 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) | 1623 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) |
1623 | { | 1624 | { |
1624 | if ( !e->isAutoRepeat() ) { | 1625 | if ( !e->isAutoRepeat() ) { |
1625 | mFlagKeyPressed = false; | 1626 | mFlagKeyPressed = false; |
1626 | } | 1627 | } |
1627 | } | 1628 | } |
1628 | void MainWindow::keyPressEvent ( QKeyEvent * e ) | 1629 | void MainWindow::keyPressEvent ( QKeyEvent * e ) |
1629 | { | 1630 | { |
1630 | qApp->processEvents(); | 1631 | qApp->processEvents(); |
1631 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | 1632 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { |
1632 | e->ignore(); | 1633 | e->ignore(); |
1633 | // qDebug(" ignore %d",e->isAutoRepeat() ); | 1634 | // qDebug(" ignore %d",e->isAutoRepeat() ); |
1634 | return; | 1635 | return; |
1635 | } | 1636 | } |
1636 | if (! e->isAutoRepeat() ) | 1637 | if (! e->isAutoRepeat() ) |
1637 | mFlagKeyPressed = true; | 1638 | mFlagKeyPressed = true; |
1638 | KOPrefs *p = KOPrefs::instance(); | 1639 | KOPrefs *p = KOPrefs::instance(); |
1639 | bool showSelectedDates = false; | 1640 | bool showSelectedDates = false; |
1640 | int size; | 1641 | int size; |
1641 | int pro = 0; | 1642 | int pro = 0; |
1642 | //qDebug("MainWindow::keyPressEvent "); | 1643 | //qDebug("MainWindow::keyPressEvent "); |
1643 | switch ( e->key() ) { | 1644 | switch ( e->key() ) { |
1644 | case Qt::Key_Right: | 1645 | case Qt::Key_Right: |
1645 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 1646 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1646 | mView->goNextMonth(); | 1647 | mView->goNextMonth(); |
1647 | else | 1648 | else |
1648 | mView->goNext(); | 1649 | mView->goNext(); |
1649 | showSelectedDates = true; | 1650 | showSelectedDates = true; |
1650 | break; | 1651 | break; |
1651 | case Qt::Key_Left: | 1652 | case Qt::Key_Left: |
1652 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1653 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1653 | mView->goPreviousMonth(); | 1654 | mView->goPreviousMonth(); |
1654 | else | 1655 | else |
1655 | mView->goPrevious(); | 1656 | mView->goPrevious(); |
1656 | showSelectedDates = true; | 1657 | showSelectedDates = true; |
1657 | break; | 1658 | break; |
1658 | case Qt::Key_Down: | 1659 | case Qt::Key_Down: |
1659 | mView->viewManager()->agendaView()->scrollOneHourDown(); | 1660 | mView->viewManager()->agendaView()->scrollOneHourDown(); |
1660 | break; | 1661 | break; |
1661 | case Qt::Key_Up: | 1662 | case Qt::Key_Up: |
1662 | mView->viewManager()->agendaView()->scrollOneHourUp(); | 1663 | mView->viewManager()->agendaView()->scrollOneHourUp(); |
1663 | break; | 1664 | break; |
1664 | case Qt::Key_I: | 1665 | case Qt::Key_I: |
1665 | mView->showIncidence(); | 1666 | mView->showIncidence(); |
1666 | break; | 1667 | break; |
1667 | case Qt::Key_Delete: | 1668 | case Qt::Key_Delete: |
1668 | case Qt::Key_Backspace: | 1669 | case Qt::Key_Backspace: |
1669 | mView->deleteIncidence(); | 1670 | mView->deleteIncidence(); |
1670 | break; | 1671 | break; |
1671 | case Qt::Key_D: | 1672 | case Qt::Key_D: |
1672 | mView->viewManager()->showDayView(); | 1673 | mView->viewManager()->showDayView(); |
1673 | showSelectedDates = true; | 1674 | showSelectedDates = true; |
1674 | break; | 1675 | break; |
1675 | case Qt::Key_O: | 1676 | case Qt::Key_O: |
1676 | mView->toggleFilerEnabled( ); | 1677 | mView->toggleFilerEnabled( ); |
1677 | break; | 1678 | break; |
1678 | case Qt::Key_0: | 1679 | case Qt::Key_0: |
1679 | case Qt::Key_1: | 1680 | case Qt::Key_1: |
1680 | case Qt::Key_2: | 1681 | case Qt::Key_2: |
1681 | case Qt::Key_3: | 1682 | case Qt::Key_3: |
1682 | case Qt::Key_4: | 1683 | case Qt::Key_4: |
1683 | case Qt::Key_5: | 1684 | case Qt::Key_5: |
1684 | case Qt::Key_6: | 1685 | case Qt::Key_6: |
1685 | case Qt::Key_7: | 1686 | case Qt::Key_7: |
1686 | case Qt::Key_8: | 1687 | case Qt::Key_8: |
1687 | case Qt::Key_9: | 1688 | case Qt::Key_9: |
1688 | pro = e->key()-48; | 1689 | pro = e->key()-48; |
1689 | if ( pro == 0 ) | 1690 | if ( pro == 0 ) |
1690 | pro = 10; | 1691 | pro = 10; |
1691 | if ( e->state() == Qt::ControlButton) | 1692 | if ( e->state() == Qt::ControlButton) |
1692 | pro += 10; | 1693 | pro += 10; |
1693 | break; | 1694 | break; |
1694 | case Qt::Key_M: | 1695 | case Qt::Key_M: |
1695 | mView->viewManager()->showMonthView(); | 1696 | mView->viewManager()->showMonthView(); |
1696 | showSelectedDates = true; | 1697 | showSelectedDates = true; |
1697 | break; | 1698 | break; |
1698 | case Qt::Key_Insert: | 1699 | case Qt::Key_Insert: |
1699 | mView->newEvent(); | 1700 | mView->newEvent(); |
1700 | break; | 1701 | break; |
1701 | case Qt::Key_S : | 1702 | case Qt::Key_S : |
1702 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 1703 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1703 | mView->newSubTodo(); | 1704 | mView->newSubTodo(); |
1704 | else | 1705 | else |
1705 | mView->dialogManager()->showSearchDialog(); | 1706 | mView->dialogManager()->showSearchDialog(); |
1706 | break; | 1707 | break; |
1707 | case Qt::Key_Y : | 1708 | case Qt::Key_Y : |
1708 | case Qt::Key_Z : | 1709 | case Qt::Key_Z : |
1709 | mView->viewManager()->showWorkWeekView(); | 1710 | mView->viewManager()->showWorkWeekView(); |
1710 | showSelectedDates = true; | 1711 | showSelectedDates = true; |
1711 | break; | 1712 | break; |
1712 | case Qt::Key_U : | 1713 | case Qt::Key_U : |
1713 | mView->viewManager()->showWeekView(); | 1714 | mView->viewManager()->showWeekView(); |
1714 | showSelectedDates = true; | 1715 | showSelectedDates = true; |
1715 | break; | 1716 | break; |
1716 | case Qt::Key_H : | 1717 | case Qt::Key_H : |
1717 | keyBindings(); | 1718 | keyBindings(); |
1718 | break; | 1719 | break; |
1719 | case Qt::Key_W: | 1720 | case Qt::Key_W: |
1720 | mView->viewManager()->showWhatsNextView(); | 1721 | mView->viewManager()->showWhatsNextView(); |
1721 | break; | 1722 | break; |
1722 | case Qt::Key_L: | 1723 | case Qt::Key_L: |
1723 | mView->viewManager()->showListView(); | 1724 | mView->viewManager()->showListView(); |
1724 | break; | 1725 | break; |
1725 | case Qt::Key_N: | 1726 | case Qt::Key_N: |
1726 | mView->viewManager()->showNextXView(); | 1727 | mView->viewManager()->showNextXView(); |
1727 | showSelectedDates = true; | 1728 | showSelectedDates = true; |
1728 | break; | 1729 | break; |
1729 | case Qt::Key_V: | 1730 | case Qt::Key_V: |
1730 | mView->viewManager()->showTodoView(); | 1731 | mView->viewManager()->showTodoView(); |
1731 | break; | 1732 | break; |
1732 | case Qt::Key_C: | 1733 | case Qt::Key_C: |
1733 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); | 1734 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); |
1734 | break; | 1735 | break; |
1735 | case Qt::Key_P: | 1736 | case Qt::Key_P: |
1736 | mView->showDatePicker( ); | 1737 | mView->showDatePicker( ); |
1737 | break; | 1738 | break; |
1738 | case Qt::Key_F: | 1739 | case Qt::Key_F: |
1739 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1740 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1740 | mView->editFilters(); | 1741 | mView->editFilters(); |
1741 | else | 1742 | else |
1742 | mView->toggleFilter(); | 1743 | mView->toggleFilter(); |
1743 | break; | 1744 | break; |
1744 | case Qt::Key_X: | 1745 | case Qt::Key_X: |
1745 | mView->toggleDateNavigatorWidget(); | 1746 | mView->toggleDateNavigatorWidget(); |
1746 | break; | 1747 | break; |
1747 | case Qt::Key_Space: | 1748 | case Qt::Key_Space: |
1748 | mView->toggleExpand(); | 1749 | mView->toggleExpand(); |