-rw-r--r-- | korganizer/mainwindow.cpp | 106 | ||||
-rw-r--r-- | korganizer/mainwindow.h | 15 |
2 files changed, 84 insertions, 37 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 348dd5e..119e28a 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -27,193 +27,193 @@ | |||
27 | #include <qpe/qpeapplication.h> | 27 | #include <qpe/qpeapplication.h> |
28 | #include <qtopia/alarmserver.h> | 28 | #include <qtopia/alarmserver.h> |
29 | #include <qtopia/qcopenvelope_qws.h> | 29 | #include <qtopia/qcopenvelope_qws.h> |
30 | #include <unistd.h> // for sleep | 30 | #include <unistd.h> // for sleep |
31 | #else | 31 | #else |
32 | #include <qmenubar.h> | 32 | #include <qmenubar.h> |
33 | #include <qtoolbar.h> | 33 | #include <qtoolbar.h> |
34 | #include <qapplication.h> | 34 | #include <qapplication.h> |
35 | //#include <resource.h> | 35 | //#include <resource.h> |
36 | 36 | ||
37 | #endif | 37 | #endif |
38 | #include <libkcal/calendarlocal.h> | 38 | #include <libkcal/calendarlocal.h> |
39 | #include <libkcal/todo.h> | 39 | #include <libkcal/todo.h> |
40 | #include <libkcal/phoneformat.h> | 40 | #include <libkcal/phoneformat.h> |
41 | #include <libkdepim/ksyncprofile.h> | 41 | #include <libkdepim/ksyncprofile.h> |
42 | #include <libkdepim/phoneaccess.h> | 42 | #include <libkdepim/phoneaccess.h> |
43 | #include <libkcal/kincidenceformatter.h> | 43 | #include <libkcal/kincidenceformatter.h> |
44 | #include <libkdepim/kpimglobalprefs.h> | 44 | #include <libkdepim/kpimglobalprefs.h> |
45 | 45 | ||
46 | #include "calendarview.h" | 46 | #include "calendarview.h" |
47 | #include "koviewmanager.h" | 47 | #include "koviewmanager.h" |
48 | #include "datenavigator.h" | 48 | #include "datenavigator.h" |
49 | #include "koagendaview.h" | 49 | #include "koagendaview.h" |
50 | #include "koagenda.h" | 50 | #include "koagenda.h" |
51 | #include "kodialogmanager.h" | 51 | #include "kodialogmanager.h" |
52 | #include "kdialogbase.h" | 52 | #include "kdialogbase.h" |
53 | #include "kapplication.h" | 53 | #include "kapplication.h" |
54 | #include "kofilterview.h" | 54 | #include "kofilterview.h" |
55 | #include "kstandarddirs.h" | 55 | #include "kstandarddirs.h" |
56 | #include "koprefs.h" | 56 | #include "koprefs.h" |
57 | #include "kfiledialog.h" | 57 | #include "kfiledialog.h" |
58 | #include "koglobals.h" | 58 | #include "koglobals.h" |
59 | #include "kglobal.h" | 59 | #include "kglobal.h" |
60 | #include "klocale.h" | 60 | #include "klocale.h" |
61 | #include "kconfig.h" | 61 | #include "kconfig.h" |
62 | #include "simplealarmclient.h" | 62 | #include "simplealarmclient.h" |
63 | #include "externalapphandler.h" | 63 | #include "externalapphandler.h" |
64 | 64 | ||
65 | using namespace KCal; | 65 | using namespace KCal; |
66 | #ifndef _WIN32_ | 66 | #ifndef _WIN32_ |
67 | #include <unistd.h> | 67 | #include <unistd.h> |
68 | #else | 68 | #else |
69 | #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 | class KOex2phonePrefs : public QDialog | 76 | class KOex2phonePrefs : public QDialog |
76 | { | 77 | { |
77 | public: | 78 | public: |
78 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : | 79 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : |
79 | QDialog( parent, name, true ) | 80 | QDialog( parent, name, true ) |
80 | { | 81 | { |
81 | setCaption( i18n("Export to phone options") ); | 82 | setCaption( i18n("Export to phone options") ); |
82 | QVBoxLayout* lay = new QVBoxLayout( this ); | 83 | QVBoxLayout* lay = new QVBoxLayout( this ); |
83 | lay->setSpacing( 3 ); | 84 | lay->setSpacing( 3 ); |
84 | lay->setMargin( 3 ); | 85 | lay->setMargin( 3 ); |
85 | QLabel *lab; | 86 | QLabel *lab; |
86 | 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 ) ); |
87 | lab->setAlignment (AlignHCenter ); | 88 | lab->setAlignment (AlignHCenter ); |
88 | QHBox* temphb; | 89 | QHBox* temphb; |
89 | temphb = new QHBox( this ); | 90 | temphb = new QHBox( this ); |
90 | new QLabel( i18n("I/O device: "), temphb ); | 91 | new QLabel( i18n("I/O device: "), temphb ); |
91 | mPhoneDevice = new QLineEdit( temphb); | 92 | mPhoneDevice = new QLineEdit( temphb); |
92 | lay->addWidget( temphb ); | 93 | lay->addWidget( temphb ); |
93 | temphb = new QHBox( this ); | 94 | temphb = new QHBox( this ); |
94 | new QLabel( i18n("Connection: "), temphb ); | 95 | new QLabel( i18n("Connection: "), temphb ); |
95 | mPhoneConnection = new QLineEdit( temphb); | 96 | mPhoneConnection = new QLineEdit( temphb); |
96 | lay->addWidget( temphb ); | 97 | lay->addWidget( temphb ); |
97 | temphb = new QHBox( this ); | 98 | temphb = new QHBox( this ); |
98 | new QLabel( i18n("Model(opt.): "), temphb ); | 99 | new QLabel( i18n("Model(opt.): "), temphb ); |
99 | mPhoneModel = new QLineEdit( temphb); | 100 | mPhoneModel = new QLineEdit( temphb); |
100 | lay->addWidget( temphb ); | 101 | lay->addWidget( temphb ); |
101 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); | 102 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); |
102 | mWriteBackFuture->setChecked( true ); | 103 | mWriteBackFuture->setChecked( true ); |
103 | lay->addWidget( mWriteBackFuture ); | 104 | lay->addWidget( mWriteBackFuture ); |
104 | temphb = new QHBox( this ); | 105 | temphb = new QHBox( this ); |
105 | new QLabel( i18n("Max. weeks in future: ") , temphb ); | 106 | new QLabel( i18n("Max. weeks in future: ") , temphb ); |
106 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); | 107 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); |
107 | mWriteBackFutureWeeks->setValue( 8 ); | 108 | mWriteBackFutureWeeks->setValue( 8 ); |
108 | lay->addWidget( temphb ); | 109 | lay->addWidget( temphb ); |
109 | 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 ) ); |
110 | lab->setAlignment (AlignHCenter ); | 111 | lab->setAlignment (AlignHCenter ); |
111 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); | 112 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); |
112 | lay->addWidget( ok ); | 113 | lay->addWidget( ok ); |
113 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 114 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
114 | lay->addWidget( cancel ); | 115 | lay->addWidget( cancel ); |
115 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 116 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
116 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 117 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
117 | resize( 220, 240 ); | 118 | resize( 220, 240 ); |
118 | qApp->processEvents(); | 119 | qApp->processEvents(); |
119 | int dw = QApplication::desktop()->width(); | 120 | int dw = QApplication::desktop()->width(); |
120 | int dh = QApplication::desktop()->height(); | 121 | int dh = QApplication::desktop()->height(); |
121 | move( (dw-width())/2, (dh - height() )/2 ); | 122 | move( (dw-width())/2, (dh - height() )/2 ); |
122 | } | 123 | } |
123 | 124 | ||
124 | public: | 125 | public: |
125 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; | 126 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; |
126 | QCheckBox* mWriteBackFuture; | 127 | QCheckBox* mWriteBackFuture; |
127 | QSpinBox* mWriteBackFutureWeeks; | 128 | QSpinBox* mWriteBackFutureWeeks; |
128 | }; | 129 | }; |
129 | 130 | ||
130 | int globalFlagBlockStartup; | 131 | int globalFlagBlockStartup; |
131 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | 132 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : |
132 | QMainWindow( parent, name ) | 133 | QMainWindow( parent, name ) |
133 | { | 134 | { |
134 | 135 | ||
135 | 136 | ||
136 | #ifdef DESKTOP_VERSION | 137 | #ifdef DESKTOP_VERSION |
137 | setFont( QFont("Arial"), 14 ); | 138 | setFont( QFont("Arial"), 14 ); |
138 | #endif | 139 | #endif |
139 | mClosed = false; | 140 | mClosed = false; |
140 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; | 141 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; |
141 | QString confFile = locateLocal("config","korganizerrc"); | 142 | QString confFile = locateLocal("config","korganizerrc"); |
142 | QFileInfo finf ( confFile ); | 143 | QFileInfo finf ( confFile ); |
143 | bool showWarning = !finf.exists(); | 144 | bool showWarning = !finf.exists(); |
144 | setIcon(SmallIcon( "ko24" ) ); | 145 | setIcon(SmallIcon( "ko24" ) ); |
145 | mBlockAtStartup = true; | 146 | mBlockAtStartup = true; |
146 | mFlagKeyPressed = false; | 147 | mFlagKeyPressed = false; |
148 | setCaption("KOrganizer/Pi"); | ||
147 | KOPrefs *p = KOPrefs::instance(); | 149 | KOPrefs *p = KOPrefs::instance(); |
148 | KPimGlobalPrefs::instance()->setGlobalConfig(); | 150 | KPimGlobalPrefs::instance()->setGlobalConfig(); |
149 | if ( p->mHourSize > 18 ) | 151 | if ( p->mHourSize > 22 ) |
150 | p->mHourSize = 18; | 152 | p->mHourSize = 22; |
151 | QMainWindow::ToolBarDock tbd; | 153 | QMainWindow::ToolBarDock tbd; |
152 | if ( p->mToolBarHor ) { | 154 | if ( p->mToolBarHor ) { |
153 | if ( p->mToolBarUp ) | 155 | if ( p->mToolBarUp ) |
154 | tbd = Bottom; | 156 | tbd = Bottom; |
155 | else | 157 | else |
156 | tbd = Top; | 158 | tbd = Top; |
157 | } | 159 | } |
158 | else { | 160 | else { |
159 | if ( p->mToolBarUp ) | 161 | if ( p->mToolBarUp ) |
160 | tbd = Right; | 162 | tbd = Right; |
161 | else | 163 | else |
162 | tbd = Left; | 164 | tbd = Left; |
163 | } | 165 | } |
164 | if ( KOPrefs::instance()->mUseAppColors ) | 166 | if ( KOPrefs::instance()->mUseAppColors ) |
165 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 167 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
166 | globalFlagBlockStartup = 1; | 168 | globalFlagBlockStartup = 1; |
167 | iconToolBar = new QPEToolBar( this ); | 169 | iconToolBar = new QPEToolBar( this ); |
168 | addToolBar (iconToolBar , tbd ); | 170 | addToolBar (iconToolBar , tbd ); |
169 | mCalendarModifiedFlag = false; | 171 | mCalendarModifiedFlag = false; |
170 | |||
171 | setCaption("KOrganizer/Pi"); | ||
172 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); | 172 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); |
173 | splash->setAlignment ( AlignCenter ); | 173 | splash->setAlignment ( AlignCenter ); |
174 | setCentralWidget( splash ); | 174 | setCentralWidget( splash ); |
175 | #ifndef DESKTOP_VERSION | 175 | #ifndef DESKTOP_VERSION |
176 | showMaximized(); | 176 | showMaximized(); |
177 | #endif | 177 | #endif |
178 | 178 | ||
179 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); | 179 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); |
180 | setDefaultPreferences(); | 180 | setDefaultPreferences(); |
181 | mCalendar = new CalendarLocal(); | 181 | mCalendar = new CalendarLocal(); |
182 | mView = new CalendarView( mCalendar, this,"mCalendar " ); | 182 | mView = new CalendarView( mCalendar, this,"mCalendar " ); |
183 | mView->hide(); | 183 | mView->hide(); |
184 | //mView->resize(splash->size() ); | 184 | //mView->resize(splash->size() ); |
185 | initActions(); | 185 | initActions(); |
186 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); | 186 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); |
187 | mSyncManager->setBlockSave(false); | 187 | mSyncManager->setBlockSave(false); |
188 | mView->setSyncManager(mSyncManager); | 188 | mView->setSyncManager(mSyncManager); |
189 | #ifndef DESKTOP_VERSION | 189 | #ifndef DESKTOP_VERSION |
190 | iconToolBar->show(); | 190 | iconToolBar->show(); |
191 | qApp->processEvents(); | 191 | qApp->processEvents(); |
192 | #endif | 192 | #endif |
193 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); | 193 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); |
194 | int vh = height() ; | 194 | int vh = height() ; |
195 | int vw = width(); | 195 | int vw = width(); |
196 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); | 196 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); |
197 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 197 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
198 | vh -= iconToolBar->height(); | 198 | vh -= iconToolBar->height(); |
199 | } else { | 199 | } else { |
200 | vw -= iconToolBar->height(); | 200 | vw -= iconToolBar->height(); |
201 | } | 201 | } |
202 | //mView->setMaximumSize( splash->size() ); | 202 | //mView->setMaximumSize( splash->size() ); |
203 | //mView->resize( splash->size() ); | 203 | //mView->resize( splash->size() ); |
204 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 204 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
205 | mView->readSettings(); | 205 | mView->readSettings(); |
206 | bool newFile = false; | 206 | bool newFile = false; |
207 | if( !QFile::exists( defaultFileName() ) ) { | 207 | if( !QFile::exists( defaultFileName() ) ) { |
208 | QFileInfo finfo ( defaultFileName() ); | 208 | QFileInfo finfo ( defaultFileName() ); |
209 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); | 209 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); |
210 | qDebug("oldfile %s ", oldFile.latin1()); | 210 | qDebug("oldfile %s ", oldFile.latin1()); |
211 | 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"; | 211 | 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"; |
212 | finfo.setFile( oldFile ); | 212 | finfo.setFile( oldFile ); |
213 | if (finfo.exists() ) { | 213 | if (finfo.exists() ) { |
214 | KMessageBox::information( this, message); | 214 | KMessageBox::information( this, message); |
215 | mView->openCalendar( oldFile ); | 215 | mView->openCalendar( oldFile ); |
216 | qApp->processEvents(); | 216 | qApp->processEvents(); |
217 | } else { | 217 | } else { |
218 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); | 218 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); |
219 | finfo.setFile( oldFile ); | 219 | finfo.setFile( oldFile ); |
@@ -512,133 +512,139 @@ void MainWindow::initActions() | |||
512 | //KOPrefs::instance()->mShowFullMenu | 512 | //KOPrefs::instance()->mShowFullMenu |
513 | iconToolBar->clear(); | 513 | iconToolBar->clear(); |
514 | KOPrefs *p = KOPrefs::instance(); | 514 | KOPrefs *p = KOPrefs::instance(); |
515 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); | 515 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); |
516 | 516 | ||
517 | QPopupMenu *viewMenu = new QPopupMenu( this ); | 517 | QPopupMenu *viewMenu = new QPopupMenu( this ); |
518 | QPopupMenu *actionMenu = new QPopupMenu( this ); | 518 | QPopupMenu *actionMenu = new QPopupMenu( this ); |
519 | QPopupMenu *importMenu = new QPopupMenu( this ); | 519 | QPopupMenu *importMenu = new QPopupMenu( this ); |
520 | selectFilterMenu = new QPopupMenu( this ); | 520 | selectFilterMenu = new QPopupMenu( this ); |
521 | selectFilterMenu->setCheckable( true ); | 521 | selectFilterMenu->setCheckable( true ); |
522 | syncMenu = new QPopupMenu( this ); | 522 | syncMenu = new QPopupMenu( this ); |
523 | configureAgendaMenu = new QPopupMenu( this ); | 523 | configureAgendaMenu = new QPopupMenu( this ); |
524 | configureToolBarMenu = new QPopupMenu( this ); | 524 | configureToolBarMenu = new QPopupMenu( this ); |
525 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 525 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
526 | if ( KOPrefs::instance()->mShowFullMenu ) { | 526 | if ( KOPrefs::instance()->mShowFullMenu ) { |
527 | QMenuBar *menuBar1; | 527 | QMenuBar *menuBar1; |
528 | menuBar1 = menuBar(); | 528 | menuBar1 = menuBar(); |
529 | menuBar1->insertItem( i18n("File"), importMenu ); | 529 | menuBar1->insertItem( i18n("File"), importMenu ); |
530 | menuBar1->insertItem( i18n("View"), viewMenu ); | 530 | menuBar1->insertItem( i18n("View"), viewMenu ); |
531 | menuBar1->insertItem( i18n("Actions"), actionMenu ); | 531 | menuBar1->insertItem( i18n("Actions"), actionMenu ); |
532 | #ifdef DESKTOP_VERSION | 532 | #ifdef DESKTOP_VERSION |
533 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); | 533 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); |
534 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 534 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
535 | #else | 535 | #else |
536 | menuBar1->insertItem( i18n("Sync"), syncMenu ); | 536 | menuBar1->insertItem( i18n("Sync"), syncMenu ); |
537 | menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); | 537 | menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); |
538 | #endif | 538 | #endif |
539 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 539 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
540 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); | 540 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); |
541 | menuBar1->insertItem( i18n("Help"), helpMenu ); | 541 | menuBar1->insertItem( i18n("Help"), helpMenu ); |
542 | } else { | 542 | } else { |
543 | QPEMenuBar *menuBar1; | 543 | QPEMenuBar *menuBar1; |
544 | menuBar1 = new QPEMenuBar( iconToolBar ); | 544 | menuBar1 = new QPEMenuBar( iconToolBar ); |
545 | QPopupMenu *menuBar = new QPopupMenu( this ); | 545 | QPopupMenu *menuBar = new QPopupMenu( this ); |
546 | menuBar1->insertItem( i18n("ME"), menuBar); | 546 | menuBar1->insertItem( i18n("ME"), menuBar); |
547 | menuBar->insertItem( i18n("File"), importMenu ); | 547 | menuBar->insertItem( i18n("File"), importMenu ); |
548 | menuBar->insertItem( i18n("View"), viewMenu ); | 548 | menuBar->insertItem( i18n("View"), viewMenu ); |
549 | menuBar->insertItem( i18n("Actions"), actionMenu ); | 549 | menuBar->insertItem( i18n("Actions"), actionMenu ); |
550 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); | 550 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); |
551 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 551 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
552 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 552 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
553 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); | 553 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); |
554 | menuBar->insertItem( i18n("Help"), helpMenu ); | 554 | menuBar->insertItem( i18n("Help"), helpMenu ); |
555 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); | 555 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); |
556 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); | 556 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); |
557 | } | 557 | } |
558 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); | 558 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); |
559 | connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); | 559 | connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); |
560 | 560 | QIconSet icon; | |
561 | menuBarWeek = new QPEMenuBar( iconToolBar ); | 561 | int pixWid = 22, pixHei = 22; |
562 | QPopupMenu * wpo = new QPopupMenu (this); | 562 | QString pathString = ""; |
563 | QPopupMenu * all = new QPopupMenu (this); | 563 | if ( !p->mToolBarMiniIcons ) { |
564 | //wpo->insertItem( i18n("W#"), 0 ); | 564 | if ( QApplication::desktop()->width() < 480 ) { |
565 | int first = 1; | 565 | pathString += "icons16/"; |
566 | int i; | 566 | pixWid = 18; pixHei = 16; |
567 | for ( i = 1; i < 50; ++i ) { | ||
568 | if ( !(i%10) ) { | ||
569 | all->insertItem( i18n("Select week %1-%2" ).arg(first).arg( i-1) ,wpo ); | ||
570 | connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeek ( int ) ) ); | ||
571 | first = i; | ||
572 | wpo = new QPopupMenu (this); | ||
573 | } | 567 | } |
574 | wpo->insertItem( QString::number(i), i ); | 568 | } else { |
575 | } | 569 | pathString += "iconsmini/"; |
576 | for ( i = 50; i < 53; ++i ) { | 570 | pixWid = 18; pixHei = 16; |
577 | wpo->insertItem( QString::number(i), i); | 571 | } |
572 | mWeekBgColor = iconToolBar->backgroundColor(); | ||
573 | mWeekPixmap.resize( pixWid , pixHei ); | ||
574 | mWeekPixmap.fill( mWeekBgColor ); | ||
575 | icon = mWeekPixmap; | ||
576 | mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); | ||
577 | mWeekAction->addTo( iconToolBar ); | ||
578 | mWeekFont = font(); | ||
579 | |||
580 | int fontPoint = mWeekFont.pointSize(); | ||
581 | QFontMetrics f( mWeekFont ); | ||
582 | int fontWid = f.width( "30" ); | ||
583 | while ( fontWid > pixWid ) { | ||
584 | --fontPoint; | ||
585 | mWeekFont.setPointSize( fontPoint ); | ||
586 | QFontMetrics f( mWeekFont ); | ||
587 | fontWid = f.width( "30" ); | ||
588 | qDebug("dec-- "); | ||
578 | } | 589 | } |
579 | all->insertItem( i18n("Select week %1-%2" ).arg(first).arg( i-1) ,wpo ); | 590 | |
580 | connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeek ( int ) ) ); | 591 | connect( mWeekAction, SIGNAL( activated() ), |
581 | menuBarWeek->insertItem( "00",all,1); | 592 | this, SLOT( weekAction() ) ); |
582 | menuBarWeek->setMaximumSize( menuBarWeek->sizeHint( )); | ||
583 | 593 | ||
584 | connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); | 594 | connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); |
595 | |||
596 | //#endif | ||
585 | // ****************** | 597 | // ****************** |
586 | QAction *action; | 598 | QAction *action; |
587 | QIconSet icon; | ||
588 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); | 599 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); |
589 | configureToolBarMenu->setCheckable( true ); | 600 | configureToolBarMenu->setCheckable( true ); |
590 | 601 | ||
591 | QString pathString = ""; | 602 | |
592 | if ( !p->mToolBarMiniIcons ) { | ||
593 | if ( QApplication::desktop()->width() < 480 ) | ||
594 | pathString += "icons16/"; | ||
595 | } else | ||
596 | pathString += "iconsmini/"; | ||
597 | configureAgendaMenu->setCheckable( true ); | 603 | configureAgendaMenu->setCheckable( true ); |
598 | int iii ; | 604 | int iii ; |
599 | for ( iii = 1;iii<= 10 ;++iii ){ | 605 | for ( iii = 1;iii<= 10 ;++iii ){ |
600 | configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); | 606 | configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); |
601 | } | 607 | } |
602 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); | 608 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); |
603 | 609 | ||
604 | connect( configureAgendaMenu, SIGNAL( aboutToShow()), | 610 | connect( configureAgendaMenu, SIGNAL( aboutToShow()), |
605 | this, SLOT( showConfigureAgenda( ) ) ); | 611 | this, SLOT( showConfigureAgenda( ) ) ); |
606 | 612 | ||
607 | icon = loadPixmap( pathString + "configure" ); | 613 | icon = loadPixmap( pathString + "configure" ); |
608 | action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); | 614 | action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); |
609 | action->addTo( actionMenu ); | 615 | action->addTo( actionMenu ); |
610 | connect( action, SIGNAL( activated() ), | 616 | connect( action, SIGNAL( activated() ), |
611 | mView, SLOT( edit_options() ) ); | 617 | mView, SLOT( edit_options() ) ); |
612 | actionMenu->insertSeparator(); | 618 | actionMenu->insertSeparator(); |
613 | 619 | ||
614 | action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); | 620 | action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); |
615 | action->addTo( actionMenu ); | 621 | action->addTo( actionMenu ); |
616 | connect( action, SIGNAL( activated() ), | 622 | connect( action, SIGNAL( activated() ), |
617 | mView, SLOT( undo_delete() ) ); | 623 | mView, SLOT( undo_delete() ) ); |
618 | actionMenu->insertSeparator(); | 624 | actionMenu->insertSeparator(); |
619 | 625 | ||
620 | icon = loadPixmap( pathString + "newevent" ); | 626 | icon = loadPixmap( pathString + "newevent" ); |
621 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); | 627 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); |
622 | configureToolBarMenu->insertSeparator(); | 628 | configureToolBarMenu->insertSeparator(); |
623 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); | 629 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); |
624 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); | 630 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); |
625 | ne_action->addTo( actionMenu ); | 631 | ne_action->addTo( actionMenu ); |
626 | connect( ne_action, SIGNAL( activated() ), | 632 | connect( ne_action, SIGNAL( activated() ), |
627 | mView, SLOT( newEvent() ) ); | 633 | mView, SLOT( newEvent() ) ); |
628 | icon = loadPixmap( pathString + "newtodo" ); | 634 | icon = loadPixmap( pathString + "newtodo" ); |
629 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); | 635 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); |
630 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); | 636 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); |
631 | nt_action->addTo( actionMenu ); | 637 | nt_action->addTo( actionMenu ); |
632 | connect( nt_action, SIGNAL( activated() ), | 638 | connect( nt_action, SIGNAL( activated() ), |
633 | mView, SLOT( newTodo() ) ); | 639 | mView, SLOT( newTodo() ) ); |
634 | 640 | ||
635 | icon = loadPixmap( pathString + "today" ); | 641 | icon = loadPixmap( pathString + "today" ); |
636 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); | 642 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); |
637 | today_action->addTo( viewMenu ); | 643 | today_action->addTo( viewMenu ); |
638 | connect( today_action, SIGNAL( activated() ), | 644 | connect( today_action, SIGNAL( activated() ), |
639 | mView, SLOT( goToday() ) ); | 645 | mView, SLOT( goToday() ) ); |
640 | viewMenu->insertSeparator(); | 646 | viewMenu->insertSeparator(); |
641 | 647 | ||
642 | icon = loadPixmap( pathString + "navi" ); | 648 | icon = loadPixmap( pathString + "navi" ); |
643 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); | 649 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); |
644 | action->addTo( viewMenu ); | 650 | action->addTo( viewMenu ); |
@@ -1325,98 +1331,104 @@ void MainWindow::aboutKnownBugs() | |||
1325 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), | 1331 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), |
1326 | QMessageBox::NoIcon, | 1332 | QMessageBox::NoIcon, |
1327 | QMessageBox::Ok, | 1333 | QMessageBox::Ok, |
1328 | QMessageBox::NoButton, | 1334 | QMessageBox::NoButton, |
1329 | QMessageBox::NoButton); | 1335 | QMessageBox::NoButton); |
1330 | msg->exec(); | 1336 | msg->exec(); |
1331 | delete msg; | 1337 | delete msg; |
1332 | 1338 | ||
1333 | } | 1339 | } |
1334 | 1340 | ||
1335 | QString MainWindow::defaultFileName() | 1341 | QString MainWindow::defaultFileName() |
1336 | { | 1342 | { |
1337 | return locateLocal( "data", "korganizer/mycalendar.ics" ); | 1343 | return locateLocal( "data", "korganizer/mycalendar.ics" ); |
1338 | } | 1344 | } |
1339 | QString MainWindow::syncFileName() | 1345 | QString MainWindow::syncFileName() |
1340 | { | 1346 | { |
1341 | #ifdef DESKTOP_VERSION | 1347 | #ifdef DESKTOP_VERSION |
1342 | return locateLocal( "tmp", "synccalendar.ics" ); | 1348 | return locateLocal( "tmp", "synccalendar.ics" ); |
1343 | #else | 1349 | #else |
1344 | return QString( "/tmp/synccalendar.ics" ); | 1350 | return QString( "/tmp/synccalendar.ics" ); |
1345 | #endif | 1351 | #endif |
1346 | } | 1352 | } |
1347 | void MainWindow::updateWeek(QDate seda) | 1353 | void MainWindow::updateWeek(QDate seda) |
1348 | { | 1354 | { |
1349 | int weekNum = 0; | 1355 | int weekNum = 0; |
1350 | QDate d = QDate ( seda.year(), 1,1); | 1356 | QDate d = QDate ( seda.year(), 1,1); |
1351 | seda = seda.addDays( 1-seda.dayOfWeek() );//we are on monday | 1357 | seda = seda.addDays( 1-seda.dayOfWeek() );//we are on monday |
1352 | if ( seda.addDays(6).year() != seda.year() ) { | 1358 | if ( seda.addDays(6).year() != seda.year() ) { |
1353 | if ( seda.year() != d.year() ) { | 1359 | if ( seda.year() != d.year() ) { |
1354 | if ( d.dayOfWeek() > 4 ) | 1360 | if ( d.dayOfWeek() > 4 ) |
1355 | d = QDate ( seda.year(), 1,1); | 1361 | d = QDate ( seda.year(), 1,1); |
1356 | else | 1362 | else |
1357 | weekNum = 1; | 1363 | weekNum = 1; |
1358 | } else { | 1364 | } else { |
1359 | QDate dd( seda.year()+1, 1,1); | 1365 | QDate dd( seda.year()+1, 1,1); |
1360 | if ( dd.dayOfWeek() <= 4 ) | 1366 | if ( dd.dayOfWeek() <= 4 ) |
1361 | weekNum = 1; | 1367 | weekNum = 1; |
1362 | } | 1368 | } |
1363 | } | 1369 | } |
1364 | if ( weekNum == 0 ){ | 1370 | if ( weekNum == 0 ){ |
1365 | int dow = d.dayOfWeek(); | 1371 | int dow = d.dayOfWeek(); |
1366 | if ( dow <= 4 ) | 1372 | if ( dow <= 4 ) |
1367 | d = d.addDays( 1-dow ); | 1373 | d = d.addDays( 1-dow ); |
1368 | else // 5,6,7 | 1374 | else // 5,6,7 |
1369 | d = d.addDays( 8-dow ); | 1375 | d = d.addDays( 8-dow ); |
1370 | // we have the first week of the year.we are on monday | 1376 | // we have the first week of the year.we are on monday |
1371 | weekNum = d.daysTo( seda ) / 7 +1; | 1377 | weekNum = d.daysTo( seda ) / 7 +1; |
1372 | } | 1378 | } |
1373 | //qDebug("weeknum %s ", QString::number( weekNum).latin1()); | 1379 | |
1374 | menuBarWeek-> changeItem(1, QString::number( weekNum) ); | 1380 | mWeekPixmap.fill( mWeekBgColor ); |
1381 | QPainter p ( &mWeekPixmap ); | ||
1382 | p.setFont( mWeekFont ); | ||
1383 | p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); | ||
1384 | p.end(); | ||
1385 | QIconSet icon3 ( mWeekPixmap ); | ||
1386 | mWeekAction->setIconSet ( icon3 ); | ||
1375 | 1387 | ||
1376 | } | 1388 | } |
1377 | void MainWindow::updateWeekNum(const DateList &selectedDates) | 1389 | void MainWindow::updateWeekNum(const DateList &selectedDates) |
1378 | { | 1390 | { |
1379 | updateWeek( selectedDates.first() ); | 1391 | updateWeek( selectedDates.first() ); |
1380 | } | 1392 | } |
1381 | void MainWindow::processIncidenceSelection( Incidence *incidence ) | 1393 | void MainWindow::processIncidenceSelection( Incidence *incidence ) |
1382 | { | 1394 | { |
1383 | 1395 | ||
1384 | if ( !incidence ) { | 1396 | if ( !incidence ) { |
1385 | enableIncidenceActions( false ); | 1397 | enableIncidenceActions( false ); |
1386 | 1398 | ||
1387 | mNewSubTodoAction->setEnabled( false ); | 1399 | mNewSubTodoAction->setEnabled( false ); |
1388 | setCaptionToDates(); | 1400 | setCaptionToDates(); |
1389 | return; | 1401 | return; |
1390 | 1402 | ||
1391 | } | 1403 | } |
1392 | 1404 | ||
1393 | //KGlobal::locale()->formatDateTime(nextA, true); | 1405 | //KGlobal::locale()->formatDateTime(nextA, true); |
1394 | QString startString = ""; | 1406 | QString startString = ""; |
1395 | if ( incidence->type() != "Todo" ) { | 1407 | if ( incidence->type() != "Todo" ) { |
1396 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { | 1408 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { |
1397 | if ( incidence->doesFloat() ) { | 1409 | if ( incidence->doesFloat() ) { |
1398 | startString += ": "+incidence->dtStartDateStr( true ); | 1410 | startString += ": "+incidence->dtStartDateStr( true ); |
1399 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); | 1411 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); |
1400 | 1412 | ||
1401 | } else { | 1413 | } else { |
1402 | startString = ": "+incidence->dtStartStr(true); | 1414 | startString = ": "+incidence->dtStartStr(true); |
1403 | startString += " --- "+((Event*)incidence)->dtEndStr(true); | 1415 | startString += " --- "+((Event*)incidence)->dtEndStr(true); |
1404 | 1416 | ||
1405 | } | 1417 | } |
1406 | 1418 | ||
1407 | } else { | 1419 | } else { |
1408 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) | 1420 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) |
1409 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ | 1421 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ |
1410 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); | 1422 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); |
1411 | if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) { | 1423 | if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) { |
1412 | bool ok; | 1424 | bool ok; |
1413 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); | 1425 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); |
1414 | if ( ok ) { | 1426 | if ( ok ) { |
1415 | int years = noc.date().year() - incidence->dtStart().date().year(); | 1427 | int years = noc.date().year() - incidence->dtStart().date().year(); |
1416 | startString += i18n(" (%1 y.)"). arg( years ); | 1428 | startString += i18n(" (%1 y.)"). arg( years ); |
1417 | } | 1429 | } |
1418 | } | 1430 | } |
1419 | else | 1431 | else |
1420 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); | 1432 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); |
1421 | } | 1433 | } |
1422 | 1434 | ||
@@ -1674,97 +1686,97 @@ void MainWindow::keyPressEvent ( QKeyEvent * e ) | |||
1674 | break; | 1686 | break; |
1675 | case Qt::Key_V: | 1687 | case Qt::Key_V: |
1676 | mView->viewManager()->showTodoView(); | 1688 | mView->viewManager()->showTodoView(); |
1677 | break; | 1689 | break; |
1678 | case Qt::Key_C: | 1690 | case Qt::Key_C: |
1679 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); | 1691 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); |
1680 | break; | 1692 | break; |
1681 | case Qt::Key_P: | 1693 | case Qt::Key_P: |
1682 | mView->showDatePicker( ); | 1694 | mView->showDatePicker( ); |
1683 | break; | 1695 | break; |
1684 | case Qt::Key_F: | 1696 | case Qt::Key_F: |
1685 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1697 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1686 | mView->editFilters(); | 1698 | mView->editFilters(); |
1687 | else | 1699 | else |
1688 | mView->toggleFilter(); | 1700 | mView->toggleFilter(); |
1689 | break; | 1701 | break; |
1690 | case Qt::Key_X: | 1702 | case Qt::Key_X: |
1691 | mView->toggleDateNavigatorWidget(); | 1703 | mView->toggleDateNavigatorWidget(); |
1692 | break; | 1704 | break; |
1693 | case Qt::Key_Space: | 1705 | case Qt::Key_Space: |
1694 | mView->toggleExpand(); | 1706 | mView->toggleExpand(); |
1695 | break; | 1707 | break; |
1696 | case Qt::Key_A: | 1708 | case Qt::Key_A: |
1697 | mView->toggleAllDaySize(); | 1709 | mView->toggleAllDaySize(); |
1698 | break; | 1710 | break; |
1699 | case Qt::Key_T: | 1711 | case Qt::Key_T: |
1700 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1712 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1701 | mView->newTodo(); | 1713 | mView->newTodo(); |
1702 | else { | 1714 | else { |
1703 | mView->goToday(); | 1715 | mView->goToday(); |
1704 | showSelectedDates = true; | 1716 | showSelectedDates = true; |
1705 | } | 1717 | } |
1706 | break; | 1718 | break; |
1707 | case Qt::Key_J: | 1719 | case Qt::Key_J: |
1708 | mView->viewManager()->showJournalView(); | 1720 | mView->viewManager()->showJournalView(); |
1709 | break; | 1721 | break; |
1710 | case Qt::Key_B: | 1722 | case Qt::Key_B: |
1711 | mView->editIncidenceDescription();; | 1723 | mView->editIncidenceDescription();; |
1712 | break; | 1724 | break; |
1713 | // case Qt::Key_Return: | 1725 | // case Qt::Key_Return: |
1714 | case Qt::Key_E: | 1726 | case Qt::Key_E: |
1715 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1727 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1716 | mView->newEvent(); | 1728 | mView->newEvent(); |
1717 | else | 1729 | else |
1718 | mView->editIncidence(); | 1730 | mView->editIncidence(); |
1719 | break; | 1731 | break; |
1720 | case Qt::Key_Plus: | 1732 | case Qt::Key_Plus: |
1721 | size = p->mHourSize +2; | 1733 | size = p->mHourSize +2; |
1722 | if ( size <= 18 ) | 1734 | if ( size <= 22 ) |
1723 | configureAgenda( size ); | 1735 | configureAgenda( size ); |
1724 | break; | 1736 | break; |
1725 | case Qt::Key_Minus: | 1737 | case Qt::Key_Minus: |
1726 | size = p->mHourSize - 2; | 1738 | size = p->mHourSize - 2; |
1727 | if ( size >= 4 ) | 1739 | if ( size >= 4 ) |
1728 | configureAgenda( size ); | 1740 | configureAgenda( size ); |
1729 | break; | 1741 | break; |
1730 | 1742 | ||
1731 | 1743 | ||
1732 | default: | 1744 | default: |
1733 | e->ignore(); | 1745 | e->ignore(); |
1734 | } | 1746 | } |
1735 | if ( pro > 0 ) { | 1747 | if ( pro > 0 ) { |
1736 | mView->selectFilter( pro-1 ); | 1748 | mView->selectFilter( pro-1 ); |
1737 | } | 1749 | } |
1738 | if ( showSelectedDates ) { | 1750 | if ( showSelectedDates ) { |
1739 | ;// setCaptionToDates(); | 1751 | ;// setCaptionToDates(); |
1740 | } | 1752 | } |
1741 | 1753 | ||
1742 | } | 1754 | } |
1743 | 1755 | ||
1744 | void MainWindow::fillFilterMenu() | 1756 | void MainWindow::fillFilterMenu() |
1745 | { | 1757 | { |
1746 | selectFilterMenu->clear(); | 1758 | selectFilterMenu->clear(); |
1747 | bool disable = false; | 1759 | bool disable = false; |
1748 | selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); | 1760 | selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); |
1749 | selectFilterMenu->insertSeparator(); | 1761 | selectFilterMenu->insertSeparator(); |
1750 | if ( mView->filterView()->filtersEnabled() ) { | 1762 | if ( mView->filterView()->filtersEnabled() ) { |
1751 | selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 1 ); | 1763 | selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 1 ); |
1752 | } | 1764 | } |
1753 | else { | 1765 | else { |
1754 | selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 1 ); | 1766 | selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 1 ); |
1755 | disable = true; | 1767 | disable = true; |
1756 | } | 1768 | } |
1757 | selectFilterMenu->insertSeparator(); | 1769 | selectFilterMenu->insertSeparator(); |
1758 | QPtrList<CalFilter> fili = mView->filters(); | 1770 | QPtrList<CalFilter> fili = mView->filters(); |
1759 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 1771 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
1760 | CalFilter *filter = fili.first(); | 1772 | CalFilter *filter = fili.first(); |
1761 | int iii = 2; | 1773 | int iii = 2; |
1762 | while(filter) { | 1774 | while(filter) { |
1763 | selectFilterMenu->insertItem( filter->name(), iii ); | 1775 | selectFilterMenu->insertItem( filter->name(), iii ); |
1764 | if ( filter == curfilter) | 1776 | if ( filter == curfilter) |
1765 | selectFilterMenu->setItemChecked( iii, true ); | 1777 | selectFilterMenu->setItemChecked( iii, true ); |
1766 | if ( disable ) | 1778 | if ( disable ) |
1767 | selectFilterMenu->setItemEnabled( iii, false ); | 1779 | selectFilterMenu->setItemEnabled( iii, false ); |
1768 | filter = fili.next(); | 1780 | filter = fili.next(); |
1769 | ++iii; | 1781 | ++iii; |
1770 | } | 1782 | } |
@@ -1966,48 +1978,72 @@ void MainWindow::exportVCalendar() | |||
1966 | 0, 1 ); | 1978 | 0, 1 ); |
1967 | if ( result != 0 ) { | 1979 | if ( result != 0 ) { |
1968 | createbup = false; | 1980 | createbup = false; |
1969 | } | 1981 | } |
1970 | } | 1982 | } |
1971 | if ( createbup ) { | 1983 | if ( createbup ) { |
1972 | if ( mView->exportVCalendar( fn ) ) { | 1984 | if ( mView->exportVCalendar( fn ) ) { |
1973 | KOPrefs::instance()->mLastVcalFile = fn; | 1985 | KOPrefs::instance()->mLastVcalFile = fn; |
1974 | if ( fn.length() > 20 ) | 1986 | if ( fn.length() > 20 ) |
1975 | mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; | 1987 | mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; |
1976 | else | 1988 | else |
1977 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); | 1989 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); |
1978 | setCaption(mes); | 1990 | setCaption(mes); |
1979 | } | 1991 | } |
1980 | } | 1992 | } |
1981 | 1993 | ||
1982 | } | 1994 | } |
1983 | 1995 | ||
1984 | void MainWindow::syncFileRequest() | 1996 | void MainWindow::syncFileRequest() |
1985 | { | 1997 | { |
1986 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { | 1998 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { |
1987 | mSyncManager->slotSyncMenu( 999 ); | 1999 | mSyncManager->slotSyncMenu( 999 ); |
1988 | } | 2000 | } |
1989 | save(); | 2001 | save(); |
1990 | } | 2002 | } |
1991 | void MainWindow::getFile( bool success ) | 2003 | void MainWindow::getFile( bool success ) |
1992 | { | 2004 | { |
1993 | if ( ! success ) { | 2005 | if ( ! success ) { |
1994 | setCaption( i18n("Error receiving file. Nothing changed!") ); | 2006 | setCaption( i18n("Error receiving file. Nothing changed!") ); |
1995 | return; | 2007 | return; |
1996 | } | 2008 | } |
1997 | mView->openCalendar( defaultFileName() ); | 2009 | mView->openCalendar( defaultFileName() ); |
1998 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { | 2010 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { |
1999 | mSyncManager->slotSyncMenu( 999 ); | 2011 | mSyncManager->slotSyncMenu( 999 ); |
2000 | } | 2012 | } |
2001 | setCaption( i18n("Pi-Sync successful!") ); | 2013 | setCaption( i18n("Pi-Sync successful!") ); |
2002 | } | 2014 | } |
2003 | 2015 | ||
2004 | void MainWindow::printSel( ) | 2016 | void MainWindow::printSel( ) |
2005 | { | 2017 | { |
2006 | mView->viewManager()->agendaView()->agenda()->printSelection(); | 2018 | mView->viewManager()->agendaView()->agenda()->printSelection(); |
2007 | } | 2019 | } |
2008 | 2020 | ||
2009 | void MainWindow::printCal() | 2021 | void MainWindow::printCal() |
2010 | { | 2022 | { |
2011 | mView->print();//mCp->showDialog(); | 2023 | mView->print();//mCp->showDialog(); |
2012 | } | 2024 | } |
2013 | 2025 | ||
2026 | |||
2027 | #include "libkdepim/kdatepicker.h" | ||
2028 | #include <kdatetbl.h> | ||
2029 | void MainWindow::weekAction() | ||
2030 | { | ||
2031 | int month; | ||
2032 | KPopupFrame* popup = new KPopupFrame(this); | ||
2033 | int size = 12; | ||
2034 | if ( QApplication::desktop()->width() >= 480 ) | ||
2035 | size = 18; | ||
2036 | KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(size, popup); | ||
2037 | // ----- | ||
2038 | picker->resize(picker->sizeHint()); | ||
2039 | popup->setMainWidget(picker); | ||
2040 | picker->setFocus(); | ||
2041 | connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); | ||
2042 | if(popup->exec(iconToolBar->mapToGlobal(QPoint(0, iconToolBar->height())))) | ||
2043 | { | ||
2044 | month = picker->getResult(); | ||
2045 | emit selectWeek ( month ); | ||
2046 | //qDebug("weekSelected %d ", month); | ||
2047 | } | ||
2048 | delete popup; | ||
2049 | } | ||
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h index 076ab94..5b9f903 100644 --- a/korganizer/mainwindow.h +++ b/korganizer/mainwindow.h | |||
@@ -1,147 +1,158 @@ | |||
1 | #ifndef KORGE_MAINWINDOW_H | 1 | #ifndef KORGE_MAINWINDOW_H |
2 | #define KORGE_MAINWINDOW_H | 2 | #define KORGE_MAINWINDOW_H |
3 | 3 | ||
4 | #include <qmainwindow.h> | 4 | #include <qmainwindow.h> |
5 | #include <qtimer.h> | 5 | #include <qtimer.h> |
6 | #include <qdict.h> | 6 | #include <qdict.h> |
7 | #include <qfile.h> | 7 | #include <qfile.h> |
8 | #include <qmenubar.h> | ||
8 | #include <qtextstream.h> | 9 | #include <qtextstream.h> |
9 | #include <qregexp.h> | 10 | #include <qregexp.h> |
10 | 11 | ||
11 | #include <libkcal/incidence.h> | 12 | #include <libkcal/incidence.h> |
12 | #include "simplealarmclient.h" | 13 | #include "simplealarmclient.h" |
13 | #include <ksyncmanager.h> | 14 | #include <ksyncmanager.h> |
14 | #ifndef DESKTOP_VERSION | 15 | #ifndef DESKTOP_VERSION |
15 | #include <qcopchannel_qws.h> | 16 | #include <qcopchannel_qws.h> |
16 | #endif | 17 | #endif |
17 | class QAction; | 18 | class QAction; |
18 | class CalendarView; | 19 | class CalendarView; |
19 | class KSyncProfile; | 20 | class KSyncProfile; |
20 | #ifdef DESKTOP_VERSION | 21 | #ifdef DESKTOP_VERSION |
21 | 22 | ||
22 | #define QPEToolBar QToolBar | 23 | #define QPEToolBar QToolBar |
23 | #define QPEMenuBar QMenuBar | 24 | #define QPEMenuBar QMenuBar |
24 | #endif | 25 | #endif |
25 | class QPEToolBar; | 26 | class QPEToolBar; |
26 | class QPEMenuBar; | ||
27 | 27 | ||
28 | 28 | ||
29 | namespace KCal { | 29 | namespace KCal { |
30 | class CalendarLocal; | 30 | class CalendarLocal; |
31 | } | 31 | } |
32 | 32 | ||
33 | class KOMenuBar : public QMenuBar | ||
34 | { | ||
35 | public: | ||
36 | KOMenuBar( QWidget *parent=0 ): QMenuBar (parent ) {;} | ||
37 | QSize sizeHint () const{ qDebug("sizejint ");return QSize ( 40,25 );} | ||
38 | }; | ||
39 | |||
33 | using namespace KCal; | 40 | using namespace KCal; |
34 | 41 | ||
35 | class MainWindow : public QMainWindow | 42 | class MainWindow : public QMainWindow |
36 | { | 43 | { |
37 | Q_OBJECT | 44 | Q_OBJECT |
38 | public: | 45 | public: |
39 | MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); | 46 | MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); |
40 | ~MainWindow(); | 47 | ~MainWindow(); |
41 | bool beamReceiveEnabled(); | 48 | bool beamReceiveEnabled(); |
42 | static QString defaultFileName(); | 49 | static QString defaultFileName(); |
43 | static QString syncFileName(); | 50 | static QString syncFileName(); |
44 | static QString resourcePath(); | 51 | static QString resourcePath(); |
45 | public slots: | 52 | public slots: |
46 | void updateWeekNum(const KCal::DateList &); | 53 | void updateWeekNum(const KCal::DateList &); |
47 | void updateWeek(QDate); | 54 | void updateWeek(QDate); |
48 | virtual void showMaximized (); | 55 | virtual void showMaximized (); |
49 | void configureAgenda( int ); | 56 | void configureAgenda( int ); |
50 | void recieve( const QCString& msg, const QByteArray& data ); | 57 | void recieve( const QCString& msg, const QByteArray& data ); |
51 | protected slots: | 58 | protected slots: |
52 | void setCaptionToDates(); | 59 | void setCaptionToDates(); |
60 | void weekAction(); | ||
53 | void about(); | 61 | void about(); |
54 | void licence(); | 62 | void licence(); |
55 | void faq(); | 63 | void faq(); |
56 | void usertrans(); | 64 | void usertrans(); |
57 | void features(); | 65 | void features(); |
58 | void synchowto(); | 66 | void synchowto(); |
59 | void kdesynchowto(); | 67 | void kdesynchowto(); |
60 | void multisynchowto(); | 68 | void multisynchowto(); |
61 | void whatsNew(); | 69 | void whatsNew(); |
62 | void keyBindings(); | 70 | void keyBindings(); |
63 | void aboutAutoSaving();; | 71 | void aboutAutoSaving();; |
64 | void aboutKnownBugs(); | 72 | void aboutKnownBugs(); |
65 | 73 | ||
66 | void processIncidenceSelection( Incidence * ); | 74 | void processIncidenceSelection( Incidence * ); |
67 | 75 | ||
68 | void importQtopia(); | 76 | void importQtopia(); |
69 | void importBday(); | 77 | void importBday(); |
70 | void importOL(); | 78 | void importOL(); |
71 | void importIcal(); | 79 | void importIcal(); |
72 | void importFile( QString, bool ); | 80 | void importFile( QString, bool ); |
73 | void quickImportIcal(); | 81 | void quickImportIcal(); |
74 | 82 | ||
75 | void slotModifiedChanged( bool ); | 83 | void slotModifiedChanged( bool ); |
76 | 84 | ||
77 | void save(); | 85 | void save(); |
78 | void saveStopTimer(); | 86 | void saveStopTimer(); |
79 | void configureToolBar( int ); | 87 | void configureToolBar( int ); |
80 | void printSel(); | 88 | void printSel(); |
81 | void printCal(); | 89 | void printCal(); |
82 | void saveCalendar(); | 90 | void saveCalendar(); |
83 | void loadCalendar(); | 91 | void loadCalendar(); |
84 | void exportVCalendar(); | 92 | void exportVCalendar(); |
85 | void fillFilterMenu(); | 93 | void fillFilterMenu(); |
86 | void selectFilter( int ); | 94 | void selectFilter( int ); |
87 | void exportToPhone( int ); | 95 | void exportToPhone( int ); |
88 | void toggleBeamReceive(); | 96 | void toggleBeamReceive(); |
89 | void disableBR(bool); | 97 | void disableBR(bool); |
90 | signals: | 98 | signals: |
91 | void selectWeek ( int ); | 99 | void selectWeek ( int ); |
92 | private slots: | 100 | private slots: |
93 | void showConfigureAgenda(); | 101 | void showConfigureAgenda(); |
94 | void getFile( bool ); | 102 | void getFile( bool ); |
95 | void syncFileRequest(); | 103 | void syncFileRequest(); |
96 | 104 | ||
97 | protected: | 105 | protected: |
98 | void displayText( QString, QString); | 106 | void displayText( QString, QString); |
99 | void enableIncidenceActions( bool ); | 107 | void enableIncidenceActions( bool ); |
100 | 108 | ||
101 | private: | 109 | private: |
102 | bool mBRdisabled; | 110 | bool mBRdisabled; |
103 | #ifndef DESKTOP_VERSION | 111 | #ifndef DESKTOP_VERSION |
104 | QCopChannel* infrared; | 112 | QCopChannel* infrared; |
105 | #endif | 113 | #endif |
106 | QAction* brAction; | 114 | QAction* brAction; |
107 | KSyncManager* mSyncManager; | 115 | KSyncManager* mSyncManager; |
108 | bool mClosed; | 116 | bool mClosed; |
109 | void saveOnClose(); | 117 | void saveOnClose(); |
110 | bool mFlagKeyPressed; | 118 | bool mFlagKeyPressed; |
111 | bool mBlockAtStartup; | 119 | bool mBlockAtStartup; |
112 | QPEToolBar *iconToolBar; | 120 | QPEToolBar *iconToolBar; |
113 | void initActions(); | 121 | void initActions(); |
114 | void setDefaultPreferences(); | 122 | void setDefaultPreferences(); |
115 | void keyPressEvent ( QKeyEvent * ) ; | 123 | void keyPressEvent ( QKeyEvent * ) ; |
116 | void keyReleaseEvent ( QKeyEvent * ) ; | 124 | void keyReleaseEvent ( QKeyEvent * ) ; |
117 | QPopupMenu *configureToolBarMenu; | 125 | QPopupMenu *configureToolBarMenu; |
118 | QPopupMenu *selectFilterMenu; | 126 | QPopupMenu *selectFilterMenu; |
119 | QPopupMenu *configureAgendaMenu, *syncMenu; | 127 | QPopupMenu *configureAgendaMenu, *syncMenu; |
120 | CalendarLocal *mCalendar; | 128 | CalendarLocal *mCalendar; |
121 | CalendarView *mView; | 129 | CalendarView *mView; |
122 | QAction *mNewSubTodoAction; | 130 | QAction *mNewSubTodoAction; |
123 | QPEMenuBar *menuBarWeek; | 131 | QAction *mWeekAction; |
132 | QFont mWeekFont; | ||
133 | QPixmap mWeekPixmap; | ||
134 | QColor mWeekBgColor; | ||
124 | 135 | ||
125 | QAction *mShowAction; | 136 | QAction *mShowAction; |
126 | QAction *mEditAction; | 137 | QAction *mEditAction; |
127 | QAction *mDeleteAction; | 138 | QAction *mDeleteAction; |
128 | QAction *mCloneAction; | 139 | QAction *mCloneAction; |
129 | QAction *mMoveAction; | 140 | QAction *mMoveAction; |
130 | QAction *mBeamAction; | 141 | QAction *mBeamAction; |
131 | QAction *mCancelAction; | 142 | QAction *mCancelAction; |
132 | 143 | ||
133 | QAction *mToggleNav; | 144 | QAction *mToggleNav; |
134 | QAction *mToggleFilter; | 145 | QAction *mToggleFilter; |
135 | QAction *mToggleAllday; | 146 | QAction *mToggleAllday; |
136 | 147 | ||
137 | 148 | ||
138 | void closeEvent( QCloseEvent* ce ); | 149 | void closeEvent( QCloseEvent* ce ); |
139 | SimpleAlarmClient mAlarmClient; | 150 | SimpleAlarmClient mAlarmClient; |
140 | QTimer mSaveTimer; | 151 | QTimer mSaveTimer; |
141 | //bool mBlockSaveFlag; | 152 | //bool mBlockSaveFlag; |
142 | bool mCalendarModifiedFlag; | 153 | bool mCalendarModifiedFlag; |
143 | QPixmap loadPixmap( QString ); | 154 | QPixmap loadPixmap( QString ); |
144 | }; | 155 | }; |
145 | 156 | ||
146 | 157 | ||
147 | #endif | 158 | #endif |