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