author | zautrix <zautrix> | 2005-10-12 11:14:13 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-10-12 11:14:13 (UTC) |
commit | a72f3f3acfac791715a1c512fc4cc4c3facdbb62 (patch) (unidiff) | |
tree | 202c588777f8d4585a8c57164b1b412d7ad73e8a /korganizer | |
parent | 3ecfc912f657a710ed35c93dc6eb2991cce06835 (diff) | |
download | kdepimpi-a72f3f3acfac791715a1c512fc4cc4c3facdbb62.zip kdepimpi-a72f3f3acfac791715a1c512fc4cc4c3facdbb62.tar.gz kdepimpi-a72f3f3acfac791715a1c512fc4cc4c3facdbb62.tar.bz2 |
fix
-rw-r--r-- | korganizer/mainwindow.cpp | 75 | ||||
-rw-r--r-- | korganizer/mainwindow.h | 4 |
2 files changed, 62 insertions, 17 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index c597138..66bb19b 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -1,2778 +1,2821 @@ | |||
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/qpetoolbar.h> | 24 | #include <qpe/qpetoolbar.h> |
25 | #include <qpe/resource.h> | 25 | #include <qpe/resource.h> |
26 | #include <qpe/qpeapplication.h> | 26 | #include <qpe/qpeapplication.h> |
27 | #include <qtopia/alarmserver.h> | 27 | #include <qtopia/alarmserver.h> |
28 | #include <qtopia/qcopenvelope_qws.h> | 28 | #include <qtopia/qcopenvelope_qws.h> |
29 | //#include <unistd.h> // for sleep | 29 | //#include <unistd.h> // for sleep |
30 | #else | 30 | #else |
31 | #include <qtoolbar.h> | 31 | #include <qtoolbar.h> |
32 | #include <qapplication.h> | 32 | #include <qapplication.h> |
33 | //#include <resource.h> | 33 | //#include <resource.h> |
34 | 34 | ||
35 | #endif | 35 | #endif |
36 | #include <libkcal/calendarlocal.h> | 36 | #include <libkcal/calendarlocal.h> |
37 | #include <libkcal/todo.h> | 37 | #include <libkcal/todo.h> |
38 | #include <libkcal/phoneformat.h> | 38 | #include <libkcal/phoneformat.h> |
39 | #include <libkdepim/ksyncprofile.h> | 39 | #include <libkdepim/ksyncprofile.h> |
40 | #include <libkdepim/phoneaccess.h> | 40 | #include <libkdepim/phoneaccess.h> |
41 | #include <libkcal/kincidenceformatter.h> | 41 | #include <libkcal/kincidenceformatter.h> |
42 | #include <libkdepim/kpimglobalprefs.h> | 42 | #include <libkdepim/kpimglobalprefs.h> |
43 | 43 | ||
44 | #include "calendarview.h" | 44 | #include "calendarview.h" |
45 | #include "koviewmanager.h" | 45 | #include "koviewmanager.h" |
46 | #include "datenavigator.h" | 46 | #include "datenavigator.h" |
47 | #include "koagendaview.h" | 47 | #include "koagendaview.h" |
48 | #include "kojournalview.h" | 48 | #include "kojournalview.h" |
49 | #include "koagenda.h" | 49 | #include "koagenda.h" |
50 | #include "kodialogmanager.h" | 50 | #include "kodialogmanager.h" |
51 | #include "kdialogbase.h" | 51 | #include "kdialogbase.h" |
52 | #include "kapplication.h" | 52 | #include "kapplication.h" |
53 | #include "kofilterview.h" | 53 | #include "kofilterview.h" |
54 | #include "kstandarddirs.h" | 54 | #include "kstandarddirs.h" |
55 | #include "koprefs.h" | 55 | #include "koprefs.h" |
56 | #include "kfiledialog.h" | 56 | #include "kfiledialog.h" |
57 | #include "koglobals.h" | 57 | #include "koglobals.h" |
58 | #include "kglobal.h" | 58 | #include "kglobal.h" |
59 | #include "ktoolbar.h" | 59 | #include "ktoolbar.h" |
60 | #include "klocale.h" | 60 | #include "klocale.h" |
61 | #include "kconfig.h" | 61 | #include "kconfig.h" |
62 | #include "externalapphandler.h" | 62 | #include "externalapphandler.h" |
63 | #include <kglobalsettings.h> | 63 | #include <kglobalsettings.h> |
64 | 64 | ||
65 | using namespace KCal; | 65 | using namespace KCal; |
66 | #ifndef _WIN32_ | 66 | #ifndef _WIN32_ |
67 | #include <unistd.h> | 67 | #include <unistd.h> |
68 | #else | 68 | #else |
69 | #ifdef _OL_IMPORT_ | 69 | #ifdef _OL_IMPORT_ |
70 | #include "koimportoldialog.h" | 70 | #include "koimportoldialog.h" |
71 | #endif | 71 | #endif |
72 | #endif | 72 | #endif |
73 | #include "mainwindow.h" | 73 | #include "mainwindow.h" |
74 | 74 | ||
75 | 75 | ||
76 | class KOex2phonePrefs : public QDialog | 76 | class KOex2phonePrefs : public QDialog |
77 | { | 77 | { |
78 | public: | 78 | public: |
79 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : | 79 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : |
80 | QDialog( parent, name, true ) | 80 | QDialog( parent, name, true ) |
81 | { | 81 | { |
82 | setCaption( i18n("Export to phone options") ); | 82 | setCaption( i18n("Export to phone options") ); |
83 | QVBoxLayout* lay = new QVBoxLayout( this ); | 83 | QVBoxLayout* lay = new QVBoxLayout( this ); |
84 | lay->setSpacing( 3 ); | 84 | lay->setSpacing( 3 ); |
85 | lay->setMargin( 3 ); | 85 | lay->setMargin( 3 ); |
86 | QLabel *lab; | 86 | QLabel *lab; |
87 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); | 87 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); |
88 | lab->setAlignment (AlignHCenter ); | 88 | lab->setAlignment (AlignHCenter ); |
89 | QHBox* temphb; | 89 | QHBox* temphb; |
90 | temphb = new QHBox( this ); | 90 | temphb = new QHBox( this ); |
91 | new QLabel( i18n("I/O device: "), temphb ); | 91 | new QLabel( i18n("I/O device: "), temphb ); |
92 | mPhoneDevice = new QLineEdit( temphb); | 92 | mPhoneDevice = new QLineEdit( temphb); |
93 | lay->addWidget( temphb ); | 93 | lay->addWidget( temphb ); |
94 | temphb = new QHBox( this ); | 94 | temphb = new QHBox( this ); |
95 | new QLabel( i18n("Connection: "), temphb ); | 95 | new QLabel( i18n("Connection: "), temphb ); |
96 | mPhoneConnection = new QLineEdit( temphb); | 96 | mPhoneConnection = new QLineEdit( temphb); |
97 | lay->addWidget( temphb ); | 97 | lay->addWidget( temphb ); |
98 | temphb = new QHBox( this ); | 98 | temphb = new QHBox( this ); |
99 | new QLabel( i18n("Model(opt.): "), temphb ); | 99 | new QLabel( i18n("Model(opt.): "), temphb ); |
100 | mPhoneModel = new QLineEdit( temphb); | 100 | mPhoneModel = new QLineEdit( temphb); |
101 | lay->addWidget( temphb ); | 101 | lay->addWidget( temphb ); |
102 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); | 102 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); |
103 | mWriteBackFuture->setChecked( true ); | 103 | mWriteBackFuture->setChecked( true ); |
104 | lay->addWidget( mWriteBackFuture ); | 104 | lay->addWidget( mWriteBackFuture ); |
105 | temphb = new QHBox( this ); | 105 | temphb = new QHBox( this ); |
106 | new QLabel( i18n("Max. weeks in future: ") , temphb ); | 106 | new QLabel( i18n("Max. weeks in future: ") , temphb ); |
107 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); | 107 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); |
108 | mWriteBackFutureWeeks->setValue( 8 ); | 108 | mWriteBackFutureWeeks->setValue( 8 ); |
109 | lay->addWidget( temphb ); | 109 | lay->addWidget( temphb ); |
110 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); | 110 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); |
111 | lab->setAlignment (AlignHCenter ); | 111 | lab->setAlignment (AlignHCenter ); |
112 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); | 112 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); |
113 | lay->addWidget( ok ); | 113 | lay->addWidget( ok ); |
114 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 114 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
115 | lay->addWidget( cancel ); | 115 | lay->addWidget( cancel ); |
116 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 116 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
117 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 117 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
118 | resize( 220, 240 ); | 118 | resize( 220, 240 ); |
119 | qApp->processEvents(); | 119 | qApp->processEvents(); |
120 | int dw = QApplication::desktop()->width(); | 120 | int dw = QApplication::desktop()->width(); |
121 | int dh = QApplication::desktop()->height(); | 121 | int dh = QApplication::desktop()->height(); |
122 | move( (dw-width())/2, (dh - height() )/2 ); | 122 | move( (dw-width())/2, (dh - height() )/2 ); |
123 | } | 123 | } |
124 | 124 | ||
125 | public: | 125 | public: |
126 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; | 126 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; |
127 | QCheckBox* mWriteBackFuture; | 127 | QCheckBox* mWriteBackFuture; |
128 | QSpinBox* mWriteBackFutureWeeks; | 128 | QSpinBox* mWriteBackFutureWeeks; |
129 | }; | 129 | }; |
130 | 130 | ||
131 | QPixmap* sgListViewCompletedPix[6]; | 131 | QPixmap* sgListViewCompletedPix[6]; |
132 | QPixmap* sgListViewJournalPix; | 132 | QPixmap* sgListViewJournalPix; |
133 | 133 | ||
134 | 134 | ||
135 | int globalFlagBlockStartup; | 135 | int globalFlagBlockStartup; |
136 | MainWindow::MainWindow( QWidget *parent, const char *name ) : | 136 | MainWindow::MainWindow( QWidget *parent, const char *name ) : |
137 | QMainWindow( parent, name ) | 137 | QMainWindow( parent, name ) |
138 | { | 138 | { |
139 | sgListViewCompletedPix[5] = &listviewPix; | 139 | sgListViewCompletedPix[5] = &listviewPix; |
140 | sgListViewCompletedPix[0] = &listviewPix0; | 140 | sgListViewCompletedPix[0] = &listviewPix0; |
141 | sgListViewCompletedPix[1] = &listviewPix20; | 141 | sgListViewCompletedPix[1] = &listviewPix20; |
142 | sgListViewCompletedPix[2] = &listviewPix40; | 142 | sgListViewCompletedPix[2] = &listviewPix40; |
143 | sgListViewCompletedPix[3] = &listviewPix60; | 143 | sgListViewCompletedPix[3] = &listviewPix60; |
144 | sgListViewCompletedPix[4] = &listviewPix80; | 144 | sgListViewCompletedPix[4] = &listviewPix80; |
145 | //int size = 12; | 145 | //int size = 12; |
146 | { | 146 | { |
147 | sgListViewCompletedPix[5]->resize( 11, 11 ); | 147 | sgListViewCompletedPix[5]->resize( 11, 11 ); |
148 | sgListViewCompletedPix[5]->fill( Qt::white ); | 148 | sgListViewCompletedPix[5]->fill( Qt::white ); |
149 | QPainter p ( sgListViewCompletedPix[5] ); | 149 | QPainter p ( sgListViewCompletedPix[5] ); |
150 | p.drawRect( 0,0,11,11); | 150 | p.drawRect( 0,0,11,11); |
151 | p.drawLine ( 2, 5, 4 , 7 ) ; | 151 | p.drawLine ( 2, 5, 4 , 7 ) ; |
152 | p.drawLine ( 4 , 7 , 8, 3) ; | 152 | p.drawLine ( 4 , 7 , 8, 3) ; |
153 | int iii = 0; | 153 | int iii = 0; |
154 | for ( iii = 0; iii < 5; ++iii ) { | 154 | for ( iii = 0; iii < 5; ++iii ) { |
155 | sgListViewCompletedPix[iii]->resize( 11, 11 ); | 155 | sgListViewCompletedPix[iii]->resize( 11, 11 ); |
156 | sgListViewCompletedPix[iii]->fill( Qt::white ); | 156 | sgListViewCompletedPix[iii]->fill( Qt::white ); |
157 | QPainter p ( sgListViewCompletedPix[iii] ); | 157 | QPainter p ( sgListViewCompletedPix[iii] ); |
158 | p.drawRect( 0,0,11,11); | 158 | p.drawRect( 0,0,11,11); |
159 | if ( iii ) | 159 | if ( iii ) |
160 | p.fillRect( 1,1,iii*2,9,Qt::gray ); | 160 | p.fillRect( 1,1,iii*2,9,Qt::gray ); |
161 | } | 161 | } |
162 | sgListViewJournalPix = &journalPix; | 162 | sgListViewJournalPix = &journalPix; |
163 | sgListViewJournalPix->resize( 11, 11 ); | 163 | sgListViewJournalPix->resize( 11, 11 ); |
164 | sgListViewJournalPix->fill( Qt::white ); | 164 | sgListViewJournalPix->fill( Qt::white ); |
165 | { | 165 | { |
166 | QPainter p ( sgListViewJournalPix ); | 166 | QPainter p ( sgListViewJournalPix ); |
167 | p.drawRect( 0,0,11,11); | 167 | p.drawRect( 0,0,11,11); |
168 | p.drawLine( 2,3,5,3); | 168 | p.drawLine( 2,3,5,3); |
169 | p.drawLine( 2,5,8,5); | 169 | p.drawLine( 2,5,8,5); |
170 | p.drawLine( 2,7,6,7); | 170 | p.drawLine( 2,7,6,7); |
171 | } | 171 | } |
172 | } | 172 | } |
173 | mAutoSaveDisabled = false; | ||
173 | mClosed = false; | 174 | mClosed = false; |
174 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; | 175 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; |
175 | QString confFile = locateLocal("config","korganizerrc"); | 176 | QString confFile = locateLocal("config","korganizerrc"); |
176 | QFileInfo finf ( confFile ); | 177 | QFileInfo finf ( confFile ); |
177 | bool showWarning = !finf.exists(); | 178 | bool showWarning = !finf.exists(); |
178 | setIcon(SmallIcon( "ko24" ) ); | 179 | setIcon(SmallIcon( "ko24" ) ); |
179 | mBlockAtStartup = true; | 180 | mBlockAtStartup = true; |
180 | mFlagKeyPressed = false; | 181 | mFlagKeyPressed = false; |
181 | setCaption("KO/Pi"); | 182 | setCaption("KO/Pi"); |
182 | KOPrefs *p = KOPrefs::instance(); | 183 | KOPrefs *p = KOPrefs::instance(); |
183 | //KPimGlobalPrefs::instance()->setGlobalConfig(); | 184 | //KPimGlobalPrefs::instance()->setGlobalConfig(); |
184 | p->mCurrentDisplayedView = 0; | 185 | p->mCurrentDisplayedView = 0; |
185 | if ( p->mHourSize > 22 ) | 186 | if ( p->mHourSize > 22 ) |
186 | p->mHourSize = 22; | 187 | p->mHourSize = 22; |
187 | QMainWindow::ToolBarDock tbd; | 188 | QMainWindow::ToolBarDock tbd; |
188 | if ( p->mToolBarHor ) { | 189 | if ( p->mToolBarHor ) { |
189 | if ( p->mToolBarUp ) | 190 | if ( p->mToolBarUp ) |
190 | tbd = Bottom; | 191 | tbd = Bottom; |
191 | else | 192 | else |
192 | tbd = Top; | 193 | tbd = Top; |
193 | } | 194 | } |
194 | else { | 195 | else { |
195 | if ( p->mToolBarUp ) | 196 | if ( p->mToolBarUp ) |
196 | tbd = Right; | 197 | tbd = Right; |
197 | else | 198 | else |
198 | tbd = Left; | 199 | tbd = Left; |
199 | } | 200 | } |
200 | if ( KOPrefs::instance()->mUseAppColors ) | 201 | if ( KOPrefs::instance()->mUseAppColors ) |
201 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 202 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
202 | globalFlagBlockStartup = 1; | 203 | globalFlagBlockStartup = 1; |
203 | iconToolBar = new QPEToolBar( this ); | 204 | iconToolBar = new QPEToolBar( this ); |
204 | addToolBar (iconToolBar , tbd ); | 205 | addToolBar (iconToolBar , tbd ); |
205 | 206 | ||
206 | #ifdef DESKTOP_VERSION | 207 | #ifdef DESKTOP_VERSION |
207 | if ( KOPrefs::instance()->mShowIconFilter ) | 208 | if ( KOPrefs::instance()->mShowIconFilter ) |
208 | #else | 209 | #else |
209 | if ( KOPrefs::instance()->mShowIconFilter || ( !p->mShowIconOnetoolbar &&!p->mShowIconFilterview ) ) | 210 | if ( KOPrefs::instance()->mShowIconFilter || ( !p->mShowIconOnetoolbar &&!p->mShowIconFilterview ) ) |
210 | #endif | 211 | #endif |
211 | 212 | ||
212 | { | 213 | { |
213 | if ( p->mToolBarHorF ) { | 214 | if ( p->mToolBarHorF ) { |
214 | if ( p->mToolBarUpF ) | 215 | if ( p->mToolBarUpF ) |
215 | tbd = Bottom; | 216 | tbd = Bottom; |
216 | else | 217 | else |
217 | tbd = Top; | 218 | tbd = Top; |
218 | } | 219 | } |
219 | else { | 220 | else { |
220 | if ( p->mToolBarUpF ) | 221 | if ( p->mToolBarUpF ) |
221 | tbd = Right; | 222 | tbd = Right; |
222 | else | 223 | else |
223 | tbd = Left; | 224 | tbd = Left; |
224 | } | 225 | } |
225 | filterToolBar = new QPEToolBar ( this ); | 226 | filterToolBar = new QPEToolBar ( this ); |
226 | filterMenubar = new KMenuBar( 0 ); | 227 | filterMenubar = new KMenuBar( 0 ); |
227 | QFontMetrics fm ( filterMenubar->font() ); | 228 | QFontMetrics fm ( filterMenubar->font() ); |
228 | #ifndef DESKTOP_VERSION | 229 | #ifndef DESKTOP_VERSION |
229 | filterToolBar->setFocusPolicy( NoFocus ); | 230 | filterToolBar->setFocusPolicy( NoFocus ); |
230 | filterMenubar->setFocusPolicy( NoFocus ); | 231 | filterMenubar->setFocusPolicy( NoFocus ); |
231 | #endif | 232 | #endif |
232 | filterPopupMenu = new QPopupMenu( this ); | 233 | filterPopupMenu = new QPopupMenu( this ); |
233 | filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 ); | 234 | filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 ); |
234 | QString addTest = "A"; | 235 | QString addTest = "A"; |
235 | filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) ); | 236 | filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) ); |
236 | #ifdef DESKTOP_VERSION | 237 | #ifdef DESKTOP_VERSION |
237 | addTest = "AAAAAABBBCCCx"; | 238 | addTest = "AAAAAABBBCCCx"; |
238 | #else | 239 | #else |
239 | addTest = "AAAAAx"; | 240 | addTest = "AAAAAx"; |
240 | #endif | 241 | #endif |
241 | filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) ); | 242 | filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) ); |
242 | addToolBar (filterToolBar , tbd ); | 243 | addToolBar (filterToolBar , tbd ); |
243 | connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) ); | 244 | connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) ); |
244 | connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) ); | 245 | connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) ); |
245 | if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar ) | 246 | if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar ) |
246 | filterToolBar->hide(); | 247 | filterToolBar->hide(); |
247 | } else { | 248 | } else { |
248 | filterToolBar = 0; | 249 | filterToolBar = 0; |
249 | filterMenubar = 0; | 250 | filterMenubar = 0; |
250 | filterPopupMenu = 0; | 251 | filterPopupMenu = 0; |
251 | } | 252 | } |
252 | if ( p->mShowIconOnetoolbar ) { | 253 | if ( p->mShowIconOnetoolbar ) { |
253 | viewToolBar = iconToolBar ; | 254 | viewToolBar = iconToolBar ; |
254 | navigatorToolBar = iconToolBar ; | 255 | navigatorToolBar = iconToolBar ; |
255 | } else { | 256 | } else { |
256 | #ifndef DESKTOP_VERSION | 257 | #ifndef DESKTOP_VERSION |
257 | setToolBarsMovable( false ); | 258 | setToolBarsMovable( false ); |
258 | #endif | 259 | #endif |
259 | if ( p->mToolBarHorV ) { | 260 | if ( p->mToolBarHorV ) { |
260 | if ( p->mToolBarUpV ) | 261 | if ( p->mToolBarUpV ) |
261 | tbd = Bottom; | 262 | tbd = Bottom; |
262 | else | 263 | else |
263 | tbd = Top; | 264 | tbd = Top; |
264 | } | 265 | } |
265 | else { | 266 | else { |
266 | if ( p->mToolBarUpV ) | 267 | if ( p->mToolBarUpV ) |
267 | tbd = Right; | 268 | tbd = Right; |
268 | else | 269 | else |
269 | tbd = Left; | 270 | tbd = Left; |
270 | } | 271 | } |
271 | viewToolBar = new QPEToolBar( this ); | 272 | viewToolBar = new QPEToolBar( this ); |
272 | addToolBar (viewToolBar , tbd ); | 273 | addToolBar (viewToolBar , tbd ); |
273 | if ( p->mToolBarHorN ) { | 274 | if ( p->mToolBarHorN ) { |
274 | if ( p->mToolBarUpN ) | 275 | if ( p->mToolBarUpN ) |
275 | tbd = Bottom; | 276 | tbd = Bottom; |
276 | else | 277 | else |
277 | tbd = Top; | 278 | tbd = Top; |
278 | } | 279 | } |
279 | else { | 280 | else { |
280 | if ( p->mToolBarUpN ) | 281 | if ( p->mToolBarUpN ) |
281 | tbd = Right; | 282 | tbd = Right; |
282 | else | 283 | else |
283 | tbd = Left; | 284 | tbd = Left; |
284 | } | 285 | } |
285 | navigatorToolBar = new QPEToolBar( this ); | 286 | navigatorToolBar = new QPEToolBar( this ); |
286 | addToolBar (navigatorToolBar , tbd ); | 287 | addToolBar (navigatorToolBar , tbd ); |
287 | } | 288 | } |
288 | 289 | ||
289 | 290 | ||
290 | 291 | ||
291 | mCalendarModifiedFlag = false; | 292 | mCalendarModifiedFlag = false; |
292 | // QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); | 293 | // QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); |
293 | //splash->setAlignment ( AlignCenter ); | 294 | //splash->setAlignment ( AlignCenter ); |
294 | //setCentralWidget( splash ); | 295 | //setCentralWidget( splash ); |
295 | #ifndef DESKTOP_VERSION | 296 | #ifndef DESKTOP_VERSION |
296 | //showMaximized(); | 297 | //showMaximized(); |
297 | #endif | 298 | #endif |
298 | 299 | ||
299 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); | 300 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); |
300 | setDefaultPreferences(); | 301 | setDefaultPreferences(); |
301 | mCalendar = new CalendarLocal(); | 302 | mCalendar = new CalendarLocal(); |
302 | mView = new CalendarView( mCalendar, this,"mCalendar " ); | 303 | mView = new CalendarView( mCalendar, this,"mCalendar " ); |
303 | setCentralWidget( mView ); | 304 | setCentralWidget( mView ); |
304 | //mView->hide(); | 305 | //mView->hide(); |
305 | //mView->resize(splash->size() ); | 306 | //mView->resize(splash->size() ); |
306 | initActions(); | 307 | initActions(); |
307 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); | 308 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); |
308 | mSyncManager->setBlockSave(false); | 309 | mSyncManager->setBlockSave(false); |
309 | mView->setSyncManager(mSyncManager); | 310 | mView->setSyncManager(mSyncManager); |
310 | #ifndef DESKTOP_VERSION | 311 | #ifndef DESKTOP_VERSION |
311 | iconToolBar->show(); | 312 | iconToolBar->show(); |
312 | qApp->processEvents(); | 313 | qApp->processEvents(); |
313 | #endif | 314 | #endif |
314 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); | 315 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); |
315 | int vh = height() ; | 316 | int vh = height() ; |
316 | int vw = width(); | 317 | int vw = width(); |
317 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); | 318 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); |
318 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 319 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
319 | vh -= iconToolBar->height(); | 320 | vh -= iconToolBar->height(); |
320 | } else { | 321 | } else { |
321 | vw -= iconToolBar->height(); | 322 | vw -= iconToolBar->height(); |
322 | } | 323 | } |
323 | //mView->setMaximumSize( splash->size() ); | 324 | //mView->setMaximumSize( splash->size() ); |
324 | //mView->resize( splash->size() ); | 325 | //mView->resize( splash->size() ); |
325 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 326 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
326 | mView->readSettings(); | 327 | mView->readSettings(); |
327 | bool newFile = false; | 328 | bool newFile = false; |
328 | if( !QFile::exists( defaultFileName() ) ) { | 329 | if( !QFile::exists( defaultFileName() ) ) { |
329 | QFileInfo finfo ( defaultFileName() ); | 330 | QFileInfo finfo ( defaultFileName() ); |
330 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); | 331 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); |
331 | 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"; | 332 | 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"; |
332 | finfo.setFile( oldFile ); | 333 | finfo.setFile( oldFile ); |
333 | if (finfo.exists() ) { | 334 | if (finfo.exists() ) { |
334 | KMessageBox::information( this, message); | 335 | KMessageBox::information( this, message); |
335 | mView->openCalendar( oldFile ); | 336 | mView->openCalendar( oldFile ); |
336 | qApp->processEvents(); | 337 | qApp->processEvents(); |
337 | } else { | 338 | } else { |
338 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); | 339 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); |
339 | finfo.setFile( oldFile ); | 340 | finfo.setFile( oldFile ); |
340 | if (finfo.exists() ) { | 341 | if (finfo.exists() ) { |
341 | KMessageBox::information( this, message); | 342 | KMessageBox::information( this, message); |
342 | mView->openCalendar( oldFile ); | 343 | mView->openCalendar( oldFile ); |
343 | qApp->processEvents(); | 344 | qApp->processEvents(); |
344 | } | 345 | } |
345 | } | 346 | } |
346 | mView->saveCalendar( defaultFileName() ); | 347 | mView->saveCalendar( defaultFileName() ); |
347 | newFile = true; | 348 | newFile = true; |
348 | } | 349 | } |
349 | 350 | ||
350 | //QTime neededSaveTime = QDateTime::currentDateTime().time(); | 351 | //QTime neededSaveTime = QDateTime::currentDateTime().time(); |
351 | //mView->loadCalendars(); | 352 | //mView->loadCalendars(); |
352 | //int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 353 | //int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
353 | //qDebug("KO: Calendar loading time: %d ms",msNeeded ); | 354 | //qDebug("KO: Calendar loading time: %d ms",msNeeded ); |
354 | 355 | ||
355 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { | 356 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { |
356 | KOPrefs::instance()->setAllDefaults(); | 357 | KOPrefs::instance()->setAllDefaults(); |
357 | } | 358 | } |
358 | 359 | ||
359 | 360 | ||
360 | connect( mView, SIGNAL( tempDisableBR(bool) ), | 361 | connect( mView, SIGNAL( tempDisableBR(bool) ), |
361 | SLOT( disableBR(bool) ) ); | 362 | SLOT( disableBR(bool) ) ); |
362 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); | 363 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); |
363 | setCentralWidget( mView ); | 364 | setCentralWidget( mView ); |
364 | globalFlagBlockStartup = 0; | 365 | globalFlagBlockStartup = 0; |
365 | //mView->show(); | 366 | //mView->show(); |
366 | //delete splash; | 367 | //delete splash; |
367 | if ( newFile ) | 368 | if ( newFile ) |
368 | mView->updateConfig(); | 369 | mView->updateConfig(); |
369 | // qApp->processEvents(); | 370 | // qApp->processEvents(); |
370 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 371 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
371 | //fillSyncMenu(); | 372 | //fillSyncMenu(); |
372 | 373 | ||
373 | 374 | ||
374 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); | 375 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); |
375 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); | 376 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); |
376 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 377 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); |
377 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 378 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
378 | mSyncManager->setDefaultFileName( sentSyncFile()); | 379 | mSyncManager->setDefaultFileName( sentSyncFile()); |
379 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); | 380 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); |
380 | mSyncManager->fillSyncMenu(); | 381 | mSyncManager->fillSyncMenu(); |
381 | 382 | ||
382 | 383 | ||
383 | 384 | ||
384 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); | 385 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); |
385 | if ( showWarning ) { | 386 | if ( showWarning ) { |
386 | KMessageBox::information( this, | 387 | KMessageBox::information( this, |
387 | "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"); | 388 | "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"); |
388 | //qApp->processEvents(); | 389 | //qApp->processEvents(); |
389 | mView->dialogManager()->showSyncOptions(); | 390 | mView->dialogManager()->showSyncOptions(); |
390 | } | 391 | } |
391 | 392 | ||
392 | //US listen for result adressed from Ka/Pi | 393 | //US listen for result adressed from Ka/Pi |
393 | 394 | ||
394 | #ifndef DESKTOP_VERSION | 395 | #ifndef DESKTOP_VERSION |
395 | infrared = 0; | 396 | infrared = 0; |
396 | #endif | 397 | #endif |
397 | updateFilterToolbar(); | 398 | updateFilterToolbar(); |
398 | updateWeek( mView->startDate() ); | 399 | updateWeek( mView->startDate() ); |
399 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), | 400 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), |
400 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); | 401 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); |
401 | mBRdisabled = false; | 402 | mBRdisabled = false; |
402 | //toggleBeamReceive(); | 403 | //toggleBeamReceive(); |
403 | 404 | ||
404 | setCaption(i18n("Loading calendar files ... please wait" )); | 405 | setCaption(i18n("Loading calendar files ... please wait" )); |
405 | mSaveDelay = 0; | 406 | mSaveDelay = 0; |
406 | QTimer::singleShot( 10, this, SLOT ( loadDataAfterStart() )); | 407 | QTimer::singleShot( 10, this, SLOT ( loadDataAfterStart() )); |
407 | } | 408 | } |
408 | MainWindow::~MainWindow() | 409 | MainWindow::~MainWindow() |
409 | { | 410 | { |
410 | //qDebug("MainWindow::~MainWindow() "); | 411 | //qDebug("MainWindow::~MainWindow() "); |
411 | //save toolbar location | 412 | //save toolbar location |
412 | delete mCalendar; | 413 | delete mCalendar; |
413 | delete mSyncManager; | 414 | delete mSyncManager; |
414 | #ifndef DESKTOP_VERSION | 415 | #ifndef DESKTOP_VERSION |
415 | if ( infrared ) | 416 | if ( infrared ) |
416 | delete infrared; | 417 | delete infrared; |
417 | #endif | 418 | #endif |
418 | 419 | ||
419 | 420 | ||
420 | } | 421 | } |
421 | 422 | ||
422 | void MainWindow::loadDataAfterStart() | 423 | void MainWindow::loadDataAfterStart() |
423 | { | 424 | { |
424 | qDebug("KO: Start loading files..." ); | 425 | qDebug("KO: Start loading files..." ); |
425 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 426 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
426 | mView->loadCalendars(); | 427 | mView->loadCalendars(); |
427 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 428 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
428 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); | 429 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); |
429 | //QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); | 430 | //QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); |
430 | mView->setModified( false ); | 431 | mView->setModified( false ); |
431 | mBlockAtStartup = false; | 432 | mBlockAtStartup = false; |
432 | mView->setModified( false ); | 433 | mView->setModified( false ); |
433 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); | 434 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); |
434 | processIncidenceSelection( 0 ); | 435 | processIncidenceSelection( 0 ); |
435 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), | 436 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), |
436 | SLOT( processIncidenceSelection( Incidence * ) ) ); | 437 | SLOT( processIncidenceSelection( Incidence * ) ) ); |
437 | connect( mView, SIGNAL( modifiedChanged( bool ) ), | 438 | connect( mView, SIGNAL( modifiedChanged( bool ) ), |
438 | SLOT( slotModifiedChanged( bool ) ) ); | 439 | SLOT( slotModifiedChanged( bool ) ) ); |
439 | #ifndef DESKTOP_VERSION | 440 | #ifndef DESKTOP_VERSION |
440 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 441 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
441 | connect( qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT(recieve( const QCString&, const QByteArray& ))); | 442 | connect( qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT(recieve( const QCString&, const QByteArray& ))); |
442 | disconnect( qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT(receiveStart( const QCString&, const QByteArray& ))); | 443 | disconnect( qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT(receiveStart( const QCString&, const QByteArray& ))); |
443 | if ( !mCStringMess.isEmpty() ) | 444 | if ( !mCStringMess.isEmpty() ) |
444 | recieve( mCStringMess, mByteData ); | 445 | recieve( mCStringMess, mByteData ); |
445 | #endif | 446 | #endif |
446 | QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); | 447 | QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); |
447 | } | 448 | } |
448 | 449 | ||
449 | void MainWindow::slotResetFocus() | 450 | void MainWindow::slotResetFocus() |
450 | { | 451 | { |
451 | //qDebug(" CalendarView::slotResetFocus() %x %x %x %x", qApp->focusWidget(), menuBar1, mView,iconToolBar); | 452 | //qDebug(" CalendarView::slotResetFocus() %x %x %x %x", qApp->focusWidget(), menuBar1, mView,iconToolBar); |
452 | mFocusLoop = 3; | 453 | mFocusLoop = 3; |
453 | QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); | 454 | QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); |
454 | } | 455 | } |
455 | void MainWindow::slotResetFocusLoop() | 456 | void MainWindow::slotResetFocusLoop() |
456 | { | 457 | { |
457 | --mFocusLoop; | 458 | --mFocusLoop; |
458 | QWidget* fw = mView->viewManager()->currentView(); | 459 | QWidget* fw = mView->viewManager()->currentView(); |
459 | if ( fw ) { | 460 | if ( fw ) { |
460 | //qDebug("loop "); | 461 | //qDebug("loop "); |
461 | fw->setFocus(); | 462 | fw->setFocus(); |
462 | if ( qApp->focusWidget() != fw && mFocusLoop > 0 ) | 463 | if ( qApp->focusWidget() != fw && mFocusLoop > 0 ) |
463 | QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); | 464 | QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); |
464 | } | 465 | } |
465 | 466 | ||
466 | } | 467 | } |
467 | void MainWindow::disableBR(bool b) | 468 | void MainWindow::disableBR(bool b) |
468 | { | 469 | { |
469 | #ifndef DESKTOP_VERSION | 470 | #ifndef DESKTOP_VERSION |
470 | if ( b ) { | 471 | if ( b ) { |
471 | if ( infrared ) { | 472 | if ( infrared ) { |
472 | toggleBeamReceive(); | 473 | toggleBeamReceive(); |
473 | mBRdisabled = true; | 474 | mBRdisabled = true; |
474 | } | 475 | } |
475 | mBRdisabled = true; | 476 | mBRdisabled = true; |
476 | } else { | 477 | } else { |
477 | if ( mBRdisabled ) { | 478 | if ( mBRdisabled ) { |
478 | mBRdisabled = false; | 479 | mBRdisabled = false; |
479 | //makes no sense,because other cal ap is probably running | 480 | //makes no sense,because other cal ap is probably running |
480 | // toggleBeamReceive(); | 481 | // toggleBeamReceive(); |
481 | } | 482 | } |
482 | } | 483 | } |
483 | #endif | 484 | #endif |
484 | 485 | ||
485 | } | 486 | } |
486 | bool MainWindow::beamReceiveEnabled() | 487 | bool MainWindow::beamReceiveEnabled() |
487 | { | 488 | { |
488 | #ifndef DESKTOP_VERSION | 489 | #ifndef DESKTOP_VERSION |
489 | return ( infrared != 0 ); | 490 | return ( infrared != 0 ); |
490 | #endif | 491 | #endif |
491 | return false; | 492 | return false; |
492 | } | 493 | } |
493 | 494 | ||
494 | void MainWindow::toggleBeamReceive() | 495 | void MainWindow::toggleBeamReceive() |
495 | { | 496 | { |
496 | if ( mBRdisabled ) | 497 | if ( mBRdisabled ) |
497 | return; | 498 | return; |
498 | #ifndef DESKTOP_VERSION | 499 | #ifndef DESKTOP_VERSION |
499 | if ( infrared ) { | 500 | if ( infrared ) { |
500 | qDebug("KO: Disable BeamReceive "); | 501 | qDebug("KO: Disable BeamReceive "); |
501 | delete infrared; | 502 | delete infrared; |
502 | infrared = 0; | 503 | infrared = 0; |
503 | brAction->setOn(false); | 504 | brAction->setOn(false); |
504 | return; | 505 | return; |
505 | } | 506 | } |
506 | qDebug("KO: Enable BeamReceive "); | 507 | qDebug("KO: Enable BeamReceive "); |
507 | brAction->setOn(true); | 508 | brAction->setOn(true); |
508 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; | 509 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; |
509 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); | 510 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); |
510 | #endif | 511 | #endif |
511 | } | 512 | } |
512 | void MainWindow::showMaximized () | 513 | void MainWindow::showMaximized () |
513 | { | 514 | { |
514 | #ifndef DESKTOP_VERSION | 515 | #ifndef DESKTOP_VERSION |
515 | if ( ! globalFlagBlockStartup ) | 516 | if ( ! globalFlagBlockStartup ) |
516 | if ( mClosed ) | 517 | if ( mClosed ) |
517 | mView->goToday(); | 518 | mView->goToday(); |
518 | #endif | 519 | #endif |
519 | QWidget::showMaximized () ; | 520 | QWidget::showMaximized () ; |
520 | mClosed = false; | 521 | mClosed = false; |
521 | } | 522 | } |
522 | 523 | ||
523 | bool MainWindow::askForQuitOnSaveError() | 524 | bool MainWindow::askForQuitOnSaveError() |
524 | { | 525 | { |
525 | bool retval = false; | 526 | bool retval = false; |
526 | switch( QMessageBox::information( this, "KO/Pi", | 527 | switch( QMessageBox::information( this, "KO/Pi", |
527 | i18n("Error saving data") + "!\n" + | 528 | i18n("Error saving data") + "!\n" + |
528 | i18n("You can save all data\nto another file via\nFile->Export->Export All Data") + "!\n" + | 529 | i18n("You can save all data\nto another file via\nFile->Export->Export All Data") + "!\n" + |
529 | i18n("Do you really want\nto close KO/Pi?"), | 530 | i18n("Do you really want\nto close KO/Pi?"), |
530 | i18n(" Yes, close "), i18n("No"), | 531 | i18n(" Yes, close "), i18n("No"), |
531 | 0, 1 ) ) { | 532 | 0, 1 ) ) { |
532 | case 0: | 533 | case 0: |
533 | retval = true; | 534 | retval = true; |
534 | break; | 535 | break; |
535 | default: | 536 | default: |
536 | break; | 537 | break; |
537 | } | 538 | } |
538 | return retval; | 539 | return retval; |
539 | } | 540 | } |
540 | 541 | bool MainWindow::checkAutosave() | |
542 | { | ||
543 | bool savedata = true; | ||
544 | if ( mAutoSaveDisabled && mCalendarModifiedFlag ) { | ||
545 | switch( QMessageBox::information( this, "KO/Pi", | ||
546 | i18n("Calendar is modified\nbut Autosave is disabled!\nDo you want\nto save the data?"), | ||
547 | i18n("Yes, Save!"), i18n("No"), | ||
548 | 0, 0 ) ) { | ||
549 | case 1: | ||
550 | case 2: | ||
551 | savedata = false; | ||
552 | break; | ||
553 | default: | ||
554 | break; | ||
555 | } | ||
556 | } | ||
557 | return savedata; | ||
558 | } | ||
541 | void MainWindow::closeEvent( QCloseEvent* ce ) | 559 | void MainWindow::closeEvent( QCloseEvent* ce ) |
542 | { | 560 | { |
543 | |||
544 | |||
545 | |||
546 | if ( ! KOPrefs::instance()->mAskForQuit ) { | 561 | if ( ! KOPrefs::instance()->mAskForQuit ) { |
547 | saveOnClose(); | 562 | if ( checkAutosave() ) { |
548 | if ( mCalendarModifiedFlag && !askForQuitOnSaveError() ) { | 563 | saveOnClose(); |
549 | ce->ignore(); | 564 | if ( mCalendarModifiedFlag && !askForQuitOnSaveError() ) { |
550 | return; | 565 | ce->ignore(); |
566 | return; | ||
567 | } | ||
551 | } | 568 | } |
552 | mClosed = true; | 569 | mClosed = true; |
553 | ce->accept(); | 570 | ce->accept(); |
554 | return; | 571 | return; |
555 | 572 | ||
556 | } | 573 | } |
557 | 574 | ||
558 | switch( QMessageBox::information( this, "KO/Pi", | 575 | switch( QMessageBox::information( this, "KO/Pi", |
559 | i18n("Do you really want\nto close KO/Pi?"), | 576 | i18n("Do you really want\nto close KO/Pi?"), |
560 | i18n("Close"), i18n("No"), | 577 | i18n("Close"), i18n("No"), |
561 | 0, 0 ) ) { | 578 | 0, 0 ) ) { |
562 | case 0: | 579 | case 0: |
563 | saveOnClose(); | 580 | if ( checkAutosave() ) { |
564 | if ( mCalendarModifiedFlag && !askForQuitOnSaveError() ) { | 581 | saveOnClose(); |
565 | ce->ignore(); | 582 | if ( mCalendarModifiedFlag && !askForQuitOnSaveError() ) { |
566 | return; | 583 | ce->ignore(); |
584 | return; | ||
585 | } | ||
567 | } | 586 | } |
568 | mClosed = true; | 587 | mClosed = true; |
569 | ce->accept(); | 588 | ce->accept(); |
570 | break; | 589 | break; |
571 | case 1: | 590 | case 1: |
572 | ce->ignore(); | 591 | ce->ignore(); |
573 | break; | 592 | break; |
574 | case 2: | 593 | case 2: |
575 | 594 | ||
576 | default: | 595 | default: |
577 | break; | 596 | break; |
578 | } | 597 | } |
579 | 598 | ||
580 | 599 | ||
581 | } | 600 | } |
582 | void MainWindow::receiveStart( const QCString& cmsg, const QByteArray& data ) | 601 | void MainWindow::receiveStart( const QCString& cmsg, const QByteArray& data ) |
583 | { | 602 | { |
584 | qDebug("KO: QCOP start message received: %s ", cmsg.data() ); | 603 | qDebug("KO: QCOP start message received: %s ", cmsg.data() ); |
585 | mCStringMess = cmsg; | 604 | mCStringMess = cmsg; |
586 | mByteData = data; | 605 | mByteData = data; |
587 | } | 606 | } |
588 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) | 607 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) |
589 | { | 608 | { |
590 | QDataStream stream( data, IO_ReadOnly ); | 609 | QDataStream stream( data, IO_ReadOnly ); |
591 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); | 610 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); |
592 | //QString datamess; | 611 | //QString datamess; |
593 | //qDebug("message "); | 612 | //qDebug("message "); |
594 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); | 613 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); |
595 | 614 | ||
596 | if ( cmsg == "setDocument(QString)" ) { | 615 | if ( cmsg == "setDocument(QString)" ) { |
597 | QDataStream stream( data, IO_ReadOnly ); | 616 | QDataStream stream( data, IO_ReadOnly ); |
598 | QString fileName; | 617 | QString fileName; |
599 | stream >> fileName; | 618 | stream >> fileName; |
600 | //qDebug("filename %s ", fileName.latin1()); | 619 | //qDebug("filename %s ", fileName.latin1()); |
601 | showMaximized(); | 620 | showMaximized(); |
602 | raise(); | 621 | raise(); |
603 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; | 622 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; |
604 | mSyncManager->slotSyncMenu( 1002 ); | 623 | mSyncManager->slotSyncMenu( 1002 ); |
605 | return; | 624 | return; |
606 | } | 625 | } |
607 | 626 | ||
608 | if ( cmsg == "-writeFile" ) { | 627 | if ( cmsg == "-writeFile" ) { |
609 | // I made from the "-writeFile" an "-writeAlarm" | 628 | // I made from the "-writeFile" an "-writeAlarm" |
610 | mView->viewManager()->showWhatsNextView(); | 629 | mView->viewManager()->showWhatsNextView(); |
611 | mCalendar->checkAlarmForIncidence( 0, true); | 630 | mCalendar->checkAlarmForIncidence( 0, true); |
612 | showMaximized(); | 631 | showMaximized(); |
613 | raise(); | 632 | raise(); |
614 | return; | 633 | return; |
615 | 634 | ||
616 | } | 635 | } |
617 | if ( cmsg == "-writeFileSilent" ) { | 636 | if ( cmsg == "-writeFileSilent" ) { |
618 | // I made from the "-writeFile" an "-writeAlarm" | 637 | // I made from the "-writeFile" an "-writeAlarm" |
619 | // mView->viewManager()->showWhatsNextView(); | 638 | // mView->viewManager()->showWhatsNextView(); |
620 | mCalendar->checkAlarmForIncidence( 0, true); | 639 | mCalendar->checkAlarmForIncidence( 0, true); |
621 | //showMaximized(); | 640 | //showMaximized(); |
622 | //raise(); | 641 | //raise(); |
623 | //hide(); | 642 | //hide(); |
624 | return; | 643 | return; |
625 | } | 644 | } |
626 | if ( cmsg == "-newCountdown" ) { | 645 | if ( cmsg == "-newCountdown" ) { |
627 | qDebug("newCountdown "); | 646 | qDebug("newCountdown "); |
628 | 647 | ||
629 | } | 648 | } |
630 | QString msg ; | 649 | QString msg ; |
631 | QString allmsg = cmsg; | 650 | QString allmsg = cmsg; |
632 | while ( allmsg.length() > 0 ) { | 651 | while ( allmsg.length() > 0 ) { |
633 | int nextC = allmsg.find( "-", 1 ); | 652 | int nextC = allmsg.find( "-", 1 ); |
634 | if ( nextC == -1 ) { | 653 | if ( nextC == -1 ) { |
635 | msg = allmsg; | 654 | msg = allmsg; |
636 | allmsg = ""; | 655 | allmsg = ""; |
637 | } else{ | 656 | } else{ |
638 | msg = allmsg.left( nextC ); | 657 | msg = allmsg.left( nextC ); |
639 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); | 658 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); |
640 | } | 659 | } |
641 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); | 660 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); |
642 | if ( msg == "-newEvent" ) { | 661 | if ( msg == "-newEvent" ) { |
643 | QTimer::singleShot( 0, mView, SLOT ( newEvent())); | 662 | QTimer::singleShot( 0, mView, SLOT ( newEvent())); |
644 | } | 663 | } |
645 | if ( msg == "-newTodo" ) { | 664 | if ( msg == "-newTodo" ) { |
646 | QTimer::singleShot( 0, mView, SLOT ( newTodo())); | 665 | QTimer::singleShot( 0, mView, SLOT ( newTodo())); |
647 | } | 666 | } |
648 | if ( msg == "-showWN" ) { | 667 | if ( msg == "-showWN" ) { |
649 | mView->viewManager()->showWhatsNextView(); | 668 | mView->viewManager()->showWhatsNextView(); |
650 | } | 669 | } |
651 | if ( msg == "-showList" ) { | 670 | if ( msg == "-showList" ) { |
652 | mView->viewManager()->showListView(); | 671 | mView->viewManager()->showListView(); |
653 | } | 672 | } |
654 | else if ( msg == "-showDay" ) { | 673 | else if ( msg == "-showDay" ) { |
655 | mView->viewManager()->showDayView(); | 674 | mView->viewManager()->showDayView(); |
656 | } | 675 | } |
657 | else if ( msg == "-showWWeek" ) { | 676 | else if ( msg == "-showWWeek" ) { |
658 | mView->viewManager()->showWorkWeekView(); | 677 | mView->viewManager()->showWorkWeekView(); |
659 | } | 678 | } |
660 | else if ( msg == "-ringSync" ) { | 679 | else if ( msg == "-ringSync" ) { |
661 | QTimer::singleShot( 0, this, SLOT (startMultiSync())); | 680 | QTimer::singleShot( 0, this, SLOT (startMultiSync())); |
662 | } | 681 | } |
663 | else if ( msg == "-showWeek" ) { | 682 | else if ( msg == "-showWeek" ) { |
664 | mView->viewManager()->showWeekView(); | 683 | mView->viewManager()->showWeekView(); |
665 | } | 684 | } |
666 | else if ( msg == "-showTodo" ) { | 685 | else if ( msg == "-showTodo" ) { |
667 | mView->viewManager()->showTodoView(); | 686 | mView->viewManager()->showTodoView(); |
668 | } | 687 | } |
669 | else if ( msg == "-showJournal" ) { | 688 | else if ( msg == "-showJournal" ) { |
670 | mView->dateNavigator()->selectDates( 1 ); | 689 | mView->dateNavigator()->selectDates( 1 ); |
671 | mView->dateNavigator()->selectToday(); | 690 | mView->dateNavigator()->selectToday(); |
672 | mView->viewManager()->showJournalView(); | 691 | mView->viewManager()->showJournalView(); |
673 | } | 692 | } |
674 | else if ( msg == "-showKO" ) { | 693 | else if ( msg == "-showKO" ) { |
675 | mView->viewManager()->showNextXView(); | 694 | mView->viewManager()->showNextXView(); |
676 | } | 695 | } |
677 | else if ( msg == "-showWNext" ) { | 696 | else if ( msg == "-showWNext" ) { |
678 | mView->viewManager()->showWhatsNextView(); | 697 | mView->viewManager()->showWhatsNextView(); |
679 | } | 698 | } |
680 | else if ( msg == "nextView()" ) { | 699 | else if ( msg == "nextView()" ) { |
681 | mView->viewManager()->showNextView(); | 700 | mView->viewManager()->showNextView(); |
682 | } | 701 | } |
683 | else if ( msg == "-showNextXView" ) { | 702 | else if ( msg == "-showNextXView" ) { |
684 | mView->viewManager()->showNextXView(); | 703 | mView->viewManager()->showNextXView(); |
685 | } | 704 | } |
686 | 705 | ||
687 | 706 | ||
688 | } | 707 | } |
689 | 708 | ||
690 | showMaximized(); | 709 | showMaximized(); |
691 | raise(); | 710 | raise(); |
692 | } | 711 | } |
693 | void MainWindow::startMultiSync() | 712 | void MainWindow::startMultiSync() |
694 | { | 713 | { |
695 | QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); | 714 | QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); |
696 | if ( QMessageBox::information( this, i18n("KDE-Pim Sync"), | 715 | if ( QMessageBox::information( this, i18n("KDE-Pim Sync"), |
697 | question, | 716 | question, |
698 | i18n("Yes"), i18n("No"), | 717 | i18n("Yes"), i18n("No"), |
699 | 0, 0 ) != 0 ) { | 718 | 0, 0 ) != 0 ) { |
700 | setCaption(i18n("Aborted! Nothing synced!")); | 719 | setCaption(i18n("Aborted! Nothing synced!")); |
701 | return; | 720 | return; |
702 | } | 721 | } |
703 | mSyncManager->multiSync( false ); | 722 | mSyncManager->multiSync( false ); |
704 | #ifndef DESKTOP_VERSION | 723 | #ifndef DESKTOP_VERSION |
705 | QCopEnvelope e("QPE/Application/kapi", "doRingSync"); | 724 | QCopEnvelope e("QPE/Application/kapi", "doRingSync"); |
706 | #endif | 725 | #endif |
707 | } | 726 | } |
708 | QPixmap MainWindow::loadPixmap( QString name ) | 727 | QPixmap MainWindow::loadPixmap( QString name ) |
709 | { | 728 | { |
710 | return SmallIcon( name ); | 729 | return SmallIcon( name ); |
711 | 730 | ||
712 | } | 731 | } |
713 | void MainWindow::setUsesBigPixmaps ( bool b ) | 732 | void MainWindow::setUsesBigPixmaps ( bool b ) |
714 | { | 733 | { |
715 | qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b); | 734 | qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b); |
716 | if ( b ) | 735 | if ( b ) |
717 | qDebug("KO: BigPixmaps are not supported "); | 736 | qDebug("KO: BigPixmaps are not supported "); |
718 | } | 737 | } |
719 | void MainWindow::initActions() | 738 | void MainWindow::initActions() |
720 | { | 739 | { |
721 | //KOPrefs::instance()->mShowFullMenu | 740 | //KOPrefs::instance()->mShowFullMenu |
722 | iconToolBar->clear(); | 741 | iconToolBar->clear(); |
723 | KOPrefs *p = KOPrefs::instance(); | 742 | KOPrefs *p = KOPrefs::instance(); |
724 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); | 743 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); |
725 | 744 | ||
726 | QPopupMenu *viewMenu = new QPopupMenu( this ); | 745 | QPopupMenu *viewMenu = new QPopupMenu( this ); |
727 | QPopupMenu *actionMenu = new QPopupMenu( this ); | 746 | QPopupMenu *actionMenu = new QPopupMenu( this ); |
728 | mCurrentItemMenu = new QPopupMenu ( this ); | 747 | mCurrentItemMenu = new QPopupMenu ( this ); |
729 | QPopupMenu *nextConflictMenu = new QPopupMenu ( this ); | 748 | QPopupMenu *nextConflictMenu = new QPopupMenu ( this ); |
730 | QPopupMenu *importMenu = new QPopupMenu( this ); | 749 | QPopupMenu *importMenu = new QPopupMenu( this ); |
731 | QPopupMenu *importMenu_X = new QPopupMenu( this ); | 750 | QPopupMenu *importMenu_X = new QPopupMenu( this ); |
732 | QPopupMenu *exportMenu_X = new QPopupMenu( this ); | 751 | QPopupMenu *exportMenu_X = new QPopupMenu( this ); |
733 | QPopupMenu *beamMenu_X = new QPopupMenu( this ); | 752 | QPopupMenu *beamMenu_X = new QPopupMenu( this ); |
734 | selectFilterMenu = new QPopupMenu( this ); | 753 | selectFilterMenu = new QPopupMenu( this ); |
735 | selectFilterMenu->setCheckable( true ); | 754 | selectFilterMenu->setCheckable( true ); |
736 | syncMenu = new QPopupMenu( this ); | 755 | syncMenu = new QPopupMenu( this ); |
737 | configureAgendaMenu = new QPopupMenu( this ); | 756 | configureAgendaMenu = new QPopupMenu( this ); |
738 | configureToolBarMenu = new QPopupMenu( this ); | 757 | configureToolBarMenu = new QPopupMenu( this ); |
739 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 758 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
740 | QIconSet icon; | 759 | QIconSet icon; |
741 | int pixWid = 22, pixHei = 22; | 760 | int pixWid = 22, pixHei = 22; |
742 | QString pathString = ""; | 761 | QString pathString = ""; |
743 | if ( !p->mToolBarMiniIcons ) { | 762 | if ( !p->mToolBarMiniIcons ) { |
744 | if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) { | 763 | if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) { |
745 | pathString += "icons16/"; | 764 | pathString += "icons16/"; |
746 | pixWid = 18; pixHei = 16; | 765 | pixWid = 18; pixHei = 16; |
747 | } | 766 | } |
748 | } else { | 767 | } else { |
749 | pathString += "iconsmini/"; | 768 | pathString += "iconsmini/"; |
750 | pixWid = 18; pixHei = 16; | 769 | pixWid = 18; pixHei = 16; |
751 | } | 770 | } |
752 | 771 | ||
753 | if ( KOPrefs::instance()->mShowFullMenu ) { | 772 | if ( KOPrefs::instance()->mShowFullMenu ) { |
754 | menuBar1 = new KMenuBar( this );//menuBar(); | 773 | menuBar1 = new KMenuBar( this );//menuBar(); |
755 | //setMenuBar( menuBar1 ); | 774 | //setMenuBar( menuBar1 ); |
756 | menuBar1->show(); | 775 | menuBar1->show(); |
757 | menuBar1->insertItem( i18n("File"), importMenu ); | 776 | menuBar1->insertItem( i18n("File"), importMenu ); |
758 | menuBar1->insertItem( i18n("View"), viewMenu ); | 777 | menuBar1->insertItem( i18n("View"), viewMenu ); |
759 | menuBar1->insertItem( i18n("Edit"), mCurrentItemMenu ); | 778 | menuBar1->insertItem( i18n("Edit"), mCurrentItemMenu ); |
760 | menuBar1->insertItem( i18n("Action"), actionMenu ); | 779 | menuBar1->insertItem( i18n("Action"), actionMenu ); |
761 | #ifdef DESKTOP_VERSION | 780 | #ifdef DESKTOP_VERSION |
762 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); | 781 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); |
763 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 782 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
764 | #else | 783 | #else |
765 | menuBar1->insertItem( i18n("Sync"), syncMenu ); | 784 | menuBar1->insertItem( i18n("Sync"), syncMenu ); |
766 | menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); | 785 | menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); |
767 | #endif | 786 | #endif |
768 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 787 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
769 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); | 788 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); |
770 | menuBar1->insertItem( i18n("Help"), helpMenu ); | 789 | menuBar1->insertItem( i18n("Help"), helpMenu ); |
771 | } else { | 790 | } else { |
772 | menuBar1 = new KMenuBar( iconToolBar ); | 791 | menuBar1 = new KMenuBar( iconToolBar ); |
773 | QPopupMenu *menuBar = new QPopupMenu( this ); | 792 | QPopupMenu *menuBar = new QPopupMenu( this ); |
774 | icon = loadPixmap( pathString + "z_menu" ); | 793 | icon = loadPixmap( pathString + "z_menu" ); |
775 | menuBar1->insertItem( icon.pixmap(), menuBar); | 794 | menuBar1->insertItem( icon.pixmap(), menuBar); |
776 | //menuBar1->insertItem( i18n("ME"), menuBar); | 795 | //menuBar1->insertItem( i18n("ME"), menuBar); |
777 | menuBar->insertItem( i18n("File"), importMenu ); | 796 | menuBar->insertItem( i18n("File"), importMenu ); |
778 | menuBar->insertItem( i18n("View"), viewMenu ); | 797 | menuBar->insertItem( i18n("View"), viewMenu ); |
779 | menuBar->insertItem( i18n("Edit"), mCurrentItemMenu ); | 798 | menuBar->insertItem( i18n("Edit"), mCurrentItemMenu ); |
780 | menuBar->insertItem( i18n("Action"), actionMenu ); | 799 | menuBar->insertItem( i18n("Action"), actionMenu ); |
781 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); | 800 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); |
782 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 801 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
783 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 802 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
784 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); | 803 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); |
785 | menuBar->insertItem( i18n("Help"), helpMenu ); | 804 | menuBar->insertItem( i18n("Help"), helpMenu ); |
786 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); | 805 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); |
787 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); | 806 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); |
788 | connect ( menuBar, SIGNAL( aboutToHide () ), this, SLOT ( slotResetFocus() ) ); | 807 | connect ( menuBar, SIGNAL( aboutToHide () ), this, SLOT ( slotResetFocus() ) ); |
789 | } | 808 | } |
790 | connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) ); | 809 | connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) ); |
791 | //connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) ); | 810 | //connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) ); |
792 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); | 811 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); |
793 | connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); | 812 | connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); |
794 | 813 | ||
795 | 814 | ||
796 | mWeekBgColor = iconToolBar->backgroundColor(); | 815 | mWeekBgColor = iconToolBar->backgroundColor(); |
797 | mWeekPixmap.resize( pixWid , pixHei ); | 816 | mWeekPixmap.resize( pixWid , pixHei ); |
798 | mWeekPixmap.fill( mWeekBgColor ); | 817 | mWeekPixmap.fill( mWeekBgColor ); |
799 | icon = mWeekPixmap; | 818 | icon = mWeekPixmap; |
800 | mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); | 819 | mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); |
801 | if ( p-> mShowIconWeekNum ) | 820 | if ( p-> mShowIconWeekNum ) |
802 | mWeekAction->addTo( iconToolBar ); | 821 | mWeekAction->addTo( iconToolBar ); |
803 | mWeekFont = font(); | 822 | mWeekFont = font(); |
804 | 823 | ||
805 | int fontPoint = mWeekFont.pointSize(); | 824 | int fontPoint = mWeekFont.pointSize(); |
806 | QFontMetrics f( mWeekFont ); | 825 | QFontMetrics f( mWeekFont ); |
807 | int fontWid = f.width( "30" ); | 826 | int fontWid = f.width( "30" ); |
808 | while ( fontWid > pixWid ) { | 827 | while ( fontWid > pixWid ) { |
809 | --fontPoint; | 828 | --fontPoint; |
810 | mWeekFont.setPointSize( fontPoint ); | 829 | mWeekFont.setPointSize( fontPoint ); |
811 | QFontMetrics f( mWeekFont ); | 830 | QFontMetrics f( mWeekFont ); |
812 | fontWid = f.width( "30" ); | 831 | fontWid = f.width( "30" ); |
813 | //qDebug("dec-- "); | 832 | //qDebug("dec-- "); |
814 | } | 833 | } |
815 | 834 | ||
816 | connect( mWeekAction, SIGNAL( activated() ), | 835 | connect( mWeekAction, SIGNAL( activated() ), |
817 | this, SLOT( weekAction() ) ); | 836 | this, SLOT( weekAction() ) ); |
818 | 837 | ||
819 | connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); | 838 | connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); |
820 | if ( p->mShowIconFilterview ) { | 839 | if ( p->mShowIconFilterview ) { |
821 | icon = loadPixmap( pathString + "filter" ); | 840 | icon = loadPixmap( pathString + "filter" ); |
822 | actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this ); | 841 | actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this ); |
823 | connect( actionFilterMenuTB, SIGNAL( activated() ), | 842 | connect( actionFilterMenuTB, SIGNAL( activated() ), |
824 | this, SLOT( fillFilterMenuTB() ) ); | 843 | this, SLOT( fillFilterMenuTB() ) ); |
825 | actionFilterMenuTB->addTo( iconToolBar ); | 844 | actionFilterMenuTB->addTo( iconToolBar ); |
826 | selectFilterMenuTB = new QPopupMenu( this ); | 845 | selectFilterMenuTB = new QPopupMenu( this ); |
827 | selectFilterMenuTB->setCheckable( true ); | 846 | selectFilterMenuTB->setCheckable( true ); |
828 | connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); | 847 | connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); |
829 | } | 848 | } |
830 | 849 | ||
831 | //#endif | 850 | //#endif |
832 | // ****************** | 851 | // ****************** |
833 | QAction *action; | 852 | QAction *action; |
834 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); | 853 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); |
835 | configureToolBarMenu->setCheckable( true ); | 854 | configureToolBarMenu->setCheckable( true ); |
836 | 855 | ||
837 | 856 | ||
838 | configureAgendaMenu->setCheckable( true ); | 857 | configureAgendaMenu->setCheckable( true ); |
839 | int iii ; | 858 | int iii ; |
840 | for ( iii = 1;iii<= 10 ;++iii ){ | 859 | for ( iii = 1;iii<= 10 ;++iii ){ |
841 | configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); | 860 | configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); |
842 | } | 861 | } |
843 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); | 862 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); |
844 | 863 | ||
845 | connect( configureAgendaMenu, SIGNAL( aboutToShow()), | 864 | connect( configureAgendaMenu, SIGNAL( aboutToShow()), |
846 | this, SLOT( showConfigureAgenda( ) ) ); | 865 | this, SLOT( showConfigureAgenda( ) ) ); |
847 | icon = loadPixmap( pathString + "today" ); | 866 | icon = loadPixmap( pathString + "today" ); |
848 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); | 867 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); |
849 | today_action->addTo( actionMenu ); | 868 | today_action->addTo( actionMenu ); |
850 | connect( today_action, SIGNAL( activated() ), | 869 | connect( today_action, SIGNAL( activated() ), |
851 | mView, SLOT( goToday() ) ); | 870 | mView, SLOT( goToday() ) ); |
852 | 871 | ||
853 | icon = loadPixmap( pathString + "picker" ); | 872 | icon = loadPixmap( pathString + "picker" ); |
854 | QAction* dPickerAction = new QAction( i18n("Select Date..."), icon, i18n("Select Date..."), 0, this ); | 873 | QAction* dPickerAction = new QAction( i18n("Select Date..."), icon, i18n("Select Date..."), 0, this ); |
855 | dPickerAction->addTo( actionMenu ); | 874 | dPickerAction->addTo( actionMenu ); |
856 | connect( dPickerAction, SIGNAL( activated() ), | 875 | connect( dPickerAction, SIGNAL( activated() ), |
857 | mView, SLOT( showDatePicker() ) ); | 876 | mView, SLOT( showDatePicker() ) ); |
858 | 877 | ||
859 | icon = loadPixmap( pathString + "search" ); | 878 | icon = loadPixmap( pathString + "search" ); |
860 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); | 879 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); |
861 | search_action->addTo( actionMenu ); | 880 | search_action->addTo( actionMenu ); |
862 | connect( search_action, SIGNAL( activated() ), | 881 | connect( search_action, SIGNAL( activated() ), |
863 | mView->dialogManager(), SLOT( showSearchDialog() ) ); | 882 | mView->dialogManager(), SLOT( showSearchDialog() ) ); |
864 | actionMenu->insertItem( i18n("Show next conflict for"), nextConflictMenu ); | 883 | actionMenu->insertItem( i18n("Show next conflict for"), nextConflictMenu ); |
865 | 884 | ||
866 | action = new QAction( "Undo Delete", i18n("All events"), 0, this ); | 885 | action = new QAction( "Undo Delete", i18n("All events"), 0, this ); |
867 | action->addTo( nextConflictMenu ); | 886 | action->addTo( nextConflictMenu ); |
868 | connect( action, SIGNAL( activated() ), | 887 | connect( action, SIGNAL( activated() ), |
869 | mView, SLOT( conflictAll() ) ); | 888 | mView, SLOT( conflictAll() ) ); |
870 | 889 | ||
871 | action = new QAction( "Undo Delete", i18n("Allday events"), 0, this ); | 890 | action = new QAction( "Undo Delete", i18n("Allday events"), 0, this ); |
872 | action->addTo( nextConflictMenu ); | 891 | action->addTo( nextConflictMenu ); |
873 | connect( action, SIGNAL( activated() ), | 892 | connect( action, SIGNAL( activated() ), |
874 | mView, SLOT( conflictAllday() ) ); | 893 | mView, SLOT( conflictAllday() ) ); |
875 | 894 | ||
876 | action = new QAction( "Undo Delete", i18n("Events with time"), 0, this ); | 895 | action = new QAction( "Undo Delete", i18n("Events with time"), 0, this ); |
877 | action->addTo( nextConflictMenu ); | 896 | action->addTo( nextConflictMenu ); |
878 | connect( action, SIGNAL( activated() ), | 897 | connect( action, SIGNAL( activated() ), |
879 | mView, SLOT( conflictNotAll() ) ); | 898 | mView, SLOT( conflictNotAll() ) ); |
880 | 899 | ||
881 | actionMenu->insertSeparator(); | 900 | actionMenu->insertSeparator(); |
882 | 901 | ||
883 | icon = loadPixmap( pathString + "newevent" ); | 902 | icon = loadPixmap( pathString + "newevent" ); |
884 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); | 903 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); |
885 | ne_action->addTo( mCurrentItemMenu ); | 904 | ne_action->addTo( mCurrentItemMenu ); |
886 | connect( ne_action, SIGNAL( activated() ), | 905 | connect( ne_action, SIGNAL( activated() ), |
887 | mView, SLOT( newEvent() ) ); | 906 | mView, SLOT( newEvent() ) ); |
888 | icon = loadPixmap( pathString + "newtodo" ); | 907 | icon = loadPixmap( pathString + "newtodo" ); |
889 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); | 908 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); |
890 | nt_action->addTo( mCurrentItemMenu ); | 909 | nt_action->addTo( mCurrentItemMenu ); |
891 | connect( nt_action, SIGNAL( activated() ), | 910 | connect( nt_action, SIGNAL( activated() ), |
892 | mView, SLOT( newTodo() ) ); | 911 | mView, SLOT( newTodo() ) ); |
893 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, | 912 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, |
894 | this ); | 913 | this ); |
895 | mNewSubTodoAction->addTo( mCurrentItemMenu ); | 914 | mNewSubTodoAction->addTo( mCurrentItemMenu ); |
896 | connect( mNewSubTodoAction, SIGNAL( activated() ), | 915 | connect( mNewSubTodoAction, SIGNAL( activated() ), |
897 | mView, SLOT( newSubTodo() ) ); | 916 | mView, SLOT( newSubTodo() ) ); |
898 | 917 | ||
899 | mCurrentItemMenu->insertSeparator(); | 918 | mCurrentItemMenu->insertSeparator(); |
900 | icon = loadPixmap( pathString + "newevent" ); | 919 | icon = loadPixmap( pathString + "newevent" ); |
901 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); | 920 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); |
902 | configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 ); | 921 | configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 ); |
903 | configureToolBarMenu->insertSeparator(); | 922 | configureToolBarMenu->insertSeparator(); |
904 | configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 ); | 923 | configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 ); |
905 | configureToolBarMenu->insertSeparator(); | 924 | configureToolBarMenu->insertSeparator(); |
906 | configureToolBarMenu->insertItem(i18n("Week Number"), 400); | 925 | configureToolBarMenu->insertItem(i18n("Week Number"), 400); |
907 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); | 926 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); |
908 | icon = loadPixmap( pathString + "newtodo" ); | 927 | icon = loadPixmap( pathString + "newtodo" ); |
909 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); | 928 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); |
910 | 929 | ||
911 | //actionMenu->insertItem ( i18n("Selected Item"), mCurrentItemMenu); | 930 | //actionMenu->insertItem ( i18n("Selected Item"), mCurrentItemMenu); |
912 | mShowAction = new QAction( "show_incidence", i18n("Show"), 0, this ); | 931 | mShowAction = new QAction( "show_incidence", i18n("Show"), 0, this ); |
913 | mShowAction->addTo( mCurrentItemMenu ); | 932 | mShowAction->addTo( mCurrentItemMenu ); |
914 | connect( mShowAction, SIGNAL( activated() ), | 933 | connect( mShowAction, SIGNAL( activated() ), |
915 | mView, SLOT( showIncidence() ) ); | 934 | mView, SLOT( showIncidence() ) ); |
916 | 935 | ||
917 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); | 936 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); |
918 | mEditAction->addTo( mCurrentItemMenu ); | 937 | mEditAction->addTo( mCurrentItemMenu ); |
919 | connect( mEditAction, SIGNAL( activated() ), | 938 | connect( mEditAction, SIGNAL( activated() ), |
920 | mView, SLOT( editIncidence() ) ); | 939 | mView, SLOT( editIncidence() ) ); |
921 | 940 | ||
922 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); | 941 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); |
923 | mDeleteAction->addTo( mCurrentItemMenu ); | 942 | mDeleteAction->addTo( mCurrentItemMenu ); |
924 | connect( mDeleteAction, SIGNAL( activated() ), | 943 | connect( mDeleteAction, SIGNAL( activated() ), |
925 | mView, SLOT( deleteIncidence() ) ); | 944 | mView, SLOT( deleteIncidence() ) ); |
926 | 945 | ||
927 | 946 | ||
928 | mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); | 947 | mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); |
929 | mCloneAction->addTo( mCurrentItemMenu ); | 948 | mCloneAction->addTo( mCurrentItemMenu ); |
930 | connect( mCloneAction, SIGNAL( activated() ), | 949 | connect( mCloneAction, SIGNAL( activated() ), |
931 | mView, SLOT( cloneIncidence() ) ); | 950 | mView, SLOT( cloneIncidence() ) ); |
932 | mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); | 951 | mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); |
933 | mMoveAction->addTo( mCurrentItemMenu ); | 952 | mMoveAction->addTo( mCurrentItemMenu ); |
934 | connect( mMoveAction, SIGNAL( activated() ), | 953 | connect( mMoveAction, SIGNAL( activated() ), |
935 | mView, SLOT( moveIncidence() ) ); | 954 | mView, SLOT( moveIncidence() ) ); |
936 | #ifndef DESKTOP_VERSION | 955 | #ifndef DESKTOP_VERSION |
937 | mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); | 956 | mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); |
938 | mBeamAction->addTo(mCurrentItemMenu ); | 957 | mBeamAction->addTo(mCurrentItemMenu ); |
939 | connect( mBeamAction, SIGNAL( activated() ), | 958 | connect( mBeamAction, SIGNAL( activated() ), |
940 | mView, SLOT( beamIncidence() ) ); | 959 | mView, SLOT( beamIncidence() ) ); |
941 | #endif | 960 | #endif |
942 | mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); | 961 | mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); |
943 | mCancelAction->addTo( mCurrentItemMenu ); | 962 | mCancelAction->addTo( mCurrentItemMenu ); |
944 | connect( mCancelAction, SIGNAL( activated() ), | 963 | connect( mCancelAction, SIGNAL( activated() ), |
945 | mView, SLOT( toggleCancelIncidence() ) ); | 964 | mView, SLOT( toggleCancelIncidence() ) ); |
946 | 965 | ||
947 | 966 | ||
948 | mCurrentItemMenu->insertSeparator(); | 967 | mCurrentItemMenu->insertSeparator(); |
949 | action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); | 968 | action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); |
950 | action->addTo( mCurrentItemMenu ); | 969 | action->addTo( mCurrentItemMenu ); |
951 | connect( action, SIGNAL( activated() ), | 970 | connect( action, SIGNAL( activated() ), |
952 | mView, SLOT( undo_delete() ) ); | 971 | mView, SLOT( undo_delete() ) ); |
953 | 972 | ||
954 | // *********************** | 973 | // *********************** |
955 | if ( KOPrefs::instance()->mVerticalScreen ) { | 974 | if ( KOPrefs::instance()->mVerticalScreen ) { |
956 | icon = SmallIcon( "1updownarrow" ); | 975 | icon = SmallIcon( "1updownarrow" ); |
957 | } else { | 976 | } else { |
958 | icon = SmallIcon("1leftrightarrow" ); | 977 | icon = SmallIcon("1leftrightarrow" ); |
959 | } | 978 | } |
960 | configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 ); | 979 | configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 ); |
961 | QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this ); | 980 | QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this ); |
962 | FSaction->addTo( viewMenu ); | 981 | FSaction->addTo( viewMenu ); |
963 | connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() )); | 982 | connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() )); |
964 | 983 | ||
965 | 984 | ||
966 | icon = loadPixmap( pathString + "filter" ); | 985 | icon = loadPixmap( pathString + "filter" ); |
967 | configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 ); | 986 | configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 ); |
968 | icon = loadPixmap( pathString + "configure" ); | 987 | icon = loadPixmap( pathString + "configure" ); |
969 | action = new QAction( i18n("Toggle Resource View"), icon, i18n("Toggle Resource View"), 0, this ); | 988 | action = new QAction( i18n("Toggle Resource View"), icon, i18n("Toggle Resource View"), 0, this ); |
970 | action->addTo( viewMenu ); | 989 | action->addTo( viewMenu ); |
971 | connect( action, SIGNAL( activated() ), | 990 | connect( action, SIGNAL( activated() ), |
972 | mView, SLOT( toggleFilter() ) ); | 991 | mView, SLOT( toggleFilter() ) ); |
973 | mToggleFilter = action; | 992 | mToggleFilter = action; |
974 | icon = loadPixmap( pathString + "navi" ); | 993 | icon = loadPixmap( pathString + "navi" ); |
975 | configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 ); | 994 | configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 ); |
976 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); | 995 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); |
977 | action->addTo( viewMenu ); | 996 | action->addTo( viewMenu ); |
978 | connect( action, SIGNAL( activated() ), | 997 | connect( action, SIGNAL( activated() ), |
979 | mView, SLOT( toggleDateNavigatorWidget() ) ); | 998 | mView, SLOT( toggleDateNavigatorWidget() ) ); |
980 | mToggleNav = action ; | 999 | mToggleNav = action ; |
981 | icon = loadPixmap( pathString + "allday" ); | 1000 | icon = loadPixmap( pathString + "allday" ); |
982 | configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 ); | 1001 | configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 ); |
983 | action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); | 1002 | action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); |
984 | action->addTo( viewMenu ); | 1003 | action->addTo( viewMenu ); |
985 | connect( action, SIGNAL( activated() ), | 1004 | connect( action, SIGNAL( activated() ), |
986 | mView, SLOT( toggleAllDaySize() ) ); | 1005 | mView, SLOT( toggleAllDaySize() ) ); |
987 | mToggleAllday = action; | 1006 | mToggleAllday = action; |
988 | 1007 | ||
989 | 1008 | ||
990 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), | 1009 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), |
991 | mToggleNav, SLOT( setEnabled ( bool ) ) ); | 1010 | mToggleNav, SLOT( setEnabled ( bool ) ) ); |
992 | //connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), | 1011 | //connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), |
993 | // mToggleFilter, SLOT( setEnabled ( bool ) ) ); | 1012 | // mToggleFilter, SLOT( setEnabled ( bool ) ) ); |
994 | connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), | 1013 | connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), |
995 | mToggleAllday, SLOT( setEnabled ( bool ) ) ); | 1014 | mToggleAllday, SLOT( setEnabled ( bool ) ) ); |
996 | // connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), | 1015 | // connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), |
997 | // configureAgendaMenu, SLOT( setEnabled ( bool ) ) ); | 1016 | // configureAgendaMenu, SLOT( setEnabled ( bool ) ) ); |
998 | 1017 | ||
999 | 1018 | ||
1000 | dPickerAction->addTo( iconToolBar ); | 1019 | dPickerAction->addTo( iconToolBar ); |
1001 | viewMenu->insertSeparator(); | 1020 | viewMenu->insertSeparator(); |
1002 | 1021 | ||
1003 | if ( p-> mShowIconToggleFull ) | 1022 | if ( p-> mShowIconToggleFull ) |
1004 | FSaction->addTo( iconToolBar ); | 1023 | FSaction->addTo( iconToolBar ); |
1005 | if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar ); | 1024 | if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar ); |
1006 | 1025 | ||
1007 | //******************** | 1026 | //******************** |
1008 | if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar ); | 1027 | if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar ); |
1009 | 1028 | ||
1010 | 1029 | ||
1011 | icon = loadPixmap( pathString + "whatsnext" ); | 1030 | icon = loadPixmap( pathString + "whatsnext" ); |
1012 | configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 ); | 1031 | configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 ); |
1013 | QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); | 1032 | QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); |
1014 | whatsnext_action->addTo( viewMenu ); | 1033 | whatsnext_action->addTo( viewMenu ); |
1015 | connect( whatsnext_action, SIGNAL( activated() ), | 1034 | connect( whatsnext_action, SIGNAL( activated() ), |
1016 | mView->viewManager(), SLOT( showWhatsNextView() ) ); | 1035 | mView->viewManager(), SLOT( showWhatsNextView() ) ); |
1017 | 1036 | ||
1018 | icon = loadPixmap( pathString + "xdays" ); | 1037 | icon = loadPixmap( pathString + "xdays" ); |
1019 | configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 ); | 1038 | configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 ); |
1020 | QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); | 1039 | QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); |
1021 | xdays_action->addTo( viewMenu ); | 1040 | xdays_action->addTo( viewMenu ); |
1022 | connect( xdays_action, SIGNAL( activated() ), | 1041 | connect( xdays_action, SIGNAL( activated() ), |
1023 | mView->viewManager(), SLOT( showNextXView() ) ); | 1042 | mView->viewManager(), SLOT( showNextXView() ) ); |
1024 | 1043 | ||
1025 | 1044 | ||
1026 | icon = loadPixmap( pathString + "journal" ); | 1045 | icon = loadPixmap( pathString + "journal" ); |
1027 | configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); | 1046 | configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); |
1028 | QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); | 1047 | QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); |
1029 | viewjournal_action->addTo( viewMenu ); | 1048 | viewjournal_action->addTo( viewMenu ); |
1030 | connect( viewjournal_action, SIGNAL( activated() ), | 1049 | connect( viewjournal_action, SIGNAL( activated() ), |
1031 | mView->viewManager(), SLOT( showJournalView() ) ); | 1050 | mView->viewManager(), SLOT( showJournalView() ) ); |
1032 | 1051 | ||
1033 | 1052 | ||
1034 | icon = loadPixmap( pathString + "day" ); | 1053 | icon = loadPixmap( pathString + "day" ); |
1035 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); | 1054 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); |
1036 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); | 1055 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); |
1037 | day1_action->addTo( viewMenu ); | 1056 | day1_action->addTo( viewMenu ); |
1038 | // action->addTo( toolBar ); | 1057 | // action->addTo( toolBar ); |
1039 | connect( day1_action, SIGNAL( activated() ), | 1058 | connect( day1_action, SIGNAL( activated() ), |
1040 | mView->viewManager(), SLOT( showDayView() ) ); | 1059 | mView->viewManager(), SLOT( showDayView() ) ); |
1041 | 1060 | ||
1042 | icon = loadPixmap( pathString + "workweek" ); | 1061 | icon = loadPixmap( pathString + "workweek" ); |
1043 | configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); | 1062 | configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); |
1044 | QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); | 1063 | QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); |
1045 | day5_action->addTo( viewMenu ); | 1064 | day5_action->addTo( viewMenu ); |
1046 | connect( day5_action, SIGNAL( activated() ), | 1065 | connect( day5_action, SIGNAL( activated() ), |
1047 | mView->viewManager(), SLOT( showWorkWeekView() ) ); | 1066 | mView->viewManager(), SLOT( showWorkWeekView() ) ); |
1048 | 1067 | ||
1049 | icon = loadPixmap( pathString + "week" ); | 1068 | icon = loadPixmap( pathString + "week" ); |
1050 | configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); | 1069 | configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); |
1051 | QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); | 1070 | QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); |
1052 | day7_action->addTo( viewMenu ); | 1071 | day7_action->addTo( viewMenu ); |
1053 | connect( day7_action, SIGNAL( activated() ), | 1072 | connect( day7_action, SIGNAL( activated() ), |
1054 | mView->viewManager(), SLOT( showWeekView() ) ); | 1073 | mView->viewManager(), SLOT( showWeekView() ) ); |
1055 | 1074 | ||
1056 | icon = loadPixmap( pathString + "workweek2" ); | 1075 | icon = loadPixmap( pathString + "workweek2" ); |
1057 | configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); | 1076 | configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); |
1058 | QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); | 1077 | QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); |
1059 | day6_action->addTo( viewMenu ); | 1078 | day6_action->addTo( viewMenu ); |
1060 | connect( day6_action, SIGNAL( activated() ), | 1079 | connect( day6_action, SIGNAL( activated() ), |
1061 | mView->viewManager(), SLOT( showMonthViewWeek() ) ); | 1080 | mView->viewManager(), SLOT( showMonthViewWeek() ) ); |
1062 | 1081 | ||
1063 | icon = loadPixmap( pathString + "month" ); | 1082 | icon = loadPixmap( pathString + "month" ); |
1064 | configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); | 1083 | configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); |
1065 | QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); | 1084 | QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); |
1066 | month_action->addTo( viewMenu ); | 1085 | month_action->addTo( viewMenu ); |
1067 | connect( month_action, SIGNAL( activated() ), | 1086 | connect( month_action, SIGNAL( activated() ), |
1068 | mView->viewManager(), SLOT( showMonthView() ) ); | 1087 | mView->viewManager(), SLOT( showMonthView() ) ); |
1069 | 1088 | ||
1070 | icon = loadPixmap( pathString + "list" ); | 1089 | icon = loadPixmap( pathString + "list" ); |
1071 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); | 1090 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); |
1072 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); | 1091 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); |
1073 | showlist_action->addTo( viewMenu ); | 1092 | showlist_action->addTo( viewMenu ); |
1074 | connect( showlist_action, SIGNAL( activated() ), | 1093 | connect( showlist_action, SIGNAL( activated() ), |
1075 | mView->viewManager(), SLOT( showListView() ) ); | 1094 | mView->viewManager(), SLOT( showListView() ) ); |
1076 | 1095 | ||
1077 | icon = loadPixmap( pathString + "todo" ); | 1096 | icon = loadPixmap( pathString + "todo" ); |
1078 | configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); | 1097 | configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); |
1079 | QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); | 1098 | QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); |
1080 | todoview_action->addTo( viewMenu ); | 1099 | todoview_action->addTo( viewMenu ); |
1081 | connect( todoview_action, SIGNAL( activated() ), | 1100 | connect( todoview_action, SIGNAL( activated() ), |
1082 | mView->viewManager(), SLOT( showTodoView() ) ); | 1101 | mView->viewManager(), SLOT( showTodoView() ) ); |
1083 | 1102 | ||
1084 | 1103 | ||
1085 | 1104 | ||
1086 | #if 0 | 1105 | #if 0 |
1087 | action = new QAction( "view_timespan", "Time Span", 0, this ); | 1106 | action = new QAction( "view_timespan", "Time Span", 0, this ); |
1088 | action->addTo( viewMenu ); | 1107 | action->addTo( viewMenu ); |
1089 | connect( action, SIGNAL( activated() ), | 1108 | connect( action, SIGNAL( activated() ), |
1090 | mView->viewManager(), SLOT( showTimeSpanView() ) ); | 1109 | mView->viewManager(), SLOT( showTimeSpanView() ) ); |
1091 | #endif | 1110 | #endif |
1092 | 1111 | ||
1093 | 1112 | ||
1094 | 1113 | ||
1095 | action = new QAction( "purge_completed", i18n("Purge Completed..."), 0, | 1114 | action = new QAction( "purge_completed", i18n("Purge Completed..."), 0, |
1096 | this ); | 1115 | this ); |
1097 | action->addTo( actionMenu ); | 1116 | action->addTo( actionMenu ); |
1098 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); | 1117 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); |
1099 | 1118 | ||
1100 | 1119 | ||
1101 | icon = loadPixmap( pathString + "search" ); | 1120 | icon = loadPixmap( pathString + "search" ); |
1102 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); | 1121 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); |
1103 | 1122 | ||
1104 | 1123 | ||
1105 | 1124 | ||
1106 | actionMenu->insertSeparator(); | 1125 | actionMenu->insertSeparator(); |
1107 | action = new QAction( "manage cat", i18n("Edit category list..."), 0, | 1126 | action = new QAction( "manage cat", i18n("Edit category list..."), 0, |
1108 | this ); | 1127 | this ); |
1109 | action->addTo( actionMenu ); | 1128 | action->addTo( actionMenu ); |
1110 | connect( action, SIGNAL( activated() ), mView, SLOT( editCategories() ) ); | 1129 | connect( action, SIGNAL( activated() ), mView, SLOT( editCategories() ) ); |
1111 | 1130 | ||
1112 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, | 1131 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, |
1113 | this ); | 1132 | this ); |
1114 | action->addTo( actionMenu ); | 1133 | action->addTo( actionMenu ); |
1115 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); | 1134 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); |
1116 | 1135 | ||
1117 | 1136 | ||
1118 | actionMenu->insertSeparator(); | 1137 | actionMenu->insertSeparator(); |
1119 | icon = loadPixmap( pathString + "configure" ); | 1138 | icon = loadPixmap( pathString + "configure" ); |
1120 | action = new QAction( i18n("Configure"),icon, i18n("Configure KO/Pi..."), 0, this ); | 1139 | action = new QAction( i18n("Configure"),icon, i18n("Configure KO/Pi..."), 0, this ); |
1121 | action->addTo( actionMenu ); | 1140 | action->addTo( actionMenu ); |
1122 | connect( action, SIGNAL( activated() ), | 1141 | connect( action, SIGNAL( activated() ), |
1123 | mView, SLOT( edit_options() ) ); | 1142 | mView, SLOT( edit_options() ) ); |
1124 | action = new QAction( i18n("Configure"),icon, i18n("Configure Calendar Files..."), 0, this ); | 1143 | action = new QAction( i18n("Configure"),icon, i18n("Configure Calendar Files..."), 0, this ); |
1125 | action->addTo( actionMenu ); | 1144 | action->addTo( actionMenu ); |
1126 | connect( action, SIGNAL( activated() ), | 1145 | connect( action, SIGNAL( activated() ), |
1127 | this, SLOT( calHint() ) ); | 1146 | this, SLOT( calHint() ) ); |
1128 | action = new QAction( i18n("Configure"),icon, i18n("Global Settings..."), 0, this ); | 1147 | action = new QAction( i18n("Configure"),icon, i18n("Global Settings..."), 0, this ); |
1129 | action->addTo( actionMenu ); | 1148 | action->addTo( actionMenu ); |
1130 | connect( action, SIGNAL( activated() ), | 1149 | connect( action, SIGNAL( activated() ), |
1131 | mView, SLOT( edit_global_options() ) ); | 1150 | mView, SLOT( edit_global_options() ) ); |
1132 | if ( KOPrefs::instance()->mShowFullMenu ) { | 1151 | if ( KOPrefs::instance()->mShowFullMenu ) { |
1133 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); | 1152 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); |
1134 | 1153 | ||
1135 | } | 1154 | } |
1136 | // actionMenu->insertSeparator(); | 1155 | // actionMenu->insertSeparator(); |
1137 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, | 1156 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, |
1138 | this ); | 1157 | this ); |
1139 | action->addTo( importMenu_X ); | 1158 | action->addTo( importMenu_X ); |
1140 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); | 1159 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); |
1141 | action = new QAction( "import_quick", i18n("Import last file"), 0, | 1160 | action = new QAction( "import_quick", i18n("Import last file"), 0, |
1142 | this ); | 1161 | this ); |
1143 | action->addTo( importMenu_X ); | 1162 | action->addTo( importMenu_X ); |
1144 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); | 1163 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); |
1145 | importMenu_X->insertSeparator(); | 1164 | importMenu_X->insertSeparator(); |
1146 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, | 1165 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, |
1147 | this ); | 1166 | this ); |
1148 | action->addTo( importMenu_X ); | 1167 | action->addTo( importMenu_X ); |
1149 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); | 1168 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); |
1150 | //#ifndef DESKTOP_VERSION | 1169 | //#ifndef DESKTOP_VERSION |
1151 | importMenu_X->insertSeparator(); | 1170 | importMenu_X->insertSeparator(); |
1152 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, | 1171 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, |
1153 | this ); | 1172 | this ); |
1154 | action->addTo( importMenu_X ); | 1173 | action->addTo( importMenu_X ); |
1155 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); | 1174 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); |
1156 | //#else | 1175 | //#else |
1157 | #ifdef _OL_IMPORT_ | 1176 | #ifdef _OL_IMPORT_ |
1158 | importMenu_X->insertSeparator(); | 1177 | importMenu_X->insertSeparator(); |
1159 | action = new QAction( "import_ol", i18n("Import from OL"), 0, | 1178 | action = new QAction( "import_ol", i18n("Import from OL"), 0, |
1160 | this ); | 1179 | this ); |
1161 | action->addTo( importMenu_X ); | 1180 | action->addTo( importMenu_X ); |
1162 | connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); | 1181 | connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); |
1163 | #endif | 1182 | #endif |
1164 | //#endif | 1183 | //#endif |
1165 | 1184 | ||
1166 | //importMenu->insertSeparator(); | 1185 | //importMenu->insertSeparator(); |
1167 | #if 0 | 1186 | #if 0 |
1168 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, | 1187 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, |
1169 | this ); | 1188 | this ); |
1170 | action->addTo( importMenu ); | 1189 | action->addTo( importMenu ); |
1171 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); | 1190 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); |
1172 | #endif | 1191 | #endif |
1173 | action = new QAction( "save_cal", i18n("Save Backup..."), 0, | 1192 | action = new QAction( "save_cal", i18n("Save Backup..."), 0, |
1174 | this ); | 1193 | this ); |
1175 | action->addTo( importMenu ); | 1194 | action->addTo( importMenu ); |
1176 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); | 1195 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); |
1177 | importMenu->insertSeparator(); | 1196 | importMenu->insertSeparator(); |
1178 | importMenu->insertItem( i18n("Import"), importMenu_X ); | 1197 | importMenu->insertItem( i18n("Import"), importMenu_X ); |
1179 | //importMenu->insertSeparator(); | 1198 | //importMenu->insertSeparator(); |
1180 | action = new QAction( "export ical", i18n("Export All Data"), 0, | 1199 | action = new QAction( "export ical", i18n("Export All Data"), 0, |
1181 | this ); | 1200 | this ); |
1182 | action->addTo( exportMenu_X ); | 1201 | action->addTo( exportMenu_X ); |
1183 | connect( action, SIGNAL( activated() ), SLOT( exportICalendar() ) ); | 1202 | connect( action, SIGNAL( activated() ), SLOT( exportICalendar() ) ); |
1184 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, | 1203 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, |
1185 | this ); | 1204 | this ); |
1186 | action->addTo( exportMenu_X ); | 1205 | action->addTo( exportMenu_X ); |
1187 | connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); | 1206 | connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); |
1188 | 1207 | ||
1189 | 1208 | ||
1190 | //LR | 1209 | //LR |
1191 | QPopupMenu *ex2phone = new QPopupMenu( this ); | 1210 | QPopupMenu *ex2phone = new QPopupMenu( this ); |
1192 | ex2phone->insertItem(i18n("Complete calendar..."), 1 ); | 1211 | ex2phone->insertItem(i18n("Complete calendar..."), 1 ); |
1193 | ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); | 1212 | ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); |
1194 | connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); | 1213 | connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); |
1195 | exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); | 1214 | exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); |
1196 | 1215 | ||
1197 | importMenu->insertItem( i18n("Export"), exportMenu_X ); | 1216 | importMenu->insertItem( i18n("Export"), exportMenu_X ); |
1198 | mPrintSelAction = 0; | 1217 | mPrintSelAction = 0; |
1199 | #ifndef DESKTOP_VERSION | 1218 | #ifndef DESKTOP_VERSION |
1200 | //importMenu->insertSeparator(); | 1219 | //importMenu->insertSeparator(); |
1201 | brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, | 1220 | brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, |
1202 | this ); | 1221 | this ); |
1203 | brAction->addTo( beamMenu_X ); | 1222 | brAction->addTo( beamMenu_X ); |
1204 | brAction->setToggleAction (true ) ; | 1223 | brAction->setToggleAction (true ) ; |
1205 | connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); | 1224 | connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); |
1206 | 1225 | ||
1207 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, | 1226 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, |
1208 | this ); | 1227 | this ); |
1209 | action->addTo( beamMenu_X ); | 1228 | action->addTo( beamMenu_X ); |
1210 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); | 1229 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); |
1211 | 1230 | ||
1212 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, | 1231 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, |
1213 | this ); | 1232 | this ); |
1214 | action->addTo( beamMenu_X ); | 1233 | action->addTo( beamMenu_X ); |
1215 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); | 1234 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); |
1216 | importMenu->insertItem( i18n("Beam"), beamMenu_X ); | 1235 | importMenu->insertItem( i18n("Beam"), beamMenu_X ); |
1217 | #else | 1236 | #else |
1218 | //importMenu->insertSeparator(); | 1237 | //importMenu->insertSeparator(); |
1219 | icon = loadPixmap( pathString + "print" ); | 1238 | icon = loadPixmap( pathString + "print" ); |
1220 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); | 1239 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); |
1221 | action->addTo( beamMenu_X ); | 1240 | action->addTo( beamMenu_X ); |
1222 | connect( action, SIGNAL( activated() ), | 1241 | connect( action, SIGNAL( activated() ), |
1223 | this, SLOT( printCal() ) ); | 1242 | this, SLOT( printCal() ) ); |
1224 | 1243 | ||
1225 | icon = loadPixmap( pathString + "week" ); | 1244 | icon = loadPixmap( pathString + "week" ); |
1226 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); | 1245 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); |
1227 | action->addTo( beamMenu_X ); | 1246 | action->addTo( beamMenu_X ); |
1228 | connect( action, SIGNAL( activated() ), | 1247 | connect( action, SIGNAL( activated() ), |
1229 | this, SLOT( printSel() ) ); | 1248 | this, SLOT( printSel() ) ); |
1230 | icon = loadPixmap( pathString + "whatsnext" ); | 1249 | icon = loadPixmap( pathString + "whatsnext" ); |
1231 | action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); | 1250 | action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); |
1232 | action->addTo( beamMenu_X ); | 1251 | action->addTo( beamMenu_X ); |
1233 | connect( action, SIGNAL( activated() ), | 1252 | connect( action, SIGNAL( activated() ), |
1234 | mView->viewManager(), SLOT( slotprintWNV() ) ); | 1253 | mView->viewManager(), SLOT( slotprintWNV() ) ); |
1235 | 1254 | ||
1236 | 1255 | ||
1237 | icon = loadPixmap( pathString + "list" ); | 1256 | icon = loadPixmap( pathString + "list" ); |
1238 | action = new QAction( i18n("Print List View..."),icon,i18n("Print List View..."), 0, this ); | 1257 | action = new QAction( i18n("Print List View..."),icon,i18n("Print List View..."), 0, this ); |
1239 | action->addTo( beamMenu_X ); | 1258 | action->addTo( beamMenu_X ); |
1240 | connect( action, SIGNAL( activated() ), | 1259 | connect( action, SIGNAL( activated() ), |
1241 | this, SLOT( printListView() ) ); | 1260 | this, SLOT( printListView() ) ); |
1242 | 1261 | ||
1243 | icon = loadPixmap( pathString + "newevent" ); | 1262 | icon = loadPixmap( pathString + "newevent" ); |
1244 | action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this ); | 1263 | action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this ); |
1245 | action->addTo( beamMenu_X ); | 1264 | action->addTo( beamMenu_X ); |
1246 | connect( action, SIGNAL( activated() ), | 1265 | connect( action, SIGNAL( activated() ), |
1247 | mView, SLOT( slotprintSelInc() ) ); | 1266 | mView, SLOT( slotprintSelInc() ) ); |
1248 | mPrintSelAction = action; | 1267 | mPrintSelAction = action; |
1249 | importMenu->insertItem( i18n("Print"), beamMenu_X ); | 1268 | importMenu->insertItem( i18n("Print"), beamMenu_X ); |
1250 | #endif | 1269 | #endif |
1251 | 1270 | ||
1252 | importMenu->insertSeparator(); | 1271 | importMenu->insertSeparator(); |
1253 | action = new QAction( "beam all", i18n("Save"), 0, | 1272 | action = new QAction( "beam all", i18n("Save"), 0, |
1254 | this ); | 1273 | this ); |
1255 | action->addTo( importMenu ); | 1274 | action->addTo( importMenu ); |
1256 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); | 1275 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); |
1257 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, | 1276 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, |
1258 | this ); | 1277 | this ); |
1259 | action->addTo( importMenu ); | 1278 | action->addTo( importMenu ); |
1260 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); | 1279 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); |
1261 | 1280 | ||
1262 | //menuBar->insertItem( "Configure",configureMenu ); | 1281 | //menuBar->insertItem( "Configure",configureMenu ); |
1263 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); | 1282 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); |
1264 | icon = loadPixmap( "korganizer/korganizer" ); | 1283 | icon = loadPixmap( "korganizer/korganizer" ); |
1265 | 1284 | ||
1266 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); | 1285 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); |
1267 | action->addTo( helpMenu ); | 1286 | action->addTo( helpMenu ); |
1268 | connect( action, SIGNAL( activated() ), | 1287 | connect( action, SIGNAL( activated() ), |
1269 | SLOT( whatsNew() ) ); | 1288 | SLOT( whatsNew() ) ); |
1270 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); | 1289 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); |
1271 | action->addTo( helpMenu ); | 1290 | action->addTo( helpMenu ); |
1272 | connect( action, SIGNAL( activated() ), | 1291 | connect( action, SIGNAL( activated() ), |
1273 | SLOT( features() ) ); | 1292 | SLOT( features() ) ); |
1274 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); | 1293 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); |
1275 | action->addTo( helpMenu ); | 1294 | action->addTo( helpMenu ); |
1276 | connect( action, SIGNAL( activated() ), | 1295 | connect( action, SIGNAL( activated() ), |
1277 | SLOT( keyBindings() ) ); | 1296 | SLOT( keyBindings() ) ); |
1278 | action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this ); | 1297 | action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this ); |
1279 | action->addTo( helpMenu ); | 1298 | action->addTo( helpMenu ); |
1280 | connect( action, SIGNAL( activated() ), | 1299 | connect( action, SIGNAL( activated() ), |
1281 | SLOT( storagehowto() ) ); | 1300 | SLOT( storagehowto() ) ); |
1282 | action = new QAction( "Timetracking Howto", i18n("Timetracking HowTo..."), 0,this ); | 1301 | action = new QAction( "Timetracking Howto", i18n("Timetracking HowTo..."), 0,this ); |
1283 | action->addTo( helpMenu ); | 1302 | action->addTo( helpMenu ); |
1284 | connect( action, SIGNAL( activated() ), | 1303 | connect( action, SIGNAL( activated() ), |
1285 | SLOT( timetrackinghowto() ) ); | 1304 | SLOT( timetrackinghowto() ) ); |
1286 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); | 1305 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); |
1287 | action->addTo( helpMenu ); | 1306 | action->addTo( helpMenu ); |
1288 | connect( action, SIGNAL( activated() ), | 1307 | connect( action, SIGNAL( activated() ), |
1289 | SLOT( synchowto() ) ); | 1308 | SLOT( synchowto() ) ); |
1290 | action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); | 1309 | action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); |
1291 | action->addTo( helpMenu ); | 1310 | action->addTo( helpMenu ); |
1292 | connect( action, SIGNAL( activated() ), | 1311 | connect( action, SIGNAL( activated() ), |
1293 | SLOT( kdesynchowto() ) ); | 1312 | SLOT( kdesynchowto() ) ); |
1294 | action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); | 1313 | action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); |
1295 | action->addTo( helpMenu ); | 1314 | action->addTo( helpMenu ); |
1296 | connect( action, SIGNAL( activated() ), | 1315 | connect( action, SIGNAL( activated() ), |
1297 | SLOT( multisynchowto() ) ); | 1316 | SLOT( multisynchowto() ) ); |
1298 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); | 1317 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); |
1299 | action->addTo( helpMenu ); | 1318 | action->addTo( helpMenu ); |
1300 | connect( action, SIGNAL( activated() ), | 1319 | connect( action, SIGNAL( activated() ), |
1301 | SLOT( aboutAutoSaving() ) ); | 1320 | SLOT( aboutAutoSaving() ) ); |
1302 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); | 1321 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); |
1303 | action->addTo( helpMenu ); | 1322 | action->addTo( helpMenu ); |
1304 | connect( action, SIGNAL( activated() ), | 1323 | connect( action, SIGNAL( activated() ), |
1305 | SLOT( aboutKnownBugs() ) ); | 1324 | SLOT( aboutKnownBugs() ) ); |
1306 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); | 1325 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); |
1307 | action->addTo( helpMenu ); | 1326 | action->addTo( helpMenu ); |
1308 | connect( action, SIGNAL( activated() ), | 1327 | connect( action, SIGNAL( activated() ), |
1309 | SLOT( usertrans() ) ); | 1328 | SLOT( usertrans() ) ); |
1310 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); | 1329 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); |
1311 | action->addTo( helpMenu ); | 1330 | action->addTo( helpMenu ); |
1312 | connect( action, SIGNAL( activated() ), | 1331 | connect( action, SIGNAL( activated() ), |
1313 | SLOT( faq() ) ); | 1332 | SLOT( faq() ) ); |
1314 | action = new QAction( "licence", i18n("Licence..."), 0, this ); | 1333 | action = new QAction( "licence", i18n("Licence..."), 0, this ); |
1315 | action->addTo( helpMenu ); | 1334 | action->addTo( helpMenu ); |
1316 | connect( action, SIGNAL( activated() ), | 1335 | connect( action, SIGNAL( activated() ), |
1317 | SLOT( licence() ) ); | 1336 | SLOT( licence() ) ); |
1318 | action = new QAction( "about", i18n("About..."), 0, this ); | 1337 | action = new QAction( "about", i18n("About..."), 0, this ); |
1319 | action->addTo( helpMenu ); | 1338 | action->addTo( helpMenu ); |
1320 | connect( action, SIGNAL( activated() ), | 1339 | connect( action, SIGNAL( activated() ), |
1321 | SLOT( about() ) ); | 1340 | SLOT( about() ) ); |
1322 | //menuBar->insertSeparator(); | 1341 | //menuBar->insertSeparator(); |
1323 | 1342 | ||
1324 | // ****************************************************** | 1343 | // ****************************************************** |
1325 | // menubar icons | 1344 | // menubar icons |
1326 | 1345 | ||
1327 | 1346 | ||
1328 | 1347 | ||
1329 | //menuBar->insertItem( iconToolBar ); | 1348 | //menuBar->insertItem( iconToolBar ); |
1330 | //xdays_action | 1349 | //xdays_action |
1331 | if (p-> mShowIconNewEvent) | 1350 | if (p-> mShowIconNewEvent) |
1332 | ne_action->addTo( iconToolBar ); | 1351 | ne_action->addTo( iconToolBar ); |
1333 | if (p->mShowIconNewTodo ) | 1352 | if (p->mShowIconNewTodo ) |
1334 | nt_action->addTo( iconToolBar ); | 1353 | nt_action->addTo( iconToolBar ); |
1335 | if (p-> mShowIconSearch) | 1354 | if (p-> mShowIconSearch) |
1336 | search_action->addTo( iconToolBar ); | 1355 | search_action->addTo( iconToolBar ); |
1337 | if (p-> mShowIconWhatsThis) | 1356 | if (p-> mShowIconWhatsThis) |
1338 | QWhatsThis::whatsThisButton ( iconToolBar ); | 1357 | QWhatsThis::whatsThisButton ( iconToolBar ); |
1339 | if (p-> mShowIconNext) | 1358 | if (p-> mShowIconNext) |
1340 | whatsnext_action->addTo( viewToolBar ); | 1359 | whatsnext_action->addTo( viewToolBar ); |
1341 | if (p-> mShowIconNextDays) | 1360 | if (p-> mShowIconNextDays) |
1342 | xdays_action->addTo( viewToolBar ); | 1361 | xdays_action->addTo( viewToolBar ); |
1343 | if (p-> mShowIconJournal) | 1362 | if (p-> mShowIconJournal) |
1344 | viewjournal_action->addTo( viewToolBar ); | 1363 | viewjournal_action->addTo( viewToolBar ); |
1345 | if (p-> mShowIconDay1) | 1364 | if (p-> mShowIconDay1) |
1346 | day1_action->addTo( viewToolBar ); | 1365 | day1_action->addTo( viewToolBar ); |
1347 | if (p-> mShowIconDay5) | 1366 | if (p-> mShowIconDay5) |
1348 | day5_action->addTo( viewToolBar ); | 1367 | day5_action->addTo( viewToolBar ); |
1349 | if (p-> mShowIconDay7) | 1368 | if (p-> mShowIconDay7) |
1350 | day7_action->addTo( viewToolBar ); | 1369 | day7_action->addTo( viewToolBar ); |
1351 | if (p-> mShowIconDay6) | 1370 | if (p-> mShowIconDay6) |
1352 | day6_action->addTo( viewToolBar ); | 1371 | day6_action->addTo( viewToolBar ); |
1353 | if (p-> mShowIconMonth) | 1372 | if (p-> mShowIconMonth) |
1354 | month_action->addTo( viewToolBar ); | 1373 | month_action->addTo( viewToolBar ); |
1355 | if (p-> mShowIconList) | 1374 | if (p-> mShowIconList) |
1356 | showlist_action->addTo( viewToolBar ); | 1375 | showlist_action->addTo( viewToolBar ); |
1357 | if (p-> mShowIconTodoview) | 1376 | if (p-> mShowIconTodoview) |
1358 | todoview_action->addTo( viewToolBar ); | 1377 | todoview_action->addTo( viewToolBar ); |
1359 | 1378 | ||
1360 | icon = loadPixmap( pathString + "2leftarrowB" ); | 1379 | icon = loadPixmap( pathString + "2leftarrowB" ); |
1361 | configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200); | 1380 | configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200); |
1362 | if (p-> mShowIconBackFast) { | 1381 | if (p-> mShowIconBackFast) { |
1363 | action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); | 1382 | action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); |
1364 | connect( action, SIGNAL( activated() ), | 1383 | connect( action, SIGNAL( activated() ), |
1365 | mView, SLOT( goPreviousMonth() ) ); | 1384 | mView, SLOT( goPreviousMonth() ) ); |
1366 | action->addTo( navigatorToolBar ); | 1385 | action->addTo( navigatorToolBar ); |
1367 | } | 1386 | } |
1368 | icon = loadPixmap( pathString + "1leftarrowB" ); | 1387 | icon = loadPixmap( pathString + "1leftarrowB" ); |
1369 | configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210); | 1388 | configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210); |
1370 | if (p-> mShowIconBack) { | 1389 | if (p-> mShowIconBack) { |
1371 | action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); | 1390 | action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); |
1372 | connect( action, SIGNAL( activated() ), | 1391 | connect( action, SIGNAL( activated() ), |
1373 | mView, SLOT( goPrevious() ) ); | 1392 | mView, SLOT( goPrevious() ) ); |
1374 | action->addTo( navigatorToolBar ); | 1393 | action->addTo( navigatorToolBar ); |
1375 | } | 1394 | } |
1376 | icon = loadPixmap( pathString + "today" ); | 1395 | icon = loadPixmap( pathString + "today" ); |
1377 | configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); | 1396 | configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); |
1378 | if (p-> mShowIconToday) | 1397 | if (p-> mShowIconToday) |
1379 | today_action->addTo( navigatorToolBar ); | 1398 | today_action->addTo( navigatorToolBar ); |
1380 | icon = loadPixmap( pathString + "1rightarrowB" ); | 1399 | icon = loadPixmap( pathString + "1rightarrowB" ); |
1381 | configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); | 1400 | configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); |
1382 | if (p-> mShowIconForward) { | 1401 | if (p-> mShowIconForward) { |
1383 | action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); | 1402 | action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); |
1384 | connect( action, SIGNAL( activated() ), | 1403 | connect( action, SIGNAL( activated() ), |
1385 | mView, SLOT( goNext() ) ); | 1404 | mView, SLOT( goNext() ) ); |
1386 | action->addTo( navigatorToolBar ); | 1405 | action->addTo( navigatorToolBar ); |
1387 | } | 1406 | } |
1388 | icon = loadPixmap( pathString + "2rightarrowB" ); | 1407 | icon = loadPixmap( pathString + "2rightarrowB" ); |
1389 | configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); | 1408 | configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); |
1390 | if (p-> mShowIconForwardFast) { | 1409 | if (p-> mShowIconForwardFast) { |
1391 | action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); | 1410 | action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); |
1392 | connect( action, SIGNAL( activated() ), | 1411 | connect( action, SIGNAL( activated() ), |
1393 | mView, SLOT( goNextMonth() ) ); | 1412 | mView, SLOT( goNextMonth() ) ); |
1394 | action->addTo( navigatorToolBar ); | 1413 | action->addTo( navigatorToolBar ); |
1395 | } | 1414 | } |
1396 | 1415 | ||
1397 | 1416 | ||
1398 | configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6); | 1417 | configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6); |
1399 | 1418 | ||
1400 | 1419 | ||
1401 | if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true); | 1420 | if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true); |
1402 | if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true); | 1421 | if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true); |
1403 | if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true); | 1422 | if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true); |
1404 | if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true); | 1423 | if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true); |
1405 | 1424 | ||
1406 | if (p-> mShowIconNewEvent) | 1425 | if (p-> mShowIconNewEvent) |
1407 | configureToolBarMenu->setItemChecked( 10, true ); | 1426 | configureToolBarMenu->setItemChecked( 10, true ); |
1408 | if (p->mShowIconNewTodo ) | 1427 | if (p->mShowIconNewTodo ) |
1409 | configureToolBarMenu->setItemChecked( 20, true ); | 1428 | configureToolBarMenu->setItemChecked( 20, true ); |
1410 | if (p-> mShowIconSearch) | 1429 | if (p-> mShowIconSearch) |
1411 | configureToolBarMenu->setItemChecked( 120, true ); | 1430 | configureToolBarMenu->setItemChecked( 120, true ); |
1412 | if (p-> mShowIconList) | 1431 | if (p-> mShowIconList) |
1413 | configureToolBarMenu->setItemChecked( 30, true ); | 1432 | configureToolBarMenu->setItemChecked( 30, true ); |
1414 | if (p-> mShowIconDay1) | 1433 | if (p-> mShowIconDay1) |
1415 | configureToolBarMenu->setItemChecked( 40, true ); | 1434 | configureToolBarMenu->setItemChecked( 40, true ); |
1416 | if (p-> mShowIconDay5) | 1435 | if (p-> mShowIconDay5) |
1417 | configureToolBarMenu->setItemChecked( 50, true ); | 1436 | configureToolBarMenu->setItemChecked( 50, true ); |
1418 | if (p-> mShowIconDay6) | 1437 | if (p-> mShowIconDay6) |
1419 | configureToolBarMenu->setItemChecked( 75, true ); | 1438 | configureToolBarMenu->setItemChecked( 75, true ); |
1420 | if (p-> mShowIconDay7) | 1439 | if (p-> mShowIconDay7) |
1421 | configureToolBarMenu->setItemChecked( 60, true ); | 1440 | configureToolBarMenu->setItemChecked( 60, true ); |
1422 | if (p-> mShowIconMonth) | 1441 | if (p-> mShowIconMonth) |
1423 | configureToolBarMenu->setItemChecked( 70, true ); | 1442 | configureToolBarMenu->setItemChecked( 70, true ); |
1424 | if (p-> mShowIconTodoview) | 1443 | if (p-> mShowIconTodoview) |
1425 | configureToolBarMenu->setItemChecked( 80, true ); | 1444 | configureToolBarMenu->setItemChecked( 80, true ); |
1426 | if (p-> mShowIconBackFast) | 1445 | if (p-> mShowIconBackFast) |
1427 | configureToolBarMenu->setItemChecked( 200, true ); | 1446 | configureToolBarMenu->setItemChecked( 200, true ); |
1428 | if (p-> mShowIconBack) | 1447 | if (p-> mShowIconBack) |
1429 | configureToolBarMenu->setItemChecked( 210, true ); | 1448 | configureToolBarMenu->setItemChecked( 210, true ); |
1430 | if (p-> mShowIconToday) | 1449 | if (p-> mShowIconToday) |
1431 | configureToolBarMenu->setItemChecked( 130, true ); | 1450 | configureToolBarMenu->setItemChecked( 130, true ); |
1432 | if (p-> mShowIconForward) | 1451 | if (p-> mShowIconForward) |
1433 | configureToolBarMenu->setItemChecked( 220, true ); | 1452 | configureToolBarMenu->setItemChecked( 220, true ); |
1434 | if (p-> mShowIconForwardFast) | 1453 | if (p-> mShowIconForwardFast) |
1435 | configureToolBarMenu->setItemChecked( 230, true ); | 1454 | configureToolBarMenu->setItemChecked( 230, true ); |
1436 | if (p-> mShowIconNextDays) | 1455 | if (p-> mShowIconNextDays) |
1437 | configureToolBarMenu->setItemChecked( 100, true ); | 1456 | configureToolBarMenu->setItemChecked( 100, true ); |
1438 | if (p-> mShowIconNext) | 1457 | if (p-> mShowIconNext) |
1439 | configureToolBarMenu->setItemChecked( 110, true ); | 1458 | configureToolBarMenu->setItemChecked( 110, true ); |
1440 | if (p-> mShowIconJournal) | 1459 | if (p-> mShowIconJournal) |
1441 | configureToolBarMenu->setItemChecked( 90, true ); | 1460 | configureToolBarMenu->setItemChecked( 90, true ); |
1442 | if (p-> mShowIconWhatsThis) | 1461 | if (p-> mShowIconWhatsThis) |
1443 | configureToolBarMenu->setItemChecked( 300, true ); | 1462 | configureToolBarMenu->setItemChecked( 300, true ); |
1444 | if (p-> mShowIconWeekNum) | 1463 | if (p-> mShowIconWeekNum) |
1445 | configureToolBarMenu->setItemChecked( 400, true ); | 1464 | configureToolBarMenu->setItemChecked( 400, true ); |
1446 | if (!p-> mShowIconStretch) { | 1465 | if (!p-> mShowIconStretch) { |
1447 | QLabel* dummy = new QLabel( iconToolBar ); | 1466 | QLabel* dummy = new QLabel( iconToolBar ); |
1448 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); | 1467 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); |
1449 | dummy->setMinimumWidth( 0 ); | 1468 | dummy->setMinimumWidth( 0 ); |
1450 | iconToolBar->setStretchableWidget ( dummy ) ; | 1469 | iconToolBar->setStretchableWidget ( dummy ) ; |
1451 | } | 1470 | } |
1452 | else { | 1471 | else { |
1453 | iconToolBar->setHorizontalStretchable (true ); | 1472 | iconToolBar->setHorizontalStretchable (true ); |
1454 | viewToolBar->setHorizontalStretchable (true ); | 1473 | viewToolBar->setHorizontalStretchable (true ); |
1455 | navigatorToolBar->setHorizontalStretchable (true ); | 1474 | navigatorToolBar->setHorizontalStretchable (true ); |
1456 | iconToolBar->setVerticalStretchable (true ); | 1475 | iconToolBar->setVerticalStretchable (true ); |
1457 | viewToolBar->setVerticalStretchable (true ); | 1476 | viewToolBar->setVerticalStretchable (true ); |
1458 | navigatorToolBar->setVerticalStretchable (true ); | 1477 | navigatorToolBar->setVerticalStretchable (true ); |
1459 | configureToolBarMenu->setItemChecked( 5, true ); | 1478 | configureToolBarMenu->setItemChecked( 5, true ); |
1460 | } | 1479 | } |
1461 | if (p-> mShowIconFilter) | 1480 | if (p-> mShowIconFilter) |
1462 | configureToolBarMenu->setItemChecked( 7, true ); | 1481 | configureToolBarMenu->setItemChecked( 7, true ); |
1463 | if (p-> mShowIconOnetoolbar) | 1482 | if (p-> mShowIconOnetoolbar) |
1464 | configureToolBarMenu->setItemChecked( 6, true ); | 1483 | configureToolBarMenu->setItemChecked( 6, true ); |
1465 | 1484 | ||
1466 | 1485 | ||
1467 | if ( filterMenubar ) { | 1486 | if ( filterMenubar ) { |
1468 | filterMenubar->reparent(filterToolBar,0,QPoint(0,0) ); | 1487 | filterMenubar->reparent(filterToolBar,0,QPoint(0,0) ); |
1469 | connect( mView, SIGNAL( filtersUpdated() ), SLOT( updateFilterToolbar() ) ); | 1488 | connect( mView, SIGNAL( filtersUpdated() ), SLOT( updateFilterToolbar() ) ); |
1470 | } | 1489 | } |
1471 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); | 1490 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); |
1472 | configureAgenda( p->mHourSize ); | 1491 | configureAgenda( p->mHourSize ); |
1473 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); | 1492 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); |
1474 | } | 1493 | } |
1475 | void MainWindow::calHint() | 1494 | void MainWindow::calHint() |
1476 | { | 1495 | { |
1477 | QString message = i18n("You can use and display <b>more than one</b> calendar file in KO/Pi. A calendar file is called a <b>resource</b>. To add a calendar or change calendar settings please use menu: <b>View -> Toggle Resource View</b>."); | 1496 | QString message = i18n("You can use and display <b>more than one</b> calendar file in KO/Pi. A calendar file is called a <b>resource</b>. To add a calendar or change calendar settings please use menu: <b>View -> Toggle Resource View</b>."); |
1478 | 1497 | ||
1479 | KMessageBox::information( this, message); | 1498 | KMessageBox::information( this, message); |
1480 | } | 1499 | } |
1481 | void MainWindow::exportToPhone( int mode ) | 1500 | void MainWindow::exportToPhone( int mode ) |
1482 | { | 1501 | { |
1483 | 1502 | ||
1484 | //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); | 1503 | //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); |
1485 | //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); | 1504 | //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); |
1486 | KOex2phonePrefs ex2phone; | 1505 | KOex2phonePrefs ex2phone; |
1487 | 1506 | ||
1488 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); | 1507 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); |
1489 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); | 1508 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); |
1490 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 1509 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
1491 | if ( mode == 1 ) | 1510 | if ( mode == 1 ) |
1492 | ex2phone.setCaption(i18n("Export complete calendar")); | 1511 | ex2phone.setCaption(i18n("Export complete calendar")); |
1493 | if ( mode == 2 ) | 1512 | if ( mode == 2 ) |
1494 | ex2phone.setCaption(i18n("Export filtered calendar")); | 1513 | ex2phone.setCaption(i18n("Export filtered calendar")); |
1495 | 1514 | ||
1496 | if ( !ex2phone.exec() ) { | 1515 | if ( !ex2phone.exec() ) { |
1497 | return; | 1516 | return; |
1498 | } | 1517 | } |
1499 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); | 1518 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); |
1500 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); | 1519 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); |
1501 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); | 1520 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); |
1502 | 1521 | ||
1503 | int inFuture = 0; | 1522 | int inFuture = 0; |
1504 | if ( ex2phone.mWriteBackFuture->isChecked() ) | 1523 | if ( ex2phone.mWriteBackFuture->isChecked() ) |
1505 | inFuture = ex2phone.mWriteBackFutureWeeks->value(); | 1524 | inFuture = ex2phone.mWriteBackFutureWeeks->value(); |
1506 | QPtrList<Incidence> delSel; | 1525 | QPtrList<Incidence> delSel; |
1507 | if ( mode == 1 ) | 1526 | if ( mode == 1 ) |
1508 | delSel = mCalendar->rawIncidences(); | 1527 | delSel = mCalendar->rawIncidences(); |
1509 | if ( mode == 2 ) | 1528 | if ( mode == 2 ) |
1510 | delSel = mCalendar->incidences(); | 1529 | delSel = mCalendar->incidences(); |
1511 | CalendarLocal* cal = new CalendarLocal(); | 1530 | CalendarLocal* cal = new CalendarLocal(); |
1512 | cal->setLocalTime(); | 1531 | cal->setLocalTime(); |
1513 | Incidence *incidence = delSel.first(); | 1532 | Incidence *incidence = delSel.first(); |
1514 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); | 1533 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); |
1515 | QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); | 1534 | QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); |
1516 | while ( incidence ) { | 1535 | while ( incidence ) { |
1517 | if ( incidence->typeID() != journalID ) { | 1536 | if ( incidence->typeID() != journalID ) { |
1518 | bool add = true; | 1537 | bool add = true; |
1519 | if ( inFuture ) { | 1538 | if ( inFuture ) { |
1520 | QDateTime dt; | 1539 | QDateTime dt; |
1521 | if ( incidence->typeID() == todoID ) { | 1540 | if ( incidence->typeID() == todoID ) { |
1522 | Todo * t = (Todo*)incidence; | 1541 | Todo * t = (Todo*)incidence; |
1523 | if ( t->hasDueDate() ) | 1542 | if ( t->hasDueDate() ) |
1524 | dt = t->dtDue(); | 1543 | dt = t->dtDue(); |
1525 | else | 1544 | else |
1526 | dt = cur.addSecs( 62 ); | 1545 | dt = cur.addSecs( 62 ); |
1527 | } | 1546 | } |
1528 | else { | 1547 | else { |
1529 | bool ok; | 1548 | bool ok; |
1530 | dt = incidence->getNextOccurence( cur, &ok ); | 1549 | dt = incidence->getNextOccurence( cur, &ok ); |
1531 | if ( !ok ) | 1550 | if ( !ok ) |
1532 | dt = cur.addSecs( -62 ); | 1551 | dt = cur.addSecs( -62 ); |
1533 | } | 1552 | } |
1534 | if ( dt < cur || dt > end ) { | 1553 | if ( dt < cur || dt > end ) { |
1535 | add = false; | 1554 | add = false; |
1536 | } | 1555 | } |
1537 | } | 1556 | } |
1538 | if ( add ) { | 1557 | if ( add ) { |
1539 | Incidence *in = incidence->clone(); | 1558 | Incidence *in = incidence->clone(); |
1540 | cal->addIncidence( in ); | 1559 | cal->addIncidence( in ); |
1541 | } | 1560 | } |
1542 | } | 1561 | } |
1543 | incidence = delSel.next(); | 1562 | incidence = delSel.next(); |
1544 | } | 1563 | } |
1545 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, | 1564 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, |
1546 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, | 1565 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, |
1547 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 1566 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
1548 | 1567 | ||
1549 | setCaption( i18n("Writing to phone...")); | 1568 | setCaption( i18n("Writing to phone...")); |
1550 | if ( PhoneFormat::writeToPhone( cal ) ) | 1569 | if ( PhoneFormat::writeToPhone( cal ) ) |
1551 | setCaption( i18n("Export to phone successful!")); | 1570 | setCaption( i18n("Export to phone successful!")); |
1552 | else | 1571 | else |
1553 | setCaption( i18n("Error exporting to phone!")); | 1572 | setCaption( i18n("Error exporting to phone!")); |
1554 | delete cal; | 1573 | delete cal; |
1555 | } | 1574 | } |
1556 | 1575 | ||
1557 | 1576 | ||
1558 | void MainWindow::setDefaultPreferences() | 1577 | void MainWindow::setDefaultPreferences() |
1559 | { | 1578 | { |
1560 | KOPrefs *p = KOPrefs::instance(); | 1579 | KOPrefs *p = KOPrefs::instance(); |
1561 | 1580 | ||
1562 | p->mCompactDialogs = true; | 1581 | p->mCompactDialogs = true; |
1563 | p->mConfirm = true; | 1582 | p->mConfirm = true; |
1564 | // p->mEnableQuickTodo = false; | 1583 | // p->mEnableQuickTodo = false; |
1565 | 1584 | ||
1566 | } | 1585 | } |
1567 | 1586 | ||
1568 | QString MainWindow::resourcePath() | 1587 | QString MainWindow::resourcePath() |
1569 | { | 1588 | { |
1570 | return KGlobal::iconLoader()->iconPath(); | 1589 | return KGlobal::iconLoader()->iconPath(); |
1571 | } | 1590 | } |
1572 | 1591 | ||
1573 | void MainWindow::displayText( QString text ,QString cap ) | 1592 | void MainWindow::displayText( QString text ,QString cap ) |
1574 | { | 1593 | { |
1575 | QDialog dia( this, "name", true ); ; | 1594 | QDialog dia( this, "name", true ); ; |
1576 | dia.setCaption( cap ); | 1595 | dia.setCaption( cap ); |
1577 | QVBoxLayout* lay = new QVBoxLayout( &dia ); | 1596 | QVBoxLayout* lay = new QVBoxLayout( &dia ); |
1578 | lay->setSpacing( 3 ); | 1597 | lay->setSpacing( 3 ); |
1579 | lay->setMargin( 3 ); | 1598 | lay->setMargin( 3 ); |
1580 | QTextBrowser tb ( &dia ); | 1599 | QTextBrowser tb ( &dia ); |
1581 | lay->addWidget( &tb ); | 1600 | lay->addWidget( &tb ); |
1582 | tb.setText( text ); | 1601 | tb.setText( text ); |
1583 | #ifdef DESKTOP_VERSION | 1602 | #ifdef DESKTOP_VERSION |
1584 | dia.resize( 640, 480); | 1603 | dia.resize( 640, 480); |
1585 | #else | 1604 | #else |
1586 | dia.showMaximized(); | 1605 | dia.showMaximized(); |
1587 | #endif | 1606 | #endif |
1588 | dia.exec(); | 1607 | dia.exec(); |
1589 | } | 1608 | } |
1590 | 1609 | ||
1591 | void MainWindow::features() | 1610 | void MainWindow::features() |
1592 | { | 1611 | { |
1593 | 1612 | ||
1594 | KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); | 1613 | KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); |
1595 | } | 1614 | } |
1596 | 1615 | ||
1597 | void MainWindow::usertrans() | 1616 | void MainWindow::usertrans() |
1598 | { | 1617 | { |
1599 | 1618 | ||
1600 | KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); | 1619 | KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); |
1601 | } | 1620 | } |
1602 | 1621 | ||
1603 | void MainWindow::storagehowto() | 1622 | void MainWindow::storagehowto() |
1604 | { | 1623 | { |
1605 | KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" ); | 1624 | KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" ); |
1606 | } | 1625 | } |
1607 | void MainWindow::timetrackinghowto() | 1626 | void MainWindow::timetrackinghowto() |
1608 | { | 1627 | { |
1609 | KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" ); | 1628 | KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" ); |
1610 | } | 1629 | } |
1611 | void MainWindow::kdesynchowto() | 1630 | void MainWindow::kdesynchowto() |
1612 | { | 1631 | { |
1613 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); | 1632 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); |
1614 | } | 1633 | } |
1615 | void MainWindow::multisynchowto() | 1634 | void MainWindow::multisynchowto() |
1616 | { | 1635 | { |
1617 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); | 1636 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); |
1618 | } | 1637 | } |
1619 | void MainWindow::synchowto() | 1638 | void MainWindow::synchowto() |
1620 | { | 1639 | { |
1621 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); | 1640 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); |
1622 | } | 1641 | } |
1623 | void MainWindow::faq() | 1642 | void MainWindow::faq() |
1624 | { | 1643 | { |
1625 | KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); | 1644 | KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); |
1626 | 1645 | ||
1627 | } | 1646 | } |
1628 | void MainWindow::whatsNew() | 1647 | void MainWindow::whatsNew() |
1629 | { | 1648 | { |
1630 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); | 1649 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); |
1631 | 1650 | ||
1632 | } | 1651 | } |
1633 | void MainWindow::licence() | 1652 | void MainWindow::licence() |
1634 | { | 1653 | { |
1635 | KApplication::showLicence(); | 1654 | KApplication::showLicence(); |
1636 | 1655 | ||
1637 | } | 1656 | } |
1638 | void MainWindow::about() | 1657 | void MainWindow::about() |
1639 | { | 1658 | { |
1640 | QString version; | 1659 | QString version; |
1641 | #include <../version> | 1660 | #include <../version> |
1642 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), | 1661 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), |
1643 | i18n("KOrganizer/Platform-independent\n") + | 1662 | i18n("KOrganizer/Platform-independent\n") + |
1644 | "(KO/Pi) " + version + " - " + | 1663 | "(KO/Pi) " + version + " - " + |
1645 | 1664 | ||
1646 | #ifdef DESKTOP_VERSION | 1665 | #ifdef DESKTOP_VERSION |
1647 | i18n("Desktop Edition\n") + | 1666 | i18n("Desktop Edition\n") + |
1648 | #else | 1667 | #else |
1649 | i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + | 1668 | i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + |
1650 | #endif | 1669 | #endif |
1651 | i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") ); | 1670 | i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") ); |
1652 | } | 1671 | } |
1653 | void MainWindow::keyBindings() | 1672 | void MainWindow::keyBindings() |
1654 | { | 1673 | { |
1655 | QString cap = i18n("KO/Pi Keys + Colors"); | 1674 | QString cap = i18n("KO/Pi Keys + Colors"); |
1656 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + | 1675 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + |
1657 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ | 1676 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ |
1658 | i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") + | 1677 | i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") + |
1659 | i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") + | 1678 | i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") + |
1679 | i18n("<p><b>C+ctrl</b>: Dis/enable automatic saving</p>\n") + | ||
1660 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + | 1680 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + |
1661 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ | 1681 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ |
1662 | i18n("<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n")+ | 1682 | i18n("<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n")+ |
1663 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ | 1683 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ |
1664 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ | 1684 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ |
1665 | i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+ | 1685 | i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+ |
1666 | i18n("<p><b>Q</b>: Show next date with conflicting events\n ")+ | 1686 | i18n("<p><b>Q</b>: Show next date with conflicting events\n ")+ |
1667 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ | 1687 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ |
1668 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ | 1688 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ |
1669 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ | 1689 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ |
1670 | i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ | 1690 | i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ |
1671 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ | 1691 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ |
1672 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ | 1692 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ |
1673 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+ | 1693 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+ |
1674 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ | 1694 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ |
1675 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ | 1695 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ |
1676 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ | 1696 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ |
1677 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ | 1697 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ |
1678 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ | 1698 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ |
1679 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ | 1699 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ |
1680 | i18n("<p><h3>In agenda view:</h3></p>\n") + | 1700 | i18n("<p><h3>In agenda view:</h3></p>\n") + |
1681 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ | 1701 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ |
1682 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ | 1702 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ |
1683 | i18n("<p><h3>In todo view:</h3></p>\n") + | 1703 | i18n("<p><h3>In todo view:</h3></p>\n") + |
1684 | i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ | 1704 | i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ |
1685 | i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ | 1705 | i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ |
1686 | i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ | 1706 | i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ |
1687 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ | 1707 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ |
1688 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1708 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1689 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ | 1709 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ |
1690 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ | 1710 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ |
1691 | i18n("<p><h3>In list view:</h3></p>\n") + | 1711 | i18n("<p><h3>In list view:</h3></p>\n") + |
1692 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1712 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1693 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ | 1713 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ |
1694 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ | 1714 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ |
1695 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ | 1715 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ |
1696 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ | 1716 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ |
1697 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ | 1717 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ |
1698 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + | 1718 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + |
1699 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ | 1719 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ |
1700 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ | 1720 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ |
1701 | i18n("<p><b>E</b>: Edit item</p>\n") + | 1721 | i18n("<p><b>E</b>: Edit item</p>\n") + |
1702 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + | 1722 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + |
1703 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + | 1723 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + |
1704 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ | 1724 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ |
1705 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ | 1725 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ |
1706 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ | 1726 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ |
1707 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ | 1727 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ |
1708 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ | 1728 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ |
1709 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + | 1729 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + |
1710 | i18n("<p><b>White</b>: Item readonly</p>\n"); | 1730 | i18n("<p><b>White</b>: Item readonly</p>\n"); |
1711 | displayText( text, cap); | 1731 | displayText( text, cap); |
1712 | } | 1732 | } |
1713 | void MainWindow::aboutAutoSaving() | 1733 | void MainWindow::aboutAutoSaving() |
1714 | { | 1734 | { |
1715 | QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) 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"); | 1735 | QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) 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"); |
1716 | 1736 | ||
1717 | KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); | 1737 | KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); |
1718 | 1738 | ||
1719 | } | 1739 | } |
1720 | void MainWindow::aboutKnownBugs() | 1740 | void MainWindow::aboutKnownBugs() |
1721 | { | 1741 | { |
1722 | QMessageBox* msg; | 1742 | QMessageBox* msg; |
1723 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), | 1743 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), |
1724 | 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")+ | 1744 | 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")+ |
1725 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ | 1745 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ |
1726 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + | 1746 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + |
1727 | i18n("\nor report them in the bugtracker on\n") + | 1747 | i18n("\nor report them in the bugtracker on\n") + |
1728 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), | 1748 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), |
1729 | QMessageBox::NoIcon, | 1749 | QMessageBox::NoIcon, |
1730 | QMessageBox::Ok, | 1750 | QMessageBox::Ok, |
1731 | QMessageBox::NoButton, | 1751 | QMessageBox::NoButton, |
1732 | QMessageBox::NoButton); | 1752 | QMessageBox::NoButton); |
1733 | msg->exec(); | 1753 | msg->exec(); |
1734 | delete msg; | 1754 | delete msg; |
1735 | 1755 | ||
1736 | } | 1756 | } |
1737 | 1757 | ||
1738 | QString MainWindow::defaultFileName() | 1758 | QString MainWindow::defaultFileName() |
1739 | { | 1759 | { |
1740 | return QDir::convertSeparators( locateLocal( "data", "korganizer/mycalendar.ics" ) ); | 1760 | return QDir::convertSeparators( locateLocal( "data", "korganizer/mycalendar.ics" ) ); |
1741 | } | 1761 | } |
1742 | QString MainWindow::syncFileName() | 1762 | QString MainWindow::syncFileName() |
1743 | { | 1763 | { |
1744 | #ifdef DESKTOP_VERSION | 1764 | #ifdef DESKTOP_VERSION |
1745 | return QDir::convertSeparators( locateLocal( "tmp", "synccalendar.ics" ) ); | 1765 | return QDir::convertSeparators( locateLocal( "tmp", "synccalendar.ics" ) ); |
1746 | #else | 1766 | #else |
1747 | return QString( "/tmp/synccalendar.ics" ); | 1767 | return QString( "/tmp/synccalendar.ics" ); |
1748 | #endif | 1768 | #endif |
1749 | } | 1769 | } |
1750 | #include "koglobals.h" | 1770 | #include "koglobals.h" |
1751 | #include <kcalendarsystem.h> | 1771 | #include <kcalendarsystem.h> |
1752 | void MainWindow::updateWeek(QDate seda) | 1772 | void MainWindow::updateWeek(QDate seda) |
1753 | { | 1773 | { |
1754 | int weekNum = KGlobal::locale()->weekNum ( seda ); | 1774 | int weekNum = KGlobal::locale()->weekNum ( seda ); |
1755 | mWeekPixmap.fill( mWeekBgColor ); | 1775 | mWeekPixmap.fill( mWeekBgColor ); |
1756 | QPainter p ( &mWeekPixmap ); | 1776 | QPainter p ( &mWeekPixmap ); |
1757 | p.setFont( mWeekFont ); | 1777 | p.setFont( mWeekFont ); |
1758 | p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); | 1778 | p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); |
1759 | p.end(); | 1779 | p.end(); |
1760 | QIconSet icon3 ( mWeekPixmap ); | 1780 | QIconSet icon3 ( mWeekPixmap ); |
1761 | mWeekAction->setIconSet ( icon3 ); | 1781 | mWeekAction->setIconSet ( icon3 ); |
1762 | 1782 | ||
1763 | } | 1783 | } |
1764 | void MainWindow::updateWeekNum(const DateList &selectedDates) | 1784 | void MainWindow::updateWeekNum(const DateList &selectedDates) |
1765 | { | 1785 | { |
1766 | updateWeek( selectedDates.first() ); | 1786 | updateWeek( selectedDates.first() ); |
1767 | } | 1787 | } |
1768 | void MainWindow::processIncidenceSelection( Incidence *incidence ) | 1788 | void MainWindow::processIncidenceSelection( Incidence *incidence ) |
1769 | { | 1789 | { |
1770 | if ( !incidence ) { | 1790 | if ( !incidence ) { |
1771 | mShowAction->setMenuText( i18n("Show") ); | 1791 | mShowAction->setMenuText( i18n("Show") ); |
1772 | enableIncidenceActions( false ); | 1792 | enableIncidenceActions( false ); |
1773 | mNewSubTodoAction->setEnabled( false ); | 1793 | mNewSubTodoAction->setEnabled( false ); |
1774 | setCaptionToDates(); | 1794 | setCaptionToDates(); |
1775 | return; | 1795 | return; |
1776 | } | 1796 | } |
1777 | QString startString = ""; | 1797 | QString startString = ""; |
1778 | if ( incidence->typeID() != todoID ) { | 1798 | if ( incidence->typeID() != todoID ) { |
1779 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { | 1799 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { |
1780 | if ( incidence->doesFloat() ) { | 1800 | if ( incidence->doesFloat() ) { |
1781 | startString += ": "+incidence->dtStartDateStr( true ); | 1801 | startString += ": "+incidence->dtStartDateStr( true ); |
1782 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); | 1802 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); |
1783 | } else { | 1803 | } else { |
1784 | startString = ": "+incidence->dtStartStr(true); | 1804 | startString = ": "+incidence->dtStartStr(true); |
1785 | startString += " --- "+((Event*)incidence)->dtEndStr(true); | 1805 | startString += " --- "+((Event*)incidence)->dtEndStr(true); |
1786 | } | 1806 | } |
1787 | } else { | 1807 | } else { |
1788 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) | 1808 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) |
1789 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ | 1809 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ |
1790 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); | 1810 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); |
1791 | if ( incidence->isBirthday() || incidence->isAnniversary() ) { | 1811 | if ( incidence->isBirthday() || incidence->isAnniversary() ) { |
1792 | bool ok; | 1812 | bool ok; |
1793 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); | 1813 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); |
1794 | if ( ok ) { | 1814 | if ( ok ) { |
1795 | int years = noc.date().year() - incidence->dtStart().date().year(); | 1815 | int years = noc.date().year() - incidence->dtStart().date().year(); |
1796 | startString += i18n(" (%1 y.)"). arg( years ); | 1816 | startString += i18n(" (%1 y.)"). arg( years ); |
1797 | } | 1817 | } |
1798 | } | 1818 | } |
1799 | else | 1819 | else |
1800 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); | 1820 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); |
1801 | } | 1821 | } |
1802 | } | 1822 | } |
1803 | else { | 1823 | else { |
1804 | if ( (( KCal::Todo*)incidence)->percentComplete() == 100 ) | 1824 | if ( (( KCal::Todo*)incidence)->percentComplete() == 100 ) |
1805 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+i18n("completed on %1").arg( (( KCal::Todo*)incidence)->completedStr(true) ); | 1825 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+i18n("completed on %1").arg( (( KCal::Todo*)incidence)->completedStr(true) ); |
1806 | else | 1826 | else |
1807 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); | 1827 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); |
1808 | } | 1828 | } |
1809 | if ( !incidence->location().isEmpty() ) | 1829 | if ( !incidence->location().isEmpty() ) |
1810 | startString += " (" +incidence->location()+")"; | 1830 | startString += " (" +incidence->location()+")"; |
1811 | setCaption( incidence->summary()+startString); | 1831 | setCaption( incidence->summary()+startString); |
1812 | enableIncidenceActions( true ); | 1832 | enableIncidenceActions( true ); |
1813 | if ( incidence->typeID() == eventID ) { | 1833 | if ( incidence->typeID() == eventID ) { |
1814 | mShowAction->setMenuText( i18n("Show Event") ); | 1834 | mShowAction->setMenuText( i18n("Show Event") ); |
1815 | mNewSubTodoAction->setEnabled( false ); | 1835 | mNewSubTodoAction->setEnabled( false ); |
1816 | } else if ( incidence->typeID() == todoID ) { | 1836 | } else if ( incidence->typeID() == todoID ) { |
1817 | mShowAction->setMenuText( i18n("Show Todo") ); | 1837 | mShowAction->setMenuText( i18n("Show Todo") ); |
1818 | mNewSubTodoAction->setEnabled( true ); | 1838 | mNewSubTodoAction->setEnabled( true ); |
1819 | } else { | 1839 | } else { |
1820 | mShowAction->setMenuText( i18n("Show") ); | 1840 | mShowAction->setMenuText( i18n("Show") ); |
1821 | mNewSubTodoAction->setEnabled( false ); | 1841 | mNewSubTodoAction->setEnabled( false ); |
1822 | } | 1842 | } |
1823 | #ifdef DESKTOP_VERSION | 1843 | #ifdef DESKTOP_VERSION |
1824 | static QPixmap jP = SmallIcon( "journal" ); | 1844 | static QPixmap jP = SmallIcon( "journal" ); |
1825 | static QPixmap eP = SmallIcon( "newevent" ); | 1845 | static QPixmap eP = SmallIcon( "newevent" ); |
1826 | static QPixmap tP = SmallIcon( "newtodo" ); | 1846 | static QPixmap tP = SmallIcon( "newtodo" ); |
1827 | QIconSet icon; | 1847 | QIconSet icon; |
1828 | if ( incidence->typeID() == todoID ) | 1848 | if ( incidence->typeID() == todoID ) |
1829 | icon = QIconSet ( tP ); | 1849 | icon = QIconSet ( tP ); |
1830 | else if ( incidence->typeID() == eventID ) | 1850 | else if ( incidence->typeID() == eventID ) |
1831 | icon = QIconSet ( eP ); | 1851 | icon = QIconSet ( eP ); |
1832 | else if ( incidence->typeID() == journalID ) | 1852 | else if ( incidence->typeID() == journalID ) |
1833 | icon = QIconSet ( jP ); | 1853 | icon = QIconSet ( jP ); |
1834 | mPrintSelAction->setIconSet ( icon ); | 1854 | mPrintSelAction->setIconSet ( icon ); |
1835 | #endif | 1855 | #endif |
1836 | } | 1856 | } |
1837 | 1857 | ||
1838 | void MainWindow::enableIncidenceActions( bool enabled ) | 1858 | void MainWindow::enableIncidenceActions( bool enabled ) |
1839 | { | 1859 | { |
1840 | mShowAction->setEnabled( enabled ); | 1860 | mShowAction->setEnabled( enabled ); |
1841 | mEditAction->setEnabled( enabled ); | 1861 | mEditAction->setEnabled( enabled ); |
1842 | mDeleteAction->setEnabled( enabled ); | 1862 | mDeleteAction->setEnabled( enabled ); |
1843 | 1863 | ||
1844 | mCloneAction->setEnabled( enabled ); | 1864 | mCloneAction->setEnabled( enabled ); |
1845 | mMoveAction->setEnabled( enabled ); | 1865 | mMoveAction->setEnabled( enabled ); |
1846 | #ifndef DESKTOP_VERSION | 1866 | #ifndef DESKTOP_VERSION |
1847 | mBeamAction->setEnabled( enabled ); | 1867 | mBeamAction->setEnabled( enabled ); |
1848 | #else | 1868 | #else |
1849 | mPrintSelAction->setEnabled( enabled ); | 1869 | mPrintSelAction->setEnabled( enabled ); |
1850 | #endif | 1870 | #endif |
1851 | mCancelAction->setEnabled( enabled ); | 1871 | mCancelAction->setEnabled( enabled ); |
1852 | } | 1872 | } |
1853 | 1873 | ||
1854 | void MainWindow::importOL() | 1874 | void MainWindow::importOL() |
1855 | { | 1875 | { |
1856 | #ifdef _OL_IMPORT_ | 1876 | #ifdef _OL_IMPORT_ |
1857 | mView->clearAllViews(); | 1877 | mView->clearAllViews(); |
1858 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); | 1878 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); |
1859 | id->exec(); | 1879 | id->exec(); |
1860 | delete id; | 1880 | delete id; |
1861 | mView->calendar()->checkAlarmForIncidence( 0, true ); | 1881 | mView->calendar()->checkAlarmForIncidence( 0, true ); |
1862 | mView->updateView(); | 1882 | mView->updateView(); |
1863 | #endif | 1883 | #endif |
1864 | } | 1884 | } |
1865 | void MainWindow::importBday() | 1885 | void MainWindow::importBday() |
1866 | { | 1886 | { |
1867 | int result = QMessageBox::warning( this, i18n("KO/Pi import information!"), | 1887 | int result = QMessageBox::warning( this, i18n("KO/Pi import information!"), |
1868 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), | 1888 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), |
1869 | i18n("Import!"), i18n("Cancel"), 0, | 1889 | i18n("Import!"), i18n("Cancel"), 0, |
1870 | 0, 1 ); | 1890 | 0, 1 ); |
1871 | if ( result == 0 ) { | 1891 | if ( result == 0 ) { |
1872 | mView->importBday(); | 1892 | mView->importBday(); |
1873 | 1893 | ||
1874 | } | 1894 | } |
1875 | 1895 | ||
1876 | 1896 | ||
1877 | } | 1897 | } |
1878 | void MainWindow::importQtopia() | 1898 | void MainWindow::importQtopia() |
1879 | { | 1899 | { |
1880 | //#ifndef DESKTOP_VERSION | 1900 | //#ifndef DESKTOP_VERSION |
1881 | QString mess = 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"); | 1901 | QString mess = 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"); |
1882 | #ifdef DESKTOP_VERSION | 1902 | #ifdef DESKTOP_VERSION |
1883 | mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); | 1903 | mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); |
1884 | #endif | 1904 | #endif |
1885 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, | 1905 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, |
1886 | i18n("Import!"), i18n("Cancel"), 0, | 1906 | i18n("Import!"), i18n("Cancel"), 0, |
1887 | 0, 1 ); | 1907 | 0, 1 ); |
1888 | if ( result == 0 ) { | 1908 | if ( result == 0 ) { |
1889 | #ifndef DESKTOP_VERSION | 1909 | #ifndef DESKTOP_VERSION |
1890 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); | 1910 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); |
1891 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); | 1911 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); |
1892 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; | 1912 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; |
1893 | #else | 1913 | #else |
1894 | QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; | 1914 | QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; |
1895 | QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; | 1915 | QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; |
1896 | QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; | 1916 | QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; |
1897 | #endif | 1917 | #endif |
1898 | mView->importQtopia( categories, datebook, todolist ); | 1918 | mView->importQtopia( categories, datebook, todolist ); |
1899 | } | 1919 | } |
1900 | mView->calendar()->reInitAlarmSettings(); | 1920 | mView->calendar()->reInitAlarmSettings(); |
1901 | #if 0 | 1921 | #if 0 |
1902 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1922 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1903 | i18n("Not supported \non desktop!\n"), | 1923 | i18n("Not supported \non desktop!\n"), |
1904 | i18n("Ok"), i18n("Cancel"), 0, | 1924 | i18n("Ok"), i18n("Cancel"), 0, |
1905 | 0, 1 ); | 1925 | 0, 1 ); |
1906 | 1926 | ||
1907 | #endif | 1927 | #endif |
1908 | } | 1928 | } |
1909 | 1929 | ||
1910 | void MainWindow::saveOnClose() | 1930 | void MainWindow::saveOnClose() |
1911 | { | 1931 | { |
1912 | KOPrefs *p = KOPrefs::instance(); | 1932 | KOPrefs *p = KOPrefs::instance(); |
1913 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); | 1933 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); |
1914 | p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal ); | 1934 | p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal ); |
1915 | p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); | 1935 | p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); |
1916 | if ( filterToolBar ) { | 1936 | if ( filterToolBar ) { |
1917 | p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); | 1937 | p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); |
1918 | } | 1938 | } |
1919 | #ifdef DESKTOP_VERSION | 1939 | #ifdef DESKTOP_VERSION |
1920 | 1940 | ||
1921 | QPoint myP; | 1941 | QPoint myP; |
1922 | myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1942 | myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1923 | if ( p->mToolBarHor ) | 1943 | if ( p->mToolBarHor ) |
1924 | p->mToolBarUp = myP.y() > height()/2; | 1944 | p->mToolBarUp = myP.y() > height()/2; |
1925 | else | 1945 | else |
1926 | p->mToolBarUp = myP.x() > width()/2; | 1946 | p->mToolBarUp = myP.x() > width()/2; |
1927 | myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1947 | myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1928 | if ( p->mToolBarHorV ) | 1948 | if ( p->mToolBarHorV ) |
1929 | p->mToolBarUpV = myP.y() > height()/2; | 1949 | p->mToolBarUpV = myP.y() > height()/2; |
1930 | else | 1950 | else |
1931 | p->mToolBarUpV = myP.x() > width()/2 ; | 1951 | p->mToolBarUpV = myP.x() > width()/2 ; |
1932 | myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1952 | myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1933 | if ( p->mToolBarHorN ) | 1953 | if ( p->mToolBarHorN ) |
1934 | p->mToolBarUpN = myP.y() > height()/2; | 1954 | p->mToolBarUpN = myP.y() > height()/2; |
1935 | else | 1955 | else |
1936 | p->mToolBarUpN = myP.x() > width()/2 ; | 1956 | p->mToolBarUpN = myP.x() > width()/2 ; |
1937 | if ( filterToolBar ) { | 1957 | if ( filterToolBar ) { |
1938 | myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1958 | myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1939 | if ( p->mToolBarHorF ) | 1959 | if ( p->mToolBarHorF ) |
1940 | p->mToolBarUpF = myP.y() > height()/2; | 1960 | p->mToolBarUpF = myP.y() > height()/2; |
1941 | else | 1961 | else |
1942 | p->mToolBarUpF = myP.x() > width()/2 ; | 1962 | p->mToolBarUpF = myP.x() > width()/2 ; |
1943 | } | 1963 | } |
1944 | #else | 1964 | #else |
1945 | if ( p->mToolBarHor ) | 1965 | if ( p->mToolBarHor ) |
1946 | p->mToolBarUp = iconToolBar->y() > height()/2; | 1966 | p->mToolBarUp = iconToolBar->y() > height()/2; |
1947 | else | 1967 | else |
1948 | p->mToolBarUp = iconToolBar->x() > width()/2; | 1968 | p->mToolBarUp = iconToolBar->x() > width()/2; |
1949 | if ( p->mToolBarHorV ) | 1969 | if ( p->mToolBarHorV ) |
1950 | p->mToolBarUpV = viewToolBar->y() > height()/2; | 1970 | p->mToolBarUpV = viewToolBar->y() > height()/2; |
1951 | else | 1971 | else |
1952 | p->mToolBarUpV = viewToolBar->x() > width()/2 ; | 1972 | p->mToolBarUpV = viewToolBar->x() > width()/2 ; |
1953 | 1973 | ||
1954 | if ( p->mToolBarHorN ) | 1974 | if ( p->mToolBarHorN ) |
1955 | p->mToolBarUpN = navigatorToolBar->y() > height()/2; | 1975 | p->mToolBarUpN = navigatorToolBar->y() > height()/2; |
1956 | else | 1976 | else |
1957 | p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; | 1977 | p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; |
1958 | if ( filterToolBar ) { | 1978 | if ( filterToolBar ) { |
1959 | if ( p->mToolBarHorF ) | 1979 | if ( p->mToolBarHorF ) |
1960 | p->mToolBarUpF = filterToolBar->y() > height()/2; | 1980 | p->mToolBarUpF = filterToolBar->y() > height()/2; |
1961 | else | 1981 | else |
1962 | p->mToolBarUpF = filterToolBar->x() > width()/2 ; | 1982 | p->mToolBarUpF = filterToolBar->x() > width()/2 ; |
1963 | } | 1983 | } |
1964 | #endif | 1984 | #endif |
1965 | save(); | 1985 | save(); |
1966 | mView->writeSettings(); | 1986 | mView->writeSettings(); |
1967 | mView->checkSuspendAlarm(); | 1987 | mView->checkSuspendAlarm(); |
1968 | } | 1988 | } |
1969 | void MainWindow::slotModifiedChanged( bool ) | 1989 | void MainWindow::slotModifiedChanged( bool ) |
1970 | { | 1990 | { |
1971 | if ( mBlockAtStartup ) | 1991 | if ( mBlockAtStartup ) |
1972 | return; | 1992 | return; |
1973 | 1993 | ||
1974 | int msec; | 1994 | int msec; |
1995 | if ( mAutoSaveDisabled ) { | ||
1996 | QTimer::singleShot( 0, this , SLOT ( autoSaveWarning() ) ); | ||
1997 | qDebug("KO: Autosave disabled (data change deteced)!"); | ||
1998 | } | ||
1975 | if ( mCalendarModifiedFlag ) { | 1999 | if ( mCalendarModifiedFlag ) { |
1976 | //qDebug(" MainWindow timer is running "); | 2000 | //qDebug(" MainWindow timer is running "); |
1977 | return; | 2001 | return; |
1978 | } | 2002 | } |
2003 | mCalendarModifiedFlag = true; | ||
2004 | if ( mAutoSaveDisabled ) { | ||
2005 | return; | ||
2006 | } | ||
1979 | // we store the changes after 1 minute, | 2007 | // we store the changes after 1 minute, |
1980 | // and for safety reasons after 10 minutes again | 2008 | // and for safety reasons after 10 minutes again |
1981 | if ( !mSyncManager->blockSave() ) | 2009 | if ( !mSyncManager->blockSave() ) |
1982 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; | 2010 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; |
1983 | else | 2011 | else |
1984 | msec = 1000 * 600; | 2012 | msec = 1000 * 600; |
1985 | mSaveTimer.start( msec, true ); // 1 minute | 2013 | mSaveTimer.start( msec, true ); // 1 minute |
1986 | mSaveTimerStart = QDateTime::currentDateTime(); | 2014 | mSaveTimerStart = QDateTime::currentDateTime(); |
1987 | mSaveDelay = msec/1000; | 2015 | mSaveDelay = msec/1000; |
1988 | qDebug("KO: Saving File in %d secs!", msec/1000); | 2016 | qDebug("KO: Saving File in %d secs!", msec/1000); |
1989 | mCalendarModifiedFlag = true; | 2017 | } |
2018 | void MainWindow::autoSaveWarning() | ||
2019 | { | ||
2020 | setCaption(i18n("Autosave disabled!" )); | ||
1990 | } | 2021 | } |
1991 | void MainWindow::saveStopTimer() | 2022 | void MainWindow::saveStopTimer() |
1992 | { | 2023 | { |
1993 | mSaveTimer.stop(); | 2024 | mSaveTimer.stop(); |
2025 | mSaveDelay = 0; | ||
1994 | } | 2026 | } |
1995 | void MainWindow::backupAllFiles() | 2027 | void MainWindow::backupAllFiles() |
1996 | { | 2028 | { |
1997 | QDate reference ( 2000,1,1); | 2029 | QDate reference ( 2000,1,1); |
1998 | int daysTo = reference.daysTo ( QDate::currentDate() ); | 2030 | int daysTo = reference.daysTo ( QDate::currentDate() ); |
1999 | setCaption(i18n("Creating backup ... please wait ..." )); | 2031 | setCaption(i18n("Creating backup ... please wait ..." )); |
2000 | qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate); | 2032 | qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate); |
2001 | // we need the file path, the backup dir and the number of bups as param | 2033 | // we need the file path, the backup dir and the number of bups as param |
2002 | QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; | 2034 | QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; |
2003 | if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) | 2035 | if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) |
2004 | bupDir = KGlobalSettings::backupDataDir(); | 2036 | bupDir = KGlobalSettings::backupDataDir(); |
2005 | int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); | 2037 | int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); |
2006 | if ( retval == 0 ) { | 2038 | if ( retval == 0 ) { |
2007 | setCaption(i18n("Backup cancelled" )); | 2039 | setCaption(i18n("Backup cancelled" )); |
2008 | qDebug("KO: Backup cancelled. Will try again tomorrow "); | 2040 | qDebug("KO: Backup cancelled. Will try again tomorrow "); |
2009 | // retval == 0 : backup skipped for today, try again tomorrow | 2041 | // retval == 0 : backup skipped for today, try again tomorrow |
2010 | KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1; | 2042 | KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1; |
2011 | } else if ( retval == 1 ){ | 2043 | } else if ( retval == 1 ){ |
2012 | qDebug("KO: Backup created."); | 2044 | qDebug("KO: Backup created."); |
2013 | // backup ok | 2045 | // backup ok |
2014 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | 2046 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; |
2015 | KopiCalendarFile * cal = calendars.first(); | 2047 | KopiCalendarFile * cal = calendars.first(); |
2016 | cal = calendars.next(); | 2048 | cal = calendars.next(); |
2017 | while ( cal ) { | 2049 | while ( cal ) { |
2018 | if ( !cal->mErrorOnLoad ) { | 2050 | if ( !cal->mErrorOnLoad ) { |
2019 | KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); | 2051 | KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); |
2020 | } | 2052 | } |
2021 | cal = calendars.next(); | 2053 | cal = calendars.next(); |
2022 | } | 2054 | } |
2023 | KOPrefs::instance()->mLastBackupDate = daysTo; | 2055 | KOPrefs::instance()->mLastBackupDate = daysTo; |
2024 | setCaption(i18n("Backup succesfully finished" )); | 2056 | setCaption(i18n("Backup succesfully finished" )); |
2025 | } else if ( retval == 2 ){ | 2057 | } else if ( retval == 2 ){ |
2026 | setCaption(i18n("Backup globally disabled" )); | 2058 | setCaption(i18n("Backup globally disabled" )); |
2027 | qDebug("KO: Backup globally cancelled."); | 2059 | qDebug("KO: Backup globally cancelled."); |
2028 | // backup globally cancelled | 2060 | // backup globally cancelled |
2029 | KPimGlobalPrefs::instance()->mBackupEnabled = false; | 2061 | KPimGlobalPrefs::instance()->mBackupEnabled = false; |
2030 | } | 2062 | } |
2031 | // retval == 3: do nothing, try again later | 2063 | // retval == 3: do nothing, try again later |
2032 | } | 2064 | } |
2033 | void MainWindow::save() | 2065 | void MainWindow::save() |
2034 | { | 2066 | { |
2035 | if ( mSaveDelay ) { | 2067 | if ( mSaveDelay ) { |
2036 | int elapsed = mSaveTimerStart.secsTo( QDateTime::currentDateTime() ); | 2068 | int elapsed = mSaveTimerStart.secsTo( QDateTime::currentDateTime() ); |
2037 | if ( mSaveDelay < elapsed ) { | 2069 | if ( mSaveDelay < elapsed ) { |
2038 | qDebug("KO: Pending save after wakeup from suspend detected."); | 2070 | qDebug("KO: Pending save after wakeup from suspend detected."); |
2039 | qDebug("KO: Save delay %d sec. Elapsed save time %d sec.", mSaveDelay, elapsed ); | 2071 | qDebug("KO: Save delay %d sec. Elapsed save time %d sec.", mSaveDelay, elapsed ); |
2040 | qDebug("KO: Restarting save timer to save in 10 sec."); | 2072 | qDebug("KO: Restarting save timer to save in 10 sec."); |
2041 | int msec = 10000; | 2073 | int msec = 10000; |
2042 | mSaveTimer.start( msec, true ); | 2074 | mSaveTimer.start( msec, true ); |
2043 | mSaveTimerStart = QDateTime::currentDateTime(); | 2075 | mSaveTimerStart = QDateTime::currentDateTime(); |
2044 | mSaveDelay = msec/1000; | 2076 | mSaveDelay = msec/1000; |
2045 | return; | 2077 | return; |
2046 | } | 2078 | } |
2047 | } | 2079 | } |
2048 | if ( mView->viewManager()->journalView() ) | 2080 | if ( mView->viewManager()->journalView() ) |
2049 | mView->viewManager()->journalView()->checkModified(); | 2081 | mView->viewManager()->journalView()->checkModified(); |
2050 | if ( !mCalendarModifiedFlag ) { | 2082 | if ( !mCalendarModifiedFlag ) { |
2051 | qDebug("KO: Calendar not modified. Nothing saved."); | 2083 | qDebug("KO: Calendar not modified. Nothing saved."); |
2052 | return; | 2084 | return; |
2053 | } | 2085 | } |
2054 | if ( mSyncManager->blockSave() ) { | 2086 | if ( mSyncManager->blockSave() ) { |
2055 | slotModifiedChanged( true ); | 2087 | slotModifiedChanged( true ); |
2056 | return; | 2088 | return; |
2057 | } | 2089 | } |
2058 | #ifndef DESKTOP_VERSION | 2090 | #ifndef DESKTOP_VERSION |
2059 | // QPEApplication::setTempScreenSaverMode ( QPEApplication::Disable ); | 2091 | // QPEApplication::setTempScreenSaverMode ( QPEApplication::Disable ); |
2060 | #endif | 2092 | #endif |
2061 | mSaveDelay = 0; | 2093 | mSaveDelay = 0; |
2062 | mSyncManager->setBlockSave(true); | 2094 | mSyncManager->setBlockSave(true); |
2063 | if ( mView->checkAllFileVersions() ) { | 2095 | if ( mView->checkAllFileVersions() ) { |
2064 | if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ | 2096 | if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ |
2065 | QDate reference ( 2000,1,1); | 2097 | QDate reference ( 2000,1,1); |
2066 | int daysTo = reference.daysTo ( QDate::currentDate() ); | 2098 | int daysTo = reference.daysTo ( QDate::currentDate() ); |
2067 | if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { | 2099 | if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { |
2068 | backupAllFiles(); | 2100 | backupAllFiles(); |
2069 | } | 2101 | } |
2070 | ; // KPimGlobalPrefs::instance()->mLastBackupDate | 2102 | ; // KPimGlobalPrefs::instance()->mLastBackupDate |
2071 | } | 2103 | } |
2072 | QTime neededSaveTime; | 2104 | QTime neededSaveTime; |
2073 | neededSaveTime.start(); | 2105 | neededSaveTime.start(); |
2074 | if ( !isMinimized () ) | 2106 | if ( !isMinimized () ) |
2075 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); | 2107 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); |
2076 | qDebug("KO: Start saving data to file!"); | 2108 | qDebug("KO: Start saving data to file!"); |
2077 | if ( mView->saveCalendars() ) | 2109 | if ( mView->saveCalendars() ) |
2078 | mCalendarModifiedFlag = false; | 2110 | mCalendarModifiedFlag = false; |
2079 | int msNeeded = neededSaveTime.elapsed(); | 2111 | int msNeeded = neededSaveTime.elapsed(); |
2080 | qDebug("KO: Needed %d ms for saving.",msNeeded ); | 2112 | qDebug("KO: Needed %d ms for saving.",msNeeded ); |
2081 | QString savemes; | 2113 | QString savemes; |
2082 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); | 2114 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); |
2083 | if ( !isMinimized () ) | 2115 | if ( !isMinimized () ) |
2084 | setCaption(savemes); | 2116 | setCaption(savemes); |
2085 | else | 2117 | else |
2086 | qDebug(savemes); | 2118 | qDebug(savemes); |
2087 | } else { | 2119 | } else { |
2088 | setCaption(i18n("Saving cancelled!")); | 2120 | setCaption(i18n("Saving cancelled!")); |
2089 | mCalendarModifiedFlag = false; | 2121 | mCalendarModifiedFlag = false; |
2090 | slotModifiedChanged( true ); | 2122 | slotModifiedChanged( true ); |
2091 | } | 2123 | } |
2092 | mSyncManager->setBlockSave( false ); | 2124 | mSyncManager->setBlockSave( false ); |
2093 | #ifndef DESKTOP_VERSION | 2125 | #ifndef DESKTOP_VERSION |
2094 | //QPEApplication::setTempScreenSaverMode ( QPEApplication::Enable ); | 2126 | //QPEApplication::setTempScreenSaverMode ( QPEApplication::Enable ); |
2095 | #endif | 2127 | #endif |
2096 | } | 2128 | } |
2097 | 2129 | ||
2098 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) | 2130 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) |
2099 | { | 2131 | { |
2100 | if ( !e->isAutoRepeat() ) { | 2132 | if ( !e->isAutoRepeat() ) { |
2101 | mFlagKeyPressed = false; | 2133 | mFlagKeyPressed = false; |
2102 | } | 2134 | } |
2103 | } | 2135 | } |
2104 | void MainWindow::keyPressEvent ( QKeyEvent * e ) | 2136 | void MainWindow::keyPressEvent ( QKeyEvent * e ) |
2105 | { | 2137 | { |
2106 | qApp->processEvents(); | 2138 | qApp->processEvents(); |
2107 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | 2139 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { |
2108 | e->ignore(); | 2140 | e->ignore(); |
2109 | // qDebug(" ignore %d",e->isAutoRepeat() ); | 2141 | // qDebug(" ignore %d",e->isAutoRepeat() ); |
2110 | return; | 2142 | return; |
2111 | } | 2143 | } |
2112 | if (! e->isAutoRepeat() ) | 2144 | if (! e->isAutoRepeat() ) |
2113 | mFlagKeyPressed = true; | 2145 | mFlagKeyPressed = true; |
2114 | KOPrefs *p = KOPrefs::instance(); | 2146 | KOPrefs *p = KOPrefs::instance(); |
2115 | bool showSelectedDates = false; | 2147 | bool showSelectedDates = false; |
2116 | int size; | 2148 | int size; |
2117 | int pro = 0; | 2149 | int pro = 0; |
2118 | //qDebug("MainWindow::keyPressEvent "); | 2150 | //qDebug("MainWindow::keyPressEvent "); |
2119 | switch ( e->key() ) { | 2151 | switch ( e->key() ) { |
2120 | case Qt::Key_Right: | 2152 | case Qt::Key_Right: |
2121 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 2153 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
2122 | mView->goNextMonth(); | 2154 | mView->goNextMonth(); |
2123 | else | 2155 | else |
2124 | mView->goNext(); | 2156 | mView->goNext(); |
2125 | showSelectedDates = true; | 2157 | showSelectedDates = true; |
2126 | break; | 2158 | break; |
2127 | case Qt::Key_Left: | 2159 | case Qt::Key_Left: |
2128 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 2160 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
2129 | mView->goPreviousMonth(); | 2161 | mView->goPreviousMonth(); |
2130 | else | 2162 | else |
2131 | mView->goPrevious(); | 2163 | mView->goPrevious(); |
2132 | showSelectedDates = true; | 2164 | showSelectedDates = true; |
2133 | break; | 2165 | break; |
2134 | case Qt::Key_Down: | 2166 | case Qt::Key_Down: |
2135 | mView->viewManager()->agendaView()->scrollOneHourDown(); | 2167 | mView->viewManager()->agendaView()->scrollOneHourDown(); |
2136 | break; | 2168 | break; |
2137 | case Qt::Key_Up: | 2169 | case Qt::Key_Up: |
2138 | mView->viewManager()->agendaView()->scrollOneHourUp(); | 2170 | mView->viewManager()->agendaView()->scrollOneHourUp(); |
2139 | break; | 2171 | break; |
2140 | case Qt::Key_K: | 2172 | case Qt::Key_K: |
2141 | mView->viewManager()->showMonthViewWeek(); | 2173 | mView->viewManager()->showMonthViewWeek(); |
2142 | break; | 2174 | break; |
2143 | case Qt::Key_I: | 2175 | case Qt::Key_I: |
2144 | mView->showIncidence(); | 2176 | mView->showIncidence(); |
2145 | break; | 2177 | break; |
2146 | case Qt::Key_Delete: | 2178 | case Qt::Key_Delete: |
2147 | case Qt::Key_Backspace: | 2179 | case Qt::Key_Backspace: |
2148 | mView->deleteIncidence(); | 2180 | mView->deleteIncidence(); |
2149 | break; | 2181 | break; |
2150 | case Qt::Key_D: | 2182 | case Qt::Key_D: |
2151 | mView->viewManager()->showDayView(); | 2183 | mView->viewManager()->showDayView(); |
2152 | showSelectedDates = true; | 2184 | showSelectedDates = true; |
2153 | break; | 2185 | break; |
2154 | case Qt::Key_O: | 2186 | case Qt::Key_O: |
2155 | mView->toggleFilerEnabled( ); | 2187 | mView->toggleFilerEnabled( ); |
2156 | break; | 2188 | break; |
2157 | case Qt::Key_0: | 2189 | case Qt::Key_0: |
2158 | case Qt::Key_1: | 2190 | case Qt::Key_1: |
2159 | case Qt::Key_2: | 2191 | case Qt::Key_2: |
2160 | case Qt::Key_3: | 2192 | case Qt::Key_3: |
2161 | case Qt::Key_4: | 2193 | case Qt::Key_4: |
2162 | case Qt::Key_5: | 2194 | case Qt::Key_5: |
2163 | case Qt::Key_6: | 2195 | case Qt::Key_6: |
2164 | case Qt::Key_7: | 2196 | case Qt::Key_7: |
2165 | case Qt::Key_8: | 2197 | case Qt::Key_8: |
2166 | case Qt::Key_9: | 2198 | case Qt::Key_9: |
2167 | pro = e->key()-48; | 2199 | pro = e->key()-48; |
2168 | if ( pro == 0 ) | 2200 | if ( pro == 0 ) |
2169 | pro = 10; | 2201 | pro = 10; |
2170 | if ( e->state() == Qt::ControlButton) | 2202 | if ( e->state() == Qt::ControlButton) |
2171 | pro += 10; | 2203 | pro += 10; |
2172 | break; | 2204 | break; |
2173 | case Qt::Key_M: | 2205 | case Qt::Key_M: |
2174 | mView->viewManager()->showMonthView(); | 2206 | mView->viewManager()->showMonthView(); |
2175 | showSelectedDates = true; | 2207 | showSelectedDates = true; |
2176 | break; | 2208 | break; |
2177 | case Qt::Key_Insert: | 2209 | case Qt::Key_Insert: |
2178 | mView->newEvent(); | 2210 | mView->newEvent(); |
2179 | break; | 2211 | break; |
2180 | case Qt::Key_S : | 2212 | case Qt::Key_S : |
2181 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 2213 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
2182 | mView->newSubTodo(); | 2214 | mView->newSubTodo(); |
2183 | else | 2215 | else |
2184 | mView->dialogManager()->showSearchDialog(); | 2216 | mView->dialogManager()->showSearchDialog(); |
2185 | break; | 2217 | break; |
2186 | case Qt::Key_Y : | 2218 | case Qt::Key_Y : |
2187 | case Qt::Key_Z : | 2219 | case Qt::Key_Z : |
2188 | mView->viewManager()->showWorkWeekView(); | 2220 | mView->viewManager()->showWorkWeekView(); |
2189 | showSelectedDates = true; | 2221 | showSelectedDates = true; |
2190 | break; | 2222 | break; |
2191 | case Qt::Key_U : | 2223 | case Qt::Key_U : |
2192 | mView->viewManager()->showWeekView(); | 2224 | mView->viewManager()->showWeekView(); |
2193 | showSelectedDates = true; | 2225 | showSelectedDates = true; |
2194 | break; | 2226 | break; |
2195 | case Qt::Key_H : | 2227 | case Qt::Key_H : |
2196 | keyBindings(); | 2228 | keyBindings(); |
2197 | break; | 2229 | break; |
2198 | case Qt::Key_W: | 2230 | case Qt::Key_W: |
2199 | mView->viewManager()->showWhatsNextView(); | 2231 | mView->viewManager()->showWhatsNextView(); |
2200 | break; | 2232 | break; |
2201 | case Qt::Key_L: | 2233 | case Qt::Key_L: |
2202 | mView->viewManager()->showListView(); | 2234 | mView->viewManager()->showListView(); |
2203 | break; | 2235 | break; |
2204 | case Qt::Key_N: | 2236 | case Qt::Key_N: |
2205 | mView->viewManager()->showNextView(); | 2237 | mView->viewManager()->showNextView(); |
2206 | break; | 2238 | break; |
2207 | case Qt::Key_V: | 2239 | case Qt::Key_V: |
2208 | mView->viewManager()->showTodoView(); | 2240 | mView->viewManager()->showTodoView(); |
2209 | break; | 2241 | break; |
2210 | case Qt::Key_C: | 2242 | case Qt::Key_C: |
2211 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); | 2243 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) { |
2244 | if ( mAutoSaveDisabled ) { | ||
2245 | mAutoSaveDisabled = false; | ||
2246 | setCaption(i18n("Autosave enabled!" )); | ||
2247 | return; | ||
2248 | } else { | ||
2249 | mAutoSaveDisabled = true; | ||
2250 | saveStopTimer(); | ||
2251 | setCaption(i18n("Autosave disabled! Save timer stopped!" )); | ||
2252 | } | ||
2253 | } else | ||
2254 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); | ||
2212 | break; | 2255 | break; |
2213 | case Qt::Key_P: | 2256 | case Qt::Key_P: |
2214 | mView->showDatePicker( ); | 2257 | mView->showDatePicker( ); |
2215 | break; | 2258 | break; |
2216 | case Qt::Key_F: | 2259 | case Qt::Key_F: |
2217 | mView->editFilters(); | 2260 | mView->editFilters(); |
2218 | break; | 2261 | break; |
2219 | case Qt::Key_R: | 2262 | case Qt::Key_R: |
2220 | mView->toggleFilter(); | 2263 | mView->toggleFilter(); |
2221 | break; | 2264 | break; |
2222 | case Qt::Key_X: | 2265 | case Qt::Key_X: |
2223 | if ( e->state() == Qt::ControlButton ) | 2266 | if ( e->state() == Qt::ControlButton ) |
2224 | mView->toggleDateNavigatorWidget(); | 2267 | mView->toggleDateNavigatorWidget(); |
2225 | else { | 2268 | else { |
2226 | mView->viewManager()->showNextXView(); | 2269 | mView->viewManager()->showNextXView(); |
2227 | showSelectedDates = true; | 2270 | showSelectedDates = true; |
2228 | } | 2271 | } |
2229 | break; | 2272 | break; |
2230 | case Qt::Key_Space: | 2273 | case Qt::Key_Space: |
2231 | mView->toggleExpand(); | 2274 | mView->toggleExpand(); |
2232 | break; | 2275 | break; |
2233 | case Qt::Key_A: | 2276 | case Qt::Key_A: |
2234 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) | 2277 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) |
2235 | mView->showNextAlarms(); | 2278 | mView->showNextAlarms(); |
2236 | else | 2279 | else |
2237 | mView->toggleAllDaySize(); | 2280 | mView->toggleAllDaySize(); |
2238 | break; | 2281 | break; |
2239 | case Qt::Key_T: | 2282 | case Qt::Key_T: |
2240 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 2283 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
2241 | mView->newTodo(); | 2284 | mView->newTodo(); |
2242 | else { | 2285 | else { |
2243 | mView->goToday(); | 2286 | mView->goToday(); |
2244 | showSelectedDates = true; | 2287 | showSelectedDates = true; |
2245 | } | 2288 | } |
2246 | break; | 2289 | break; |
2247 | case Qt::Key_Q: | 2290 | case Qt::Key_Q: |
2248 | if ( e->state() == Qt::ControlButton ) | 2291 | if ( e->state() == Qt::ControlButton ) |
2249 | mView->conflictNotAll(); | 2292 | mView->conflictNotAll(); |
2250 | else if ( e->state() == Qt::ShiftButton ) | 2293 | else if ( e->state() == Qt::ShiftButton ) |
2251 | mView->conflictAllday(); | 2294 | mView->conflictAllday(); |
2252 | else | 2295 | else |
2253 | mView->conflictAll(); | 2296 | mView->conflictAll(); |
2254 | break; | 2297 | break; |
2255 | case Qt::Key_J: | 2298 | case Qt::Key_J: |
2256 | mView->viewManager()->showJournalView(); | 2299 | mView->viewManager()->showJournalView(); |
2257 | break; | 2300 | break; |
2258 | case Qt::Key_B: | 2301 | case Qt::Key_B: |
2259 | mView->editIncidenceDescription();; | 2302 | mView->editIncidenceDescription();; |
2260 | break; | 2303 | break; |
2261 | // case Qt::Key_Return: | 2304 | // case Qt::Key_Return: |
2262 | case Qt::Key_E: | 2305 | case Qt::Key_E: |
2263 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 2306 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
2264 | mView->newEvent(); | 2307 | mView->newEvent(); |
2265 | else | 2308 | else |
2266 | mView->editIncidence(); | 2309 | mView->editIncidence(); |
2267 | break; | 2310 | break; |
2268 | case Qt::Key_Plus: | 2311 | case Qt::Key_Plus: |
2269 | size = p->mHourSize +2; | 2312 | size = p->mHourSize +2; |
2270 | if ( size <= 22 ) | 2313 | if ( size <= 22 ) |
2271 | configureAgenda( size ); | 2314 | configureAgenda( size ); |
2272 | break; | 2315 | break; |
2273 | case Qt::Key_Minus: | 2316 | case Qt::Key_Minus: |
2274 | size = p->mHourSize - 2; | 2317 | size = p->mHourSize - 2; |
2275 | if ( size >= 4 ) | 2318 | if ( size >= 4 ) |
2276 | configureAgenda( size ); | 2319 | configureAgenda( size ); |
2277 | break; | 2320 | break; |
2278 | 2321 | ||
2279 | 2322 | ||
2280 | default: | 2323 | default: |
2281 | e->ignore(); | 2324 | e->ignore(); |
2282 | } | 2325 | } |
2283 | if ( pro > 0 ) { | 2326 | if ( pro > 0 ) { |
2284 | selectFilter( pro+1 ); | 2327 | selectFilter( pro+1 ); |
2285 | } | 2328 | } |
2286 | if ( showSelectedDates ) { | 2329 | if ( showSelectedDates ) { |
2287 | ;// setCaptionToDates(); | 2330 | ;// setCaptionToDates(); |
2288 | } | 2331 | } |
2289 | 2332 | ||
2290 | } | 2333 | } |
2291 | void MainWindow::fillFilterMenuTB() | 2334 | void MainWindow::fillFilterMenuTB() |
2292 | { | 2335 | { |
2293 | selectFilterMenuTB->clear(); | 2336 | selectFilterMenuTB->clear(); |
2294 | selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 ); | 2337 | selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 ); |
2295 | selectFilterMenuTB->insertSeparator(); | 2338 | selectFilterMenuTB->insertSeparator(); |
2296 | selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 ); | 2339 | selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 ); |
2297 | 2340 | ||
2298 | selectFilterMenuTB->insertSeparator(); | 2341 | selectFilterMenuTB->insertSeparator(); |
2299 | QPtrList<CalFilter> fili = mView->filters(); | 2342 | QPtrList<CalFilter> fili = mView->filters(); |
2300 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 2343 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
2301 | CalFilter *filter = fili.first(); | 2344 | CalFilter *filter = fili.first(); |
2302 | int iii = 2; | 2345 | int iii = 2; |
2303 | bool checkitem = mView->filterView()->filtersEnabled(); | 2346 | bool checkitem = mView->filterView()->filtersEnabled(); |
2304 | while(filter) { | 2347 | while(filter) { |
2305 | selectFilterMenuTB->insertItem( filter->name(), iii ); | 2348 | selectFilterMenuTB->insertItem( filter->name(), iii ); |
2306 | if ( filter == curfilter) | 2349 | if ( filter == curfilter) |
2307 | selectFilterMenuTB->setItemChecked( iii, checkitem ); | 2350 | selectFilterMenuTB->setItemChecked( iii, checkitem ); |
2308 | filter = fili.next(); | 2351 | filter = fili.next(); |
2309 | ++iii; | 2352 | ++iii; |
2310 | } | 2353 | } |
2311 | if ( !checkitem ) | 2354 | if ( !checkitem ) |
2312 | selectFilterMenuTB->setItemChecked( 1, true ); | 2355 | selectFilterMenuTB->setItemChecked( 1, true ); |
2313 | 2356 | ||
2314 | int x = 0; | 2357 | int x = 0; |
2315 | int y = iconToolBar->height(); | 2358 | int y = iconToolBar->height(); |
2316 | int dX = 0; | 2359 | int dX = 0; |
2317 | int dY = 0; | 2360 | int dY = 0; |
2318 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 2361 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
2319 | if ( iconToolBar->y() > height()/2 ) { | 2362 | if ( iconToolBar->y() > height()/2 ) { |
2320 | dY = selectFilterMenuTB->sizeHint().height()+8; | 2363 | dY = selectFilterMenuTB->sizeHint().height()+8; |
2321 | y = 0; | 2364 | y = 0; |
2322 | } | 2365 | } |
2323 | } else { | 2366 | } else { |
2324 | if ( iconToolBar->x() > width()/2 ) { // right side | 2367 | if ( iconToolBar->x() > width()/2 ) { // right side |
2325 | x=0; | 2368 | x=0; |
2326 | dX= selectFilterMenuTB->sizeHint().width()+8; | 2369 | dX= selectFilterMenuTB->sizeHint().width()+8; |
2327 | y = 0; | 2370 | y = 0; |
2328 | } else { | 2371 | } else { |
2329 | x= iconToolBar->width(); | 2372 | x= iconToolBar->width(); |
2330 | y = 0; | 2373 | y = 0; |
2331 | } | 2374 | } |
2332 | } | 2375 | } |
2333 | //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); | 2376 | //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); |
2334 | selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))); | 2377 | selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))); |
2335 | } | 2378 | } |
2336 | void MainWindow::fillFilterMenu() | 2379 | void MainWindow::fillFilterMenu() |
2337 | { | 2380 | { |
2338 | selectFilterMenu->clear(); | 2381 | selectFilterMenu->clear(); |
2339 | selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); | 2382 | selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); |
2340 | selectFilterMenu->insertSeparator(); | 2383 | selectFilterMenu->insertSeparator(); |
2341 | selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 ); | 2384 | selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 ); |
2342 | 2385 | ||
2343 | selectFilterMenu->insertSeparator(); | 2386 | selectFilterMenu->insertSeparator(); |
2344 | QPtrList<CalFilter> fili = mView->filters(); | 2387 | QPtrList<CalFilter> fili = mView->filters(); |
2345 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 2388 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
2346 | CalFilter *filter = fili.first(); | 2389 | CalFilter *filter = fili.first(); |
2347 | int iii = 2; | 2390 | int iii = 2; |
2348 | bool checkitem = mView->filterView()->filtersEnabled(); | 2391 | bool checkitem = mView->filterView()->filtersEnabled(); |
2349 | while(filter) { | 2392 | while(filter) { |
2350 | selectFilterMenu->insertItem( filter->name(), iii ); | 2393 | selectFilterMenu->insertItem( filter->name(), iii ); |
2351 | if ( filter == curfilter) | 2394 | if ( filter == curfilter) |
2352 | selectFilterMenu->setItemChecked( iii, checkitem ); | 2395 | selectFilterMenu->setItemChecked( iii, checkitem ); |
2353 | filter = fili.next(); | 2396 | filter = fili.next(); |
2354 | ++iii; | 2397 | ++iii; |
2355 | } | 2398 | } |
2356 | if ( !checkitem ) | 2399 | if ( !checkitem ) |
2357 | selectFilterMenu->setItemChecked( 1, true ); | 2400 | selectFilterMenu->setItemChecked( 1, true ); |
2358 | } | 2401 | } |
2359 | void MainWindow::fillFilterMenuPopup() | 2402 | void MainWindow::fillFilterMenuPopup() |
2360 | { | 2403 | { |
2361 | filterPopupMenu->clear(); | 2404 | filterPopupMenu->clear(); |
2362 | filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 ); | 2405 | filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 ); |
2363 | 2406 | ||
2364 | filterPopupMenu->insertSeparator(); | 2407 | filterPopupMenu->insertSeparator(); |
2365 | QPtrList<CalFilter> fili = mView->filters(); | 2408 | QPtrList<CalFilter> fili = mView->filters(); |
2366 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 2409 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
2367 | CalFilter *filter = fili.first(); | 2410 | CalFilter *filter = fili.first(); |
2368 | int iii = 1; | 2411 | int iii = 1; |
2369 | bool checkitem = mView->filterView()->filtersEnabled(); | 2412 | bool checkitem = mView->filterView()->filtersEnabled(); |
2370 | while(filter) { | 2413 | while(filter) { |
2371 | filterPopupMenu->insertItem( filter->name(), iii ); | 2414 | filterPopupMenu->insertItem( filter->name(), iii ); |
2372 | if ( filter == curfilter) | 2415 | if ( filter == curfilter) |
2373 | filterPopupMenu->setItemChecked( iii, checkitem ); | 2416 | filterPopupMenu->setItemChecked( iii, checkitem ); |
2374 | filter = fili.next(); | 2417 | filter = fili.next(); |
2375 | ++iii; | 2418 | ++iii; |
2376 | } | 2419 | } |
2377 | if ( !checkitem ) | 2420 | if ( !checkitem ) |
2378 | filterPopupMenu->setItemChecked( 0, true ); | 2421 | filterPopupMenu->setItemChecked( 0, true ); |
2379 | } | 2422 | } |
2380 | void MainWindow::selectFilter( int fil ) | 2423 | void MainWindow::selectFilter( int fil ) |
2381 | { | 2424 | { |
2382 | 2425 | ||
2383 | if ( fil == 0 ) { | 2426 | if ( fil == 0 ) { |
2384 | mView->editFilters( ); | 2427 | mView->editFilters( ); |
2385 | } else if ( fil == 1 ){ | 2428 | } else if ( fil == 1 ){ |
2386 | if ( mView->filterView()->filtersEnabled() ) | 2429 | if ( mView->filterView()->filtersEnabled() ) |
2387 | mView->toggleFilerEnabled( ); | 2430 | mView->toggleFilerEnabled( ); |
2388 | } else { | 2431 | } else { |
2389 | if ( !mView->filterView()->filtersEnabled() ) { | 2432 | if ( !mView->filterView()->filtersEnabled() ) { |
2390 | mView->filterView()->blockSignals( true ); | 2433 | mView->filterView()->blockSignals( true ); |
2391 | mView->toggleFilerEnabled( ); | 2434 | mView->toggleFilerEnabled( ); |
2392 | mView->filterView()->blockSignals( false ); | 2435 | mView->filterView()->blockSignals( false ); |
2393 | } | 2436 | } |
2394 | mView->selectFilter( fil-2 ); | 2437 | mView->selectFilter( fil-2 ); |
2395 | } | 2438 | } |
2396 | } | 2439 | } |
2397 | void MainWindow::updateFilterToolbar() | 2440 | void MainWindow::updateFilterToolbar() |
2398 | { | 2441 | { |
2399 | if ( filterMenubar ) { | 2442 | if ( filterMenubar ) { |
2400 | if ( !mView->filterView()->filtersEnabled() ) { | 2443 | if ( !mView->filterView()->filtersEnabled() ) { |
2401 | filterMenubar->changeItem( 0, i18n("No Filter") ); | 2444 | filterMenubar->changeItem( 0, i18n("No Filter") ); |
2402 | } else { | 2445 | } else { |
2403 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 2446 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
2404 | if ( curfilter ) { | 2447 | if ( curfilter ) { |
2405 | QString name = curfilter->name(); | 2448 | QString name = curfilter->name(); |
2406 | if ( name.length() > 12 ) | 2449 | if ( name.length() > 12 ) |
2407 | name = name.left(10)+"..."; | 2450 | name = name.left(10)+"..."; |
2408 | filterMenubar->changeItem( 0, name ); | 2451 | filterMenubar->changeItem( 0, name ); |
2409 | } | 2452 | } |
2410 | } | 2453 | } |
2411 | } | 2454 | } |
2412 | } | 2455 | } |
2413 | void MainWindow::selectFilterPopup( int fil ) | 2456 | void MainWindow::selectFilterPopup( int fil ) |
2414 | { | 2457 | { |
2415 | selectFilter( fil + 1 ); | 2458 | selectFilter( fil + 1 ); |
2416 | 2459 | ||
2417 | } | 2460 | } |
2418 | void MainWindow::configureToolBar( int item ) | 2461 | void MainWindow::configureToolBar( int item ) |
2419 | { | 2462 | { |
2420 | 2463 | ||
2421 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); | 2464 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); |
2422 | KOPrefs *p = KOPrefs::instance(); | 2465 | KOPrefs *p = KOPrefs::instance(); |
2423 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); | 2466 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); |
2424 | p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 ); | 2467 | p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 ); |
2425 | p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 ); | 2468 | p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 ); |
2426 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); | 2469 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); |
2427 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); | 2470 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); |
2428 | p->mShowIconNavigator = configureToolBarMenu->isItemChecked( 22 ); | 2471 | p->mShowIconNavigator = configureToolBarMenu->isItemChecked( 22 ); |
2429 | p->mShowIconAllday = configureToolBarMenu->isItemChecked( 24 ); | 2472 | p->mShowIconAllday = configureToolBarMenu->isItemChecked( 24 ); |
2430 | p->mShowIconFilterview = configureToolBarMenu->isItemChecked( 26 ); | 2473 | p->mShowIconFilterview = configureToolBarMenu->isItemChecked( 26 ); |
2431 | p->mShowIconToggleFull = configureToolBarMenu->isItemChecked( 28 ); | 2474 | p->mShowIconToggleFull = configureToolBarMenu->isItemChecked( 28 ); |
2432 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); | 2475 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); |
2433 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); | 2476 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); |
2434 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); | 2477 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); |
2435 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); | 2478 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); |
2436 | p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); | 2479 | p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); |
2437 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); | 2480 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); |
2438 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); | 2481 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); |
2439 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); | 2482 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); |
2440 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); | 2483 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); |
2441 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); | 2484 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); |
2442 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); | 2485 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); |
2443 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); | 2486 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); |
2444 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); | 2487 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); |
2445 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); | 2488 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); |
2446 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); | 2489 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); |
2447 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); | 2490 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); |
2448 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); | 2491 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); |
2449 | p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 ); | 2492 | p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 ); |
2450 | // initActions(); | 2493 | // initActions(); |
2451 | setCaption ( i18n("Toolbar changes needs a restart!") ); | 2494 | setCaption ( i18n("Toolbar changes needs a restart!") ); |
2452 | } | 2495 | } |
2453 | void MainWindow::setCaption ( const QString & c ) | 2496 | void MainWindow::setCaption ( const QString & c ) |
2454 | { | 2497 | { |
2455 | QString cap = c; | 2498 | QString cap = c; |
2456 | cap.replace( QRegExp("\n"), " " ); | 2499 | cap.replace( QRegExp("\n"), " " ); |
2457 | cap = cap.stripWhiteSpace(); | 2500 | cap = cap.stripWhiteSpace(); |
2458 | if ( cap.isEmpty() ) | 2501 | if ( cap.isEmpty() ) |
2459 | cap = "KO/Pi"; | 2502 | cap = "KO/Pi"; |
2460 | QWidget::setCaption( cap ); | 2503 | QWidget::setCaption( cap ); |
2461 | } | 2504 | } |
2462 | void MainWindow::setCaptionToDates() | 2505 | void MainWindow::setCaptionToDates() |
2463 | { | 2506 | { |
2464 | QString selDates; | 2507 | QString selDates; |
2465 | QDate date = mView->startDate(); | 2508 | QDate date = mView->startDate(); |
2466 | if ( ! date.isValid() ) { | 2509 | if ( ! date.isValid() ) { |
2467 | setCaption(""); | 2510 | setCaption(""); |
2468 | return; | 2511 | return; |
2469 | } | 2512 | } |
2470 | selDates = KGlobal::locale()->formatDate( date, true); | 2513 | selDates = KGlobal::locale()->formatDate( date, true); |
2471 | if (mView->startDate() < mView->endDate() ) | 2514 | if (mView->startDate() < mView->endDate() ) |
2472 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); | 2515 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); |
2473 | else { | 2516 | else { |
2474 | QString addString; | 2517 | QString addString; |
2475 | if ( date == QDateTime::currentDateTime().date() ) | 2518 | if ( date == QDateTime::currentDateTime().date() ) |
2476 | addString = i18n("Today"); | 2519 | addString = i18n("Today"); |
2477 | else if ( date == QDateTime::currentDateTime().date().addDays(1) ) | 2520 | else if ( date == QDateTime::currentDateTime().date().addDays(1) ) |
2478 | addString = i18n("Tomorrow"); | 2521 | addString = i18n("Tomorrow"); |
2479 | if ( !addString.isEmpty() ) | 2522 | if ( !addString.isEmpty() ) |
2480 | selDates = addString+", "+selDates ; | 2523 | selDates = addString+", "+selDates ; |
2481 | } | 2524 | } |
2482 | setCaption( i18n("Dates: ") + selDates ); | 2525 | setCaption( i18n("Dates: ") + selDates ); |
2483 | 2526 | ||
2484 | } | 2527 | } |
2485 | void MainWindow::showConfigureAgenda( ) | 2528 | void MainWindow::showConfigureAgenda( ) |
2486 | { | 2529 | { |
2487 | int iii; | 2530 | int iii; |
2488 | for ( iii = 1;iii<= 10 ;++iii ){ | 2531 | for ( iii = 1;iii<= 10 ;++iii ){ |
2489 | configureAgendaMenu->setItemChecked( (iii+1)*2, false ); | 2532 | configureAgendaMenu->setItemChecked( (iii+1)*2, false ); |
2490 | } | 2533 | } |
2491 | configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); | 2534 | configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); |
2492 | } | 2535 | } |
2493 | void MainWindow::configureAgenda( int item ) | 2536 | void MainWindow::configureAgenda( int item ) |
2494 | { | 2537 | { |
2495 | if ( KOPrefs::instance()->mHourSize == item ) | 2538 | if ( KOPrefs::instance()->mHourSize == item ) |
2496 | return; | 2539 | return; |
2497 | KOPrefs::instance()->mHourSize=item; | 2540 | KOPrefs::instance()->mHourSize=item; |
2498 | mView->viewManager()->agendaView()->updateConfig(); | 2541 | mView->viewManager()->agendaView()->updateConfig(); |
2499 | } | 2542 | } |
2500 | 2543 | ||
2501 | void MainWindow::saveCalendar() | 2544 | void MainWindow::saveCalendar() |
2502 | { | 2545 | { |
2503 | QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; | 2546 | QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; |
2504 | if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) | 2547 | if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) |
2505 | bupDir = KGlobalSettings::backupDataDir(); | 2548 | bupDir = KGlobalSettings::backupDataDir(); |
2506 | bupDir = KGlobal::formatMessage ( bupDir, 0 ); | 2549 | bupDir = KGlobal::formatMessage ( bupDir, 0 ); |
2507 | QString bupHint; | 2550 | QString bupHint; |
2508 | if ( !KPimGlobalPrefs::instance()->mBackupEnabled ) | 2551 | if ( !KPimGlobalPrefs::instance()->mBackupEnabled ) |
2509 | bupHint = i18n("(Hint: You can enable automatic backup in the global settings!)"); | 2552 | bupHint = i18n("(Hint: You can enable automatic backup in the global settings!)"); |
2510 | if ( KMessageBox::warningContinueCancel( this, i18n("This will <b>backup all calendar files</b> to the directory %1 %2").arg(bupDir).arg(bupHint),i18n("Information") ) != KMessageBox::Continue ) return; | 2553 | if ( KMessageBox::warningContinueCancel( this, i18n("This will <b>backup all calendar files</b> to the directory %1 %2").arg(bupDir).arg(bupHint),i18n("Information") ) != KMessageBox::Continue ) return; |
2511 | bool enabled = KPimGlobalPrefs::instance()->mBackupEnabled; | 2554 | bool enabled = KPimGlobalPrefs::instance()->mBackupEnabled; |
2512 | KPimGlobalPrefs::instance()->mBackupEnabled = false; | 2555 | KPimGlobalPrefs::instance()->mBackupEnabled = false; |
2513 | save(); | 2556 | save(); |
2514 | #ifndef DESKTOP_VERSION | 2557 | #ifndef DESKTOP_VERSION |
2515 | //QPEApplication::setTempScreenSaverMode ( QPEApplication::Disable ); | 2558 | //QPEApplication::setTempScreenSaverMode ( QPEApplication::Disable ); |
2516 | #endif | 2559 | #endif |
2517 | KPimGlobalPrefs::instance()->mBackupEnabled = enabled; | 2560 | KPimGlobalPrefs::instance()->mBackupEnabled = enabled; |
2518 | backupAllFiles(); | 2561 | backupAllFiles(); |
2519 | #ifndef DESKTOP_VERSION | 2562 | #ifndef DESKTOP_VERSION |
2520 | //QPEApplication::setTempScreenSaverMode ( QPEApplication::Enable ); | 2563 | //QPEApplication::setTempScreenSaverMode ( QPEApplication::Enable ); |
2521 | #endif | 2564 | #endif |
2522 | } | 2565 | } |
2523 | void MainWindow::loadCalendar() | 2566 | void MainWindow::loadCalendar() |
2524 | { | 2567 | { |
2525 | 2568 | ||
2526 | 2569 | ||
2527 | #if 0 | 2570 | #if 0 |
2528 | QString fn = KOPrefs::instance()->mLastLoadFile; | 2571 | QString fn = KOPrefs::instance()->mLastLoadFile; |
2529 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); | 2572 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); |
2530 | 2573 | ||
2531 | if ( fn == "" ) | 2574 | if ( fn == "" ) |
2532 | return; | 2575 | return; |
2533 | QFileInfo info; | 2576 | QFileInfo info; |
2534 | info.setFile( fn ); | 2577 | info.setFile( fn ); |
2535 | QString mess; | 2578 | QString mess; |
2536 | bool loadbup = true; | 2579 | bool loadbup = true; |
2537 | if ( info. exists() ) { | 2580 | if ( info. exists() ) { |
2538 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 2581 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
2539 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", | 2582 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", |
2540 | mess, | 2583 | mess, |
2541 | i18n("Load!"), i18n("Cancel"), 0, | 2584 | i18n("Load!"), i18n("Cancel"), 0, |
2542 | 0, 1 ); | 2585 | 0, 1 ); |
2543 | if ( result != 0 ) { | 2586 | if ( result != 0 ) { |
2544 | loadbup = false; | 2587 | loadbup = false; |
2545 | } | 2588 | } |
2546 | } else { | 2589 | } else { |
2547 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 2590 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
2548 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, | 2591 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, |
2549 | 0, 1 ); | 2592 | 0, 1 ); |
2550 | 2593 | ||
2551 | return; | 2594 | return; |
2552 | } | 2595 | } |
2553 | if ( loadbup ) { | 2596 | if ( loadbup ) { |
2554 | mView->openCalendar( fn ); | 2597 | mView->openCalendar( fn ); |
2555 | KOPrefs::instance()->mLastLoadFile = fn; | 2598 | KOPrefs::instance()->mLastLoadFile = fn; |
2556 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; | 2599 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; |
2557 | setCaption(mess); | 2600 | setCaption(mess); |
2558 | } | 2601 | } |
2559 | #endif | 2602 | #endif |
2560 | 2603 | ||
2561 | } | 2604 | } |
2562 | void MainWindow::quickImportIcal() | 2605 | void MainWindow::quickImportIcal() |
2563 | { | 2606 | { |
2564 | importFile( KOPrefs::instance()->mLastImportFile, false ); | 2607 | importFile( KOPrefs::instance()->mLastImportFile, false ); |
2565 | } | 2608 | } |
2566 | void MainWindow::importFile( QString fn, bool quick ) | 2609 | void MainWindow::importFile( QString fn, bool quick ) |
2567 | { | 2610 | { |
2568 | QFileInfo info; | 2611 | QFileInfo info; |
2569 | info.setFile( fn ); | 2612 | info.setFile( fn ); |
2570 | QString mess; | 2613 | QString mess; |
2571 | if ( !info. exists() ) { | 2614 | if ( !info. exists() ) { |
2572 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); | 2615 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); |
2573 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 2616 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
2574 | mess ); | 2617 | mess ); |
2575 | return; | 2618 | return; |
2576 | } | 2619 | } |
2577 | int result = 0; | 2620 | int result = 0; |
2578 | if ( !quick ) { | 2621 | if ( !quick ) { |
2579 | mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 2622 | mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
2580 | result = QMessageBox::warning( this, "KO/Pi: Warning!", | 2623 | result = QMessageBox::warning( this, "KO/Pi: Warning!", |
2581 | mess, | 2624 | mess, |
2582 | "Import", "Cancel", 0, | 2625 | "Import", "Cancel", 0, |
2583 | 0, 1 ); | 2626 | 0, 1 ); |
2584 | } | 2627 | } |
2585 | if ( result == 0 ) { | 2628 | if ( result == 0 ) { |
2586 | if ( mView->openCalendar( fn, true )) { | 2629 | if ( mView->openCalendar( fn, true )) { |
2587 | KOPrefs::instance()->mLastImportFile = fn; | 2630 | KOPrefs::instance()->mLastImportFile = fn; |
2588 | setCaption(i18n("Imported file successfully")); | 2631 | setCaption(i18n("Imported file successfully")); |
2589 | } else { | 2632 | } else { |
2590 | setCaption(i18n("Error importing file")); | 2633 | setCaption(i18n("Error importing file")); |
2591 | } | 2634 | } |
2592 | mView->updateView(); | 2635 | mView->updateView(); |
2593 | } | 2636 | } |
2594 | } | 2637 | } |
2595 | 2638 | ||
2596 | void MainWindow::importIcal() | 2639 | void MainWindow::importIcal() |
2597 | { | 2640 | { |
2598 | 2641 | ||
2599 | QString fn =KOPrefs::instance()->mLastImportFile; | 2642 | QString fn =KOPrefs::instance()->mLastImportFile; |
2600 | 2643 | ||
2601 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); | 2644 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); |
2602 | if ( fn == "" ) | 2645 | if ( fn == "" ) |
2603 | return; | 2646 | return; |
2604 | importFile( fn, true ); | 2647 | importFile( fn, true ); |
2605 | 2648 | ||
2606 | } | 2649 | } |
2607 | void MainWindow::exportCalendar( bool iCalFormat ) | 2650 | void MainWindow::exportCalendar( bool iCalFormat ) |
2608 | { | 2651 | { |
2609 | QString fn = KOPrefs::instance()->mLastVcalFile; | 2652 | QString fn = KOPrefs::instance()->mLastVcalFile; |
2610 | if ( iCalFormat ) { | 2653 | if ( iCalFormat ) { |
2611 | fn = QDir::homeDirPath()+"/kopiexport.ics"; | 2654 | fn = QDir::homeDirPath()+"/kopiexport.ics"; |
2612 | fn = KFileDialog::getSaveFileName( fn, i18n("Export iCal filename(*.ics)"), this ); | 2655 | fn = KFileDialog::getSaveFileName( fn, i18n("Export iCal filename(*.ics)"), this ); |
2613 | } | 2656 | } |
2614 | else | 2657 | else |
2615 | fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); | 2658 | fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); |
2616 | if ( fn == "" ) | 2659 | if ( fn == "" ) |
2617 | return; | 2660 | return; |
2618 | QFileInfo info; | 2661 | QFileInfo info; |
2619 | info.setFile( fn ); | 2662 | info.setFile( fn ); |
2620 | QString mes; | 2663 | QString mes; |
2621 | bool createbup = true; | 2664 | bool createbup = true; |
2622 | if ( info. exists() ) { | 2665 | if ( info. exists() ) { |
2623 | mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); | 2666 | mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); |
2624 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 2667 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
2625 | i18n("Overwrite!"), i18n("Cancel"), 0, | 2668 | i18n("Overwrite!"), i18n("Cancel"), 0, |
2626 | 0, 1 ); | 2669 | 0, 1 ); |
2627 | if ( result != 0 ) { | 2670 | if ( result != 0 ) { |
2628 | createbup = false; | 2671 | createbup = false; |
2629 | } | 2672 | } |
2630 | } | 2673 | } |
2631 | if ( createbup ) { | 2674 | if ( createbup ) { |
2632 | bool success = false; | 2675 | bool success = false; |
2633 | if ( iCalFormat ) | 2676 | if ( iCalFormat ) |
2634 | success = mView->exportICalendar( fn ); | 2677 | success = mView->exportICalendar( fn ); |
2635 | else | 2678 | else |
2636 | success = mView->exportVCalendar( fn ); | 2679 | success = mView->exportVCalendar( fn ); |
2637 | if ( success ) { | 2680 | if ( success ) { |
2638 | if ( fn.length() > 20 ) | 2681 | if ( fn.length() > 20 ) |
2639 | mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; | 2682 | mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; |
2640 | else | 2683 | else |
2641 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); | 2684 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); |
2642 | setCaption(mes); | 2685 | setCaption(mes); |
2643 | } | 2686 | } |
2644 | } | 2687 | } |
2645 | 2688 | ||
2646 | } | 2689 | } |
2647 | void MainWindow::exportICalendar() | 2690 | void MainWindow::exportICalendar() |
2648 | { | 2691 | { |
2649 | exportCalendar( true ); | 2692 | exportCalendar( true ); |
2650 | } | 2693 | } |
2651 | void MainWindow::exportVCalendar() | 2694 | void MainWindow::exportVCalendar() |
2652 | { | 2695 | { |
2653 | exportCalendar( false ); | 2696 | exportCalendar( false ); |
2654 | } | 2697 | } |
2655 | QString MainWindow::sentSyncFile() | 2698 | QString MainWindow::sentSyncFile() |
2656 | { | 2699 | { |
2657 | #ifdef DESKTOP_VERSION | 2700 | #ifdef DESKTOP_VERSION |
2658 | return QDir::convertSeparators( locateLocal( "tmp", "copysynccal.ics" ) ); | 2701 | return QDir::convertSeparators( locateLocal( "tmp", "copysynccal.ics" ) ); |
2659 | #else | 2702 | #else |
2660 | return QString( "/tmp/copysynccal.ics" ); | 2703 | return QString( "/tmp/copysynccal.ics" ); |
2661 | #endif | 2704 | #endif |
2662 | } | 2705 | } |
2663 | 2706 | ||
2664 | void MainWindow::syncFileRequest() | 2707 | void MainWindow::syncFileRequest() |
2665 | { | 2708 | { |
2666 | while ( mSyncManager->blockSave() ) { | 2709 | while ( mSyncManager->blockSave() ) { |
2667 | qApp->processEvents(); | 2710 | qApp->processEvents(); |
2668 | } | 2711 | } |
2669 | mSyncManager->setBlockSave(true); | 2712 | mSyncManager->setBlockSave(true); |
2670 | 2713 | ||
2671 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { | 2714 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { |
2672 | mSyncManager->slotSyncMenu( 999 ); | 2715 | mSyncManager->slotSyncMenu( 999 ); |
2673 | } | 2716 | } |
2674 | 2717 | ||
2675 | setCaption(i18n("Saving Data to temp file ..." )); | 2718 | setCaption(i18n("Saving Data to temp file ..." )); |
2676 | mView->saveCalendar( sentSyncFile() ); | 2719 | mView->saveCalendar( sentSyncFile() ); |
2677 | setCaption(i18n("Data saved to temp file!" )); | 2720 | setCaption(i18n("Data saved to temp file!" )); |
2678 | mSyncManager->setBlockSave( false ); | 2721 | mSyncManager->setBlockSave( false ); |
2679 | 2722 | ||
2680 | } | 2723 | } |
2681 | void MainWindow::getFile( bool success ) | 2724 | void MainWindow::getFile( bool success ) |
2682 | { | 2725 | { |
2683 | if ( ! success ) { | 2726 | if ( ! success ) { |
2684 | setCaption( i18n("Error receiving file. Nothing changed!") ); | 2727 | setCaption( i18n("Error receiving file. Nothing changed!") ); |
2685 | return; | 2728 | return; |
2686 | } | 2729 | } |
2687 | mView->mergeFile( sentSyncFile() ); | 2730 | mView->mergeFile( sentSyncFile() ); |
2688 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { | 2731 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { |
2689 | mSyncManager->slotSyncMenu( 999 ); | 2732 | mSyncManager->slotSyncMenu( 999 ); |
2690 | } | 2733 | } |
2691 | setCaption( i18n("Pi-Sync successful!") ); | 2734 | setCaption( i18n("Pi-Sync successful!") ); |
2692 | } | 2735 | } |
2693 | void MainWindow::printListView() | 2736 | void MainWindow::printListView() |
2694 | { | 2737 | { |
2695 | 2738 | ||
2696 | QString message = i18n("You can make a printout of the <b>List View</b> and the list view in the <b>Search Dialog</b>! To do this, please go to the <b>List View/Search Dialog</b>. Right click on the list. Select in the popup menu the entry <b>Print complete list</b>. That prints the list as you see it. You can remove items from the list before printing without deleting the corresponding event/todo! Simply select all items you do not want to print out. Then right click on one of the items and choose <b>Hide selected items</b>. After that you can print the list without these items."); | 2739 | QString message = i18n("You can make a printout of the <b>List View</b> and the list view in the <b>Search Dialog</b>! To do this, please go to the <b>List View/Search Dialog</b>. Right click on the list. Select in the popup menu the entry <b>Print complete list</b>. That prints the list as you see it. You can remove items from the list before printing without deleting the corresponding event/todo! Simply select all items you do not want to print out. Then right click on one of the items and choose <b>Hide selected items</b>. After that you can print the list without these items."); |
2697 | 2740 | ||
2698 | KMessageBox::information( this, message); | 2741 | KMessageBox::information( this, message); |
2699 | } | 2742 | } |
2700 | void MainWindow::printSel( ) | 2743 | void MainWindow::printSel( ) |
2701 | { | 2744 | { |
2702 | mView->viewManager()->agendaView()->agenda()->printSelection(); | 2745 | mView->viewManager()->agendaView()->agenda()->printSelection(); |
2703 | } | 2746 | } |
2704 | 2747 | ||
2705 | void MainWindow::printCal() | 2748 | void MainWindow::printCal() |
2706 | { | 2749 | { |
2707 | mView->print();//mCp->showDialog(); | 2750 | mView->print();//mCp->showDialog(); |
2708 | } | 2751 | } |
2709 | 2752 | ||
2710 | 2753 | ||
2711 | #include "libkdepim/kdatepicker.h" | 2754 | #include "libkdepim/kdatepicker.h" |
2712 | #include <kdatetbl.h> | 2755 | #include <kdatetbl.h> |
2713 | 2756 | ||
2714 | void MainWindow::weekAction() | 2757 | void MainWindow::weekAction() |
2715 | { | 2758 | { |
2716 | int month; | 2759 | int month; |
2717 | KPopupFrame* popup = new KPopupFrame(this); | 2760 | KPopupFrame* popup = new KPopupFrame(this); |
2718 | KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); | 2761 | KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); |
2719 | // ----- | 2762 | // ----- |
2720 | picker->resize(picker->sizeHint()); | 2763 | picker->resize(picker->sizeHint()); |
2721 | popup->setMainWidget(picker); | 2764 | popup->setMainWidget(picker); |
2722 | picker->setFocus(); | 2765 | picker->setFocus(); |
2723 | connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); | 2766 | connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); |
2724 | int x = 0; | 2767 | int x = 0; |
2725 | int y = iconToolBar->height(); | 2768 | int y = iconToolBar->height(); |
2726 | int dX = 0; | 2769 | int dX = 0; |
2727 | int dY = 0; | 2770 | int dY = 0; |
2728 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 2771 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
2729 | if ( iconToolBar->y() > height()/2 ) { | 2772 | if ( iconToolBar->y() > height()/2 ) { |
2730 | dY = picker->sizeHint().height()+8; | 2773 | dY = picker->sizeHint().height()+8; |
2731 | y = 0; | 2774 | y = 0; |
2732 | } | 2775 | } |
2733 | } else { | 2776 | } else { |
2734 | if ( iconToolBar->x() > width()/2 ) { // right side | 2777 | if ( iconToolBar->x() > width()/2 ) { // right side |
2735 | x=0; | 2778 | x=0; |
2736 | dX= picker->sizeHint().width()+8; | 2779 | dX= picker->sizeHint().width()+8; |
2737 | y = 0; | 2780 | y = 0; |
2738 | } else { | 2781 | } else { |
2739 | x= iconToolBar->width(); | 2782 | x= iconToolBar->width(); |
2740 | y = 0; | 2783 | y = 0; |
2741 | } | 2784 | } |
2742 | } | 2785 | } |
2743 | //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); | 2786 | //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); |
2744 | if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) | 2787 | if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) |
2745 | { | 2788 | { |
2746 | month = picker->getResult(); | 2789 | month = picker->getResult(); |
2747 | emit selectWeek ( month ); | 2790 | emit selectWeek ( month ); |
2748 | //qDebug("weekSelected %d ", month); | 2791 | //qDebug("weekSelected %d ", month); |
2749 | } | 2792 | } |
2750 | delete popup; | 2793 | delete popup; |
2751 | } | 2794 | } |
2752 | 2795 | ||
2753 | void MainWindow::hideEvent ( QHideEvent * ) | 2796 | void MainWindow::hideEvent ( QHideEvent * ) |
2754 | { | 2797 | { |
2755 | QString message; | 2798 | QString message; |
2756 | QDateTime nextA = mCalendar->nextAlarmEventDateTime(); | 2799 | QDateTime nextA = mCalendar->nextAlarmEventDateTime(); |
2757 | if ( nextA.isValid() ) { | 2800 | if ( nextA.isValid() ) { |
2758 | QString sum = mCalendar->nextSummary(); | 2801 | QString sum = mCalendar->nextSummary(); |
2759 | 2802 | ||
2760 | message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false)); | 2803 | message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false)); |
2761 | setCaption( message ); | 2804 | setCaption( message ); |
2762 | } | 2805 | } |
2763 | } | 2806 | } |
2764 | 2807 | ||
2765 | void MainWindow::resizeEvent( QResizeEvent* e) | 2808 | void MainWindow::resizeEvent( QResizeEvent* e) |
2766 | { | 2809 | { |
2767 | #ifndef DESKTOP_VERSION | 2810 | #ifndef DESKTOP_VERSION |
2768 | if ( filterToolBar ) { | 2811 | if ( filterToolBar ) { |
2769 | if ( !KOPrefs::instance()->mShowIconFilter && !KOPrefs::instance()->mShowIconOnetoolbar && QApplication::desktop()->width() > 320) { | 2812 | if ( !KOPrefs::instance()->mShowIconFilter && !KOPrefs::instance()->mShowIconOnetoolbar && QApplication::desktop()->width() > 320) { |
2770 | if (QApplication::desktop()->width() > QApplication::desktop()->height() ) | 2813 | if (QApplication::desktop()->width() > QApplication::desktop()->height() ) |
2771 | filterToolBar->hide(); | 2814 | filterToolBar->hide(); |
2772 | else | 2815 | else |
2773 | filterToolBar->show(); | 2816 | filterToolBar->show(); |
2774 | } | 2817 | } |
2775 | } | 2818 | } |
2776 | #endif | 2819 | #endif |
2777 | QMainWindow::resizeEvent( e); | 2820 | QMainWindow::resizeEvent( e); |
2778 | } | 2821 | } |
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h index 71c069b..d8018b6 100644 --- a/korganizer/mainwindow.h +++ b/korganizer/mainwindow.h | |||
@@ -1,189 +1,191 @@ | |||
1 | #ifndef KORGE_MAINWINDOW_H | 1 | #ifndef KORGE_MAINWINDOW_H |
2 | #define KORGE_MAINWINDOW_H | 2 | #define KORGE_MAINWINDOW_H |
3 | 3 | ||
4 | #include <qmainwindow.h> | 4 | #include <qmainwindow.h> |
5 | #include <qtimer.h> | 5 | #include <qtimer.h> |
6 | #include <qdict.h> | 6 | #include <qdict.h> |
7 | #include <qfile.h> | 7 | #include <qfile.h> |
8 | #include <qmenubar.h> | 8 | #include <qmenubar.h> |
9 | #include <qtextstream.h> | 9 | #include <qtextstream.h> |
10 | #include <qregexp.h> | 10 | #include <qregexp.h> |
11 | 11 | ||
12 | #include <libkcal/incidence.h> | 12 | #include <libkcal/incidence.h> |
13 | #include <ksyncmanager.h> | 13 | #include <ksyncmanager.h> |
14 | #include <kpopupmenu.h> | 14 | #include <kpopupmenu.h> |
15 | #ifndef DESKTOP_VERSION | 15 | #ifndef DESKTOP_VERSION |
16 | #include <qcopchannel_qws.h> | 16 | #include <qcopchannel_qws.h> |
17 | #endif | 17 | #endif |
18 | class QAction; | 18 | class QAction; |
19 | class CalendarView; | 19 | class CalendarView; |
20 | class KSyncProfile; | 20 | class KSyncProfile; |
21 | #ifdef DESKTOP_VERSION | 21 | #ifdef DESKTOP_VERSION |
22 | 22 | ||
23 | #define QPEToolBar QToolBar | 23 | #define QPEToolBar QToolBar |
24 | #endif | 24 | #endif |
25 | class QPEToolBar; | 25 | class QPEToolBar; |
26 | 26 | ||
27 | 27 | ||
28 | namespace KCal { | 28 | namespace KCal { |
29 | class CalendarLocal; | 29 | class CalendarLocal; |
30 | } | 30 | } |
31 | 31 | ||
32 | using namespace KCal; | 32 | using namespace KCal; |
33 | 33 | ||
34 | class MainWindow : public QMainWindow | 34 | class MainWindow : public QMainWindow |
35 | { | 35 | { |
36 | Q_OBJECT | 36 | Q_OBJECT |
37 | public: | 37 | public: |
38 | MainWindow( QWidget *parent = 0, const char *name = 0 ); | 38 | MainWindow( QWidget *parent = 0, const char *name = 0 ); |
39 | ~MainWindow(); | 39 | ~MainWindow(); |
40 | bool beamReceiveEnabled(); | 40 | bool beamReceiveEnabled(); |
41 | static QString defaultFileName(); | 41 | static QString defaultFileName(); |
42 | static QString syncFileName(); | 42 | static QString syncFileName(); |
43 | static QString resourcePath(); | 43 | static QString resourcePath(); |
44 | public slots: | 44 | public slots: |
45 | void setUsesBigPixmaps ( bool ); | 45 | void setUsesBigPixmaps ( bool ); |
46 | void setCaption ( const QString & ); | 46 | void setCaption ( const QString & ); |
47 | void updateWeekNum(const KCal::DateList &); | 47 | void updateWeekNum(const KCal::DateList &); |
48 | void updateWeek(QDate); | 48 | void updateWeek(QDate); |
49 | void updateFilterToolbar(); | 49 | void updateFilterToolbar(); |
50 | virtual void showMaximized (); | 50 | virtual void showMaximized (); |
51 | void configureAgenda( int ); | 51 | void configureAgenda( int ); |
52 | void recieve( const QCString& msg, const QByteArray& data ); | 52 | void recieve( const QCString& msg, const QByteArray& data ); |
53 | void receiveStart( const QCString& msg, const QByteArray& data ); | 53 | void receiveStart( const QCString& msg, const QByteArray& data ); |
54 | protected slots: | 54 | protected slots: |
55 | void autoSaveWarning(); | ||
55 | void loadDataAfterStart(); | 56 | void loadDataAfterStart(); |
56 | void calHint(); | 57 | void calHint(); |
57 | void startMultiSync(); | 58 | void startMultiSync(); |
58 | void setCaptionToDates(); | 59 | void setCaptionToDates(); |
59 | void weekAction(); | 60 | void weekAction(); |
60 | void about(); | 61 | void about(); |
61 | void licence(); | 62 | void licence(); |
62 | void faq(); | 63 | void faq(); |
63 | void usertrans(); | 64 | void usertrans(); |
64 | void features(); | 65 | void features(); |
65 | void synchowto(); | 66 | void synchowto(); |
66 | void storagehowto(); | 67 | void storagehowto(); |
67 | void timetrackinghowto(); | 68 | void timetrackinghowto(); |
68 | void kdesynchowto(); | 69 | void kdesynchowto(); |
69 | void multisynchowto(); | 70 | void multisynchowto(); |
70 | void whatsNew(); | 71 | void whatsNew(); |
71 | void keyBindings(); | 72 | void keyBindings(); |
72 | void aboutAutoSaving();; | 73 | void aboutAutoSaving();; |
73 | void aboutKnownBugs(); | 74 | void aboutKnownBugs(); |
74 | 75 | ||
75 | void processIncidenceSelection( Incidence * ); | 76 | void processIncidenceSelection( Incidence * ); |
76 | 77 | ||
77 | void importQtopia(); | 78 | void importQtopia(); |
78 | void importBday(); | 79 | void importBday(); |
79 | void importOL(); | 80 | void importOL(); |
80 | void importIcal(); | 81 | void importIcal(); |
81 | void importFile( QString, bool ); | 82 | void importFile( QString, bool ); |
82 | void quickImportIcal(); | 83 | void quickImportIcal(); |
83 | 84 | ||
84 | void slotModifiedChanged( bool ); | 85 | void slotModifiedChanged( bool ); |
85 | 86 | ||
86 | void save(); | 87 | void save(); |
87 | void backupAllFiles(); | 88 | void backupAllFiles(); |
88 | void saveStopTimer(); | 89 | void saveStopTimer(); |
89 | void configureToolBar( int ); | 90 | void configureToolBar( int ); |
90 | void printSel(); | 91 | void printSel(); |
91 | void printCal(); | 92 | void printCal(); |
92 | void printListView(); | 93 | void printListView(); |
93 | void saveCalendar(); | 94 | void saveCalendar(); |
94 | void loadCalendar(); | 95 | void loadCalendar(); |
95 | void exportVCalendar(); | 96 | void exportVCalendar(); |
96 | void exportICalendar(); | 97 | void exportICalendar(); |
97 | void exportCalendar( bool ); | 98 | void exportCalendar( bool ); |
98 | void fillFilterMenu(); | 99 | void fillFilterMenu(); |
99 | void fillFilterMenuTB(); | 100 | void fillFilterMenuTB(); |
100 | void selectFilter( int ); | 101 | void selectFilter( int ); |
101 | void fillFilterMenuPopup(); | 102 | void fillFilterMenuPopup(); |
102 | void selectFilterPopup( int ); | 103 | void selectFilterPopup( int ); |
103 | void exportToPhone( int ); | 104 | void exportToPhone( int ); |
104 | void toggleBeamReceive(); | 105 | void toggleBeamReceive(); |
105 | void disableBR(bool); | 106 | void disableBR(bool); |
106 | signals: | 107 | signals: |
107 | void selectWeek ( int ); | 108 | void selectWeek ( int ); |
108 | private slots: | 109 | private slots: |
109 | void slotResetFocus(); | 110 | void slotResetFocus(); |
110 | void slotResetFocusLoop(); | 111 | void slotResetFocusLoop(); |
111 | void showConfigureAgenda(); | 112 | void showConfigureAgenda(); |
112 | void getFile( bool ); | 113 | void getFile( bool ); |
113 | void syncFileRequest(); | 114 | void syncFileRequest(); |
114 | 115 | ||
115 | protected: | 116 | protected: |
116 | int mFocusLoop; | 117 | int mFocusLoop; |
117 | void hideEvent ( QHideEvent * ); | 118 | void hideEvent ( QHideEvent * ); |
118 | QString sentSyncFile(); | 119 | QString sentSyncFile(); |
119 | void displayText( QString, QString); | 120 | void displayText( QString, QString); |
120 | void enableIncidenceActions( bool ); | 121 | void enableIncidenceActions( bool ); |
121 | bool askForQuitOnSaveError(); | 122 | bool askForQuitOnSaveError(); |
122 | 123 | ||
123 | private: | 124 | private: |
124 | 125 | bool mAutoSaveDisabled; | |
126 | bool checkAutosave(); | ||
125 | QCString mCStringMess; | 127 | QCString mCStringMess; |
126 | QByteArray mByteData; | 128 | QByteArray mByteData; |
127 | 129 | ||
128 | //void setMenuBar( QMenuBar * ); | 130 | //void setMenuBar( QMenuBar * ); |
129 | bool mBRdisabled; | 131 | bool mBRdisabled; |
130 | #ifndef DESKTOP_VERSION | 132 | #ifndef DESKTOP_VERSION |
131 | QCopChannel* infrared; | 133 | QCopChannel* infrared; |
132 | #endif | 134 | #endif |
133 | QAction* brAction; | 135 | QAction* brAction; |
134 | KSyncManager* mSyncManager; | 136 | KSyncManager* mSyncManager; |
135 | bool mClosed; | 137 | bool mClosed; |
136 | void saveOnClose(); | 138 | void saveOnClose(); |
137 | bool mFlagKeyPressed; | 139 | bool mFlagKeyPressed; |
138 | bool mBlockAtStartup; | 140 | bool mBlockAtStartup; |
139 | KMenuBar *menuBar1; | 141 | KMenuBar *menuBar1; |
140 | QPEToolBar *iconToolBar; | 142 | QPEToolBar *iconToolBar; |
141 | QPEToolBar *viewToolBar; | 143 | QPEToolBar *viewToolBar; |
142 | QPEToolBar *navigatorToolBar; | 144 | QPEToolBar *navigatorToolBar; |
143 | QPEToolBar *filterToolBar; | 145 | QPEToolBar *filterToolBar; |
144 | KMenuBar *filterMenubar; | 146 | KMenuBar *filterMenubar; |
145 | QPopupMenu * filterPopupMenu; | 147 | QPopupMenu * filterPopupMenu; |
146 | QPopupMenu * mCurrentItemMenu; | 148 | QPopupMenu * mCurrentItemMenu; |
147 | void initActions(); | 149 | void initActions(); |
148 | void setDefaultPreferences(); | 150 | void setDefaultPreferences(); |
149 | void resizeEvent( QResizeEvent* e); | 151 | void resizeEvent( QResizeEvent* e); |
150 | void keyPressEvent ( QKeyEvent * ) ; | 152 | void keyPressEvent ( QKeyEvent * ) ; |
151 | void keyReleaseEvent ( QKeyEvent * ) ; | 153 | void keyReleaseEvent ( QKeyEvent * ) ; |
152 | QPopupMenu *configureToolBarMenu; | 154 | QPopupMenu *configureToolBarMenu; |
153 | QPopupMenu *selectFilterMenu; | 155 | QPopupMenu *selectFilterMenu; |
154 | QPopupMenu *selectFilterMenuTB; | 156 | QPopupMenu *selectFilterMenuTB; |
155 | QPopupMenu *configureAgendaMenu, *syncMenu; | 157 | QPopupMenu *configureAgendaMenu, *syncMenu; |
156 | CalendarLocal *mCalendar; | 158 | CalendarLocal *mCalendar; |
157 | CalendarView *mView; | 159 | CalendarView *mView; |
158 | QAction *mNewSubTodoAction; | 160 | QAction *mNewSubTodoAction; |
159 | QAction *mWeekAction; | 161 | QAction *mWeekAction; |
160 | QFont mWeekFont; | 162 | QFont mWeekFont; |
161 | QPixmap mWeekPixmap; | 163 | QPixmap mWeekPixmap; |
162 | QColor mWeekBgColor; | 164 | QColor mWeekBgColor; |
163 | 165 | ||
164 | QAction *mShowAction; | 166 | QAction *mShowAction; |
165 | QAction *mEditAction; | 167 | QAction *mEditAction; |
166 | QAction *mDeleteAction; | 168 | QAction *mDeleteAction; |
167 | QAction *mCloneAction; | 169 | QAction *mCloneAction; |
168 | QAction *mMoveAction; | 170 | QAction *mMoveAction; |
169 | QAction *mBeamAction; | 171 | QAction *mBeamAction; |
170 | QAction *mCancelAction; | 172 | QAction *mCancelAction; |
171 | QAction *mPrintSelAction; | 173 | QAction *mPrintSelAction; |
172 | 174 | ||
173 | QAction *mToggleNav; | 175 | QAction *mToggleNav; |
174 | QAction *mToggleFilter; | 176 | QAction *mToggleFilter; |
175 | QAction *mToggleAllday; | 177 | QAction *mToggleAllday; |
176 | QAction *actionFilterMenuTB; | 178 | QAction *actionFilterMenuTB; |
177 | 179 | ||
178 | void closeEvent( QCloseEvent* ce ); | 180 | void closeEvent( QCloseEvent* ce ); |
179 | QTimer mSaveTimer; | 181 | QTimer mSaveTimer; |
180 | QDateTime mSaveTimerStart; | 182 | QDateTime mSaveTimerStart; |
181 | int mSaveDelay; | 183 | int mSaveDelay; |
182 | //bool mBlockSaveFlag; | 184 | //bool mBlockSaveFlag; |
183 | bool mCalendarModifiedFlag; | 185 | bool mCalendarModifiedFlag; |
184 | QPixmap loadPixmap( QString ); | 186 | QPixmap loadPixmap( QString ); |
185 | QPixmap listviewPix, listviewPix0, listviewPix20, listviewPix40, listviewPix60, listviewPix80, journalPix; | 187 | QPixmap listviewPix, listviewPix0, listviewPix20, listviewPix40, listviewPix60, listviewPix80, journalPix; |
186 | }; | 188 | }; |
187 | 189 | ||
188 | 190 | ||
189 | #endif | 191 | #endif |