-rw-r--r-- | korganizer/kolocationbox.cpp | 2 | ||||
-rw-r--r-- | korganizer/kolocationbox.h | 2 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 4 |
3 files changed, 4 insertions, 4 deletions
diff --git a/korganizer/kolocationbox.cpp b/korganizer/kolocationbox.cpp index f8fee2e..35a8123 100644 --- a/korganizer/kolocationbox.cpp +++ b/korganizer/kolocationbox.cpp | |||
@@ -1,96 +1,96 @@ | |||
1 | /* | 1 | /* |
2 | Copyright (c) 2004 Dirk Loesche <dirk.loesche@bigfoot.de> | 2 | Copyright (c) 2004 Dirk Loesche <dirk.loesche@bigfoot.de> |
3 | 3 | ||
4 | This file is part of KOrganizer/PI | 4 | This file is part of KOrganizer/PI |
5 | KOrganizer Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 5 | KOrganizer Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
6 | KOrganizer/PI Copyright (c) 2004 Lutz Rogowski <lutz@pi-sync.net> | 6 | KOrganizer/PI Copyright (c) 2004 Lutz Rogowski <lutz@pi-sync.info> |
7 | 7 | ||
8 | This program is free software; you can redistribute it and/or modify | 8 | This program is free software; you can redistribute it and/or modify |
9 | it under the terms of the GNU General Public License as published by | 9 | it under the terms of the GNU General Public License as published by |
10 | the Free Software Foundation; either version 2 of the License, or | 10 | the Free Software Foundation; either version 2 of the License, or |
11 | (at your option) any later version. | 11 | (at your option) any later version. |
12 | 12 | ||
13 | This program is distributed in the hope that it will be useful, | 13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. | 16 | GNU General Public License for more details. |
17 | 17 | ||
18 | You should have received a copy of the GNU General Public License | 18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software | 19 | along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21 | 21 | ||
22 | As a special exception, permission is given to link this program | 22 | As a special exception, permission is given to link this program |
23 | with any edition of Qt, and distribute the resulting executable, | 23 | with any edition of Qt, and distribute the resulting executable, |
24 | without including the source code for Qt in the source distribution. | 24 | without including the source code for Qt in the source distribution. |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include "kolocationbox.h" | 27 | #include "kolocationbox.h" |
28 | #include <qstring.h> | 28 | #include <qstring.h> |
29 | #include <qlineedit.h> | 29 | #include <qlineedit.h> |
30 | #include <qapplication.h> | 30 | #include <qapplication.h> |
31 | 31 | ||
32 | 32 | ||
33 | KOLocationBox::KOLocationBox( bool rw , QWidget *parent , int _maxItems) : | 33 | KOLocationBox::KOLocationBox( bool rw , QWidget *parent , int _maxItems) : |
34 | QComboBox( rw , parent ) | 34 | QComboBox( rw , parent ) |
35 | { | 35 | { |
36 | maxItems = _maxItems; | 36 | maxItems = _maxItems; |
37 | maxItems = 50; // sorry - hack from me to set maxitems globally to 30 | 37 | maxItems = 50; // sorry - hack from me to set maxitems globally to 30 |
38 | setInsertionPolicy(AtTop); | 38 | setInsertionPolicy(AtTop); |
39 | setDuplicatesEnabled( FALSE ); | 39 | setDuplicatesEnabled( FALSE ); |
40 | setMaxCount( maxItems ); | 40 | setMaxCount( maxItems ); |
41 | setAutoCompletion( TRUE ); | 41 | setAutoCompletion( TRUE ); |
42 | 42 | ||
43 | } | 43 | } |
44 | 44 | ||
45 | KOLocationBox::~KOLocationBox() | 45 | KOLocationBox::~KOLocationBox() |
46 | { | 46 | { |
47 | } | 47 | } |
48 | 48 | ||
49 | void KOLocationBox::load(int what) | 49 | void KOLocationBox::load(int what) |
50 | { | 50 | { |
51 | clear(); | 51 | clear(); |
52 | // qDebug("load %d ",what ); | 52 | // qDebug("load %d ",what ); |
53 | switch(what) { | 53 | switch(what) { |
54 | case LOCATION: | 54 | case LOCATION: |
55 | insertStringList( KOPrefs::instance()->mLocationDefaults, 0 ); | 55 | insertStringList( KOPrefs::instance()->mLocationDefaults, 0 ); |
56 | // insertStringList( KOPrefs::instance()->mLocationUserDefaults, 0 ); | 56 | // insertStringList( KOPrefs::instance()->mLocationUserDefaults, 0 ); |
57 | break; // don't disable | 57 | break; // don't disable |
58 | case SUMMARYEVENT: | 58 | case SUMMARYEVENT: |
59 | insertStringList( KOPrefs::instance()->mEventSummaryUser, 0 ); | 59 | insertStringList( KOPrefs::instance()->mEventSummaryUser, 0 ); |
60 | break; // don't disable | 60 | break; // don't disable |
61 | case SUMMARYTODO: | 61 | case SUMMARYTODO: |
62 | insertStringList( KOPrefs::instance()->mTodoSummaryUser, 0 ); | 62 | insertStringList( KOPrefs::instance()->mTodoSummaryUser, 0 ); |
63 | break; // don't disable | 63 | break; // don't disable |
64 | } | 64 | } |
65 | } | 65 | } |
66 | 66 | ||
67 | void KOLocationBox::save(int what) | 67 | void KOLocationBox::save(int what) |
68 | { | 68 | { |
69 | strlist.clear(); | 69 | strlist.clear(); |
70 | for( int l = 0; l < count() ; l++ ) { | 70 | for( int l = 0; l < count() ; l++ ) { |
71 | strlist << text( l ); | 71 | strlist << text( l ); |
72 | } | 72 | } |
73 | // strlist.sort(); | 73 | // strlist.sort(); |
74 | QString currentLine = lineEdit()->text(); | 74 | QString currentLine = lineEdit()->text(); |
75 | if ( !strlist.contains( currentLine ) ) | 75 | if ( !strlist.contains( currentLine ) ) |
76 | strlist.prepend( currentLine ); | 76 | strlist.prepend( currentLine ); |
77 | // qDebug("save %d ", what); | 77 | // qDebug("save %d ", what); |
78 | switch(what) { | 78 | switch(what) { |
79 | case LOCATION: | 79 | case LOCATION: |
80 | KOPrefs::instance()->mLocationDefaults = strlist; | 80 | KOPrefs::instance()->mLocationDefaults = strlist; |
81 | // KOPrefs::instance()->mLocationUserDefaults = strlist; | 81 | // KOPrefs::instance()->mLocationUserDefaults = strlist; |
82 | break; // don't disable | 82 | break; // don't disable |
83 | case SUMMARYEVENT: | 83 | case SUMMARYEVENT: |
84 | KOPrefs::instance()->mEventSummaryUser = strlist; | 84 | KOPrefs::instance()->mEventSummaryUser = strlist; |
85 | break; // don't disable | 85 | break; // don't disable |
86 | case SUMMARYTODO: | 86 | case SUMMARYTODO: |
87 | KOPrefs::instance()->mTodoSummaryUser = strlist; | 87 | KOPrefs::instance()->mTodoSummaryUser = strlist; |
88 | break; // don't disable | 88 | break; // don't disable |
89 | } | 89 | } |
90 | } | 90 | } |
91 | 91 | ||
92 | void KOLocationBox::clearItems(int what) | 92 | void KOLocationBox::clearItems(int what) |
93 | { | 93 | { |
94 | clear(); | 94 | clear(); |
95 | save(what); | 95 | save(what); |
96 | } | 96 | } |
diff --git a/korganizer/kolocationbox.h b/korganizer/kolocationbox.h index be8ea86..b604d33 100644 --- a/korganizer/kolocationbox.h +++ b/korganizer/kolocationbox.h | |||
@@ -1,55 +1,55 @@ | |||
1 | /* | 1 | /* |
2 | File Copyright (c) 2004 Dirk Loesche <dirk.loesche@bigfoot.de> | 2 | File Copyright (c) 2004 Dirk Loesche <dirk.loesche@bigfoot.de> |
3 | 3 | ||
4 | This file is part of KOrganizer/PI | 4 | This file is part of KOrganizer/PI |
5 | KOrganizer Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 5 | KOrganizer Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
6 | KOrganizer/PI Copyright (c) 2004 Lutz Rogowski <lutz@pi-sync.net> | 6 | KOrganizer/PI Copyright (c) 2004 Lutz Rogowski <lutz@pi-sync.info> |
7 | 7 | ||
8 | This program is free software; you can redistribute it and/or modify | 8 | This program is free software; you can redistribute it and/or modify |
9 | it under the terms of the GNU General Public License as published by | 9 | it under the terms of the GNU General Public License as published by |
10 | the Free Software Foundation; either version 2 of the License, or | 10 | the Free Software Foundation; either version 2 of the License, or |
11 | (at your option) any later version. | 11 | (at your option) any later version. |
12 | 12 | ||
13 | This program is distributed in the hope that it will be useful, | 13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. | 16 | GNU General Public License for more details. |
17 | 17 | ||
18 | You should have received a copy of the GNU General Public License | 18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software | 19 | along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21 | 21 | ||
22 | As a special exception, permission is given to link this program | 22 | As a special exception, permission is given to link this program |
23 | with any edition of Qt, and distribute the resulting executable, | 23 | with any edition of Qt, and distribute the resulting executable, |
24 | without including the source code for Qt in the source distribution. | 24 | without including the source code for Qt in the source distribution. |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #ifndef KOLOCATIONBOX_H | 27 | #ifndef KOLOCATIONBOX_H |
28 | #define KOLOCATIONBOX_H | 28 | #define KOLOCATIONBOX_H |
29 | 29 | ||
30 | #include <qcombobox.h> | 30 | #include <qcombobox.h> |
31 | #include "koprefs.h" | 31 | #include "koprefs.h" |
32 | 32 | ||
33 | class KOLocationBox : public QComboBox | 33 | class KOLocationBox : public QComboBox |
34 | { | 34 | { |
35 | public: | 35 | public: |
36 | KOLocationBox( bool rw , QWidget *parent , int _maxItems ); | 36 | KOLocationBox( bool rw , QWidget *parent , int _maxItems ); |
37 | virtual ~KOLocationBox(); | 37 | virtual ~KOLocationBox(); |
38 | 38 | ||
39 | enum {LOCATION, SUMMARYEVENT, SUMMARYTODO}; | 39 | enum {LOCATION, SUMMARYEVENT, SUMMARYTODO}; |
40 | 40 | ||
41 | public slots: | 41 | public slots: |
42 | void load(int); | 42 | void load(int); |
43 | void save(int); | 43 | void save(int); |
44 | void clearItems(int); // clear listbox and config rc items | 44 | void clearItems(int); // clear listbox and config rc items |
45 | 45 | ||
46 | protected: | 46 | protected: |
47 | // void focusOutEvent( QFocusEvent * ); | 47 | // void focusOutEvent( QFocusEvent * ); |
48 | // void timerEvent( QTimerEvent * ); | 48 | // void timerEvent( QTimerEvent * ); |
49 | 49 | ||
50 | private: | 50 | private: |
51 | int maxItems; // maximal listbox items | 51 | int maxItems; // maximal listbox items |
52 | QStringList strlist; // temporary stringlist | 52 | QStringList strlist; // temporary stringlist |
53 | }; | 53 | }; |
54 | 54 | ||
55 | #endif | 55 | #endif |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 4f71788..bd9efc8 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -1086,457 +1086,457 @@ void MainWindow::initActions() | |||
1086 | configureToolBarMenu->setItemChecked( 210, true ); | 1086 | configureToolBarMenu->setItemChecked( 210, true ); |
1087 | if (p-> mShowIconToday) | 1087 | if (p-> mShowIconToday) |
1088 | configureToolBarMenu->setItemChecked( 130, true ); | 1088 | configureToolBarMenu->setItemChecked( 130, true ); |
1089 | if (p-> mShowIconForward) | 1089 | if (p-> mShowIconForward) |
1090 | configureToolBarMenu->setItemChecked( 220, true ); | 1090 | configureToolBarMenu->setItemChecked( 220, true ); |
1091 | if (p-> mShowIconForwardFast) | 1091 | if (p-> mShowIconForwardFast) |
1092 | configureToolBarMenu->setItemChecked( 230, true ); | 1092 | configureToolBarMenu->setItemChecked( 230, true ); |
1093 | if (p-> mShowIconNextDays) | 1093 | if (p-> mShowIconNextDays) |
1094 | configureToolBarMenu->setItemChecked( 100, true ); | 1094 | configureToolBarMenu->setItemChecked( 100, true ); |
1095 | if (p-> mShowIconNext) | 1095 | if (p-> mShowIconNext) |
1096 | configureToolBarMenu->setItemChecked( 110, true ); | 1096 | configureToolBarMenu->setItemChecked( 110, true ); |
1097 | if (p-> mShowIconJournal) | 1097 | if (p-> mShowIconJournal) |
1098 | configureToolBarMenu->setItemChecked( 90, true ); | 1098 | configureToolBarMenu->setItemChecked( 90, true ); |
1099 | if (p-> mShowIconWhatsThis) | 1099 | if (p-> mShowIconWhatsThis) |
1100 | configureToolBarMenu->setItemChecked( 300, true ); | 1100 | configureToolBarMenu->setItemChecked( 300, true ); |
1101 | if (p-> mShowIconWeekNum) | 1101 | if (p-> mShowIconWeekNum) |
1102 | configureToolBarMenu->setItemChecked( 400, true ); | 1102 | configureToolBarMenu->setItemChecked( 400, true ); |
1103 | QLabel* dummy = new QLabel( iconToolBar ); | 1103 | QLabel* dummy = new QLabel( iconToolBar ); |
1104 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); | 1104 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); |
1105 | if (!p-> mShowIconStretch) | 1105 | if (!p-> mShowIconStretch) |
1106 | iconToolBar->setStretchableWidget ( dummy ) ; | 1106 | iconToolBar->setStretchableWidget ( dummy ) ; |
1107 | else | 1107 | else |
1108 | configureToolBarMenu->setItemChecked( 5, true ); | 1108 | configureToolBarMenu->setItemChecked( 5, true ); |
1109 | if (p-> mShowIconWhatsThis) | 1109 | if (p-> mShowIconWhatsThis) |
1110 | QWhatsThis::whatsThisButton ( iconToolBar ); | 1110 | QWhatsThis::whatsThisButton ( iconToolBar ); |
1111 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); | 1111 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); |
1112 | configureAgenda( p->mHourSize ); | 1112 | configureAgenda( p->mHourSize ); |
1113 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); | 1113 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); |
1114 | } | 1114 | } |
1115 | 1115 | ||
1116 | void MainWindow::exportToPhone( int mode ) | 1116 | void MainWindow::exportToPhone( int mode ) |
1117 | { | 1117 | { |
1118 | 1118 | ||
1119 | //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); | 1119 | //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); |
1120 | //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); | 1120 | //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); |
1121 | KOex2phonePrefs ex2phone; | 1121 | KOex2phonePrefs ex2phone; |
1122 | 1122 | ||
1123 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); | 1123 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); |
1124 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); | 1124 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); |
1125 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 1125 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
1126 | if ( mode == 1 ) | 1126 | if ( mode == 1 ) |
1127 | ex2phone.setCaption(i18n("Export complete calendar")); | 1127 | ex2phone.setCaption(i18n("Export complete calendar")); |
1128 | if ( mode == 2 ) | 1128 | if ( mode == 2 ) |
1129 | ex2phone.setCaption(i18n("Export filtered calendar")); | 1129 | ex2phone.setCaption(i18n("Export filtered calendar")); |
1130 | 1130 | ||
1131 | if ( !ex2phone.exec() ) { | 1131 | if ( !ex2phone.exec() ) { |
1132 | return; | 1132 | return; |
1133 | } | 1133 | } |
1134 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); | 1134 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); |
1135 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); | 1135 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); |
1136 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); | 1136 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); |
1137 | 1137 | ||
1138 | int inFuture = 0; | 1138 | int inFuture = 0; |
1139 | if ( ex2phone.mWriteBackFuture->isChecked() ) | 1139 | if ( ex2phone.mWriteBackFuture->isChecked() ) |
1140 | inFuture = ex2phone.mWriteBackFutureWeeks->value(); | 1140 | inFuture = ex2phone.mWriteBackFutureWeeks->value(); |
1141 | QPtrList<Incidence> delSel; | 1141 | QPtrList<Incidence> delSel; |
1142 | if ( mode == 1 ) | 1142 | if ( mode == 1 ) |
1143 | delSel = mCalendar->rawIncidences(); | 1143 | delSel = mCalendar->rawIncidences(); |
1144 | if ( mode == 2 ) | 1144 | if ( mode == 2 ) |
1145 | delSel = mCalendar->incidences(); | 1145 | delSel = mCalendar->incidences(); |
1146 | CalendarLocal* cal = new CalendarLocal(); | 1146 | CalendarLocal* cal = new CalendarLocal(); |
1147 | cal->setLocalTime(); | 1147 | cal->setLocalTime(); |
1148 | Incidence *incidence = delSel.first(); | 1148 | Incidence *incidence = delSel.first(); |
1149 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); | 1149 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); |
1150 | QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); | 1150 | QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); |
1151 | while ( incidence ) { | 1151 | while ( incidence ) { |
1152 | if ( incidence->type() != "Journal" ) { | 1152 | if ( incidence->type() != "Journal" ) { |
1153 | bool add = true; | 1153 | bool add = true; |
1154 | if ( inFuture ) { | 1154 | if ( inFuture ) { |
1155 | QDateTime dt; | 1155 | QDateTime dt; |
1156 | if ( incidence->type() == "Todo" ) { | 1156 | if ( incidence->type() == "Todo" ) { |
1157 | Todo * t = (Todo*)incidence; | 1157 | Todo * t = (Todo*)incidence; |
1158 | if ( t->hasDueDate() ) | 1158 | if ( t->hasDueDate() ) |
1159 | dt = t->dtDue(); | 1159 | dt = t->dtDue(); |
1160 | else | 1160 | else |
1161 | dt = cur.addSecs( 62 ); | 1161 | dt = cur.addSecs( 62 ); |
1162 | } | 1162 | } |
1163 | else { | 1163 | else { |
1164 | bool ok; | 1164 | bool ok; |
1165 | dt = incidence->getNextOccurence( cur, &ok ); | 1165 | dt = incidence->getNextOccurence( cur, &ok ); |
1166 | if ( !ok ) | 1166 | if ( !ok ) |
1167 | dt = cur.addSecs( -62 ); | 1167 | dt = cur.addSecs( -62 ); |
1168 | } | 1168 | } |
1169 | if ( dt < cur || dt > end ) { | 1169 | if ( dt < cur || dt > end ) { |
1170 | add = false; | 1170 | add = false; |
1171 | } | 1171 | } |
1172 | } | 1172 | } |
1173 | if ( add ) { | 1173 | if ( add ) { |
1174 | Incidence *in = incidence->clone(); | 1174 | Incidence *in = incidence->clone(); |
1175 | cal->addIncidence( in ); | 1175 | cal->addIncidence( in ); |
1176 | } | 1176 | } |
1177 | } | 1177 | } |
1178 | incidence = delSel.next(); | 1178 | incidence = delSel.next(); |
1179 | } | 1179 | } |
1180 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, | 1180 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, |
1181 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, | 1181 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, |
1182 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 1182 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
1183 | 1183 | ||
1184 | setCaption( i18n("Writing to phone...")); | 1184 | setCaption( i18n("Writing to phone...")); |
1185 | if ( PhoneFormat::writeToPhone( cal ) ) | 1185 | if ( PhoneFormat::writeToPhone( cal ) ) |
1186 | setCaption( i18n("Export to phone successful!")); | 1186 | setCaption( i18n("Export to phone successful!")); |
1187 | else | 1187 | else |
1188 | setCaption( i18n("Error exporting to phone!")); | 1188 | setCaption( i18n("Error exporting to phone!")); |
1189 | delete cal; | 1189 | delete cal; |
1190 | } | 1190 | } |
1191 | 1191 | ||
1192 | 1192 | ||
1193 | void MainWindow::setDefaultPreferences() | 1193 | void MainWindow::setDefaultPreferences() |
1194 | { | 1194 | { |
1195 | KOPrefs *p = KOPrefs::instance(); | 1195 | KOPrefs *p = KOPrefs::instance(); |
1196 | 1196 | ||
1197 | p->mCompactDialogs = true; | 1197 | p->mCompactDialogs = true; |
1198 | p->mConfirm = true; | 1198 | p->mConfirm = true; |
1199 | // p->mEnableQuickTodo = false; | 1199 | // p->mEnableQuickTodo = false; |
1200 | 1200 | ||
1201 | } | 1201 | } |
1202 | 1202 | ||
1203 | QString MainWindow::resourcePath() | 1203 | QString MainWindow::resourcePath() |
1204 | { | 1204 | { |
1205 | return KGlobal::iconLoader()->iconPath(); | 1205 | return KGlobal::iconLoader()->iconPath(); |
1206 | } | 1206 | } |
1207 | 1207 | ||
1208 | void MainWindow::displayText( QString text ,QString cap ) | 1208 | void MainWindow::displayText( QString text ,QString cap ) |
1209 | { | 1209 | { |
1210 | QDialog dia( this, "name", true ); ; | 1210 | QDialog dia( this, "name", true ); ; |
1211 | dia.setCaption( cap ); | 1211 | dia.setCaption( cap ); |
1212 | QVBoxLayout* lay = new QVBoxLayout( &dia ); | 1212 | QVBoxLayout* lay = new QVBoxLayout( &dia ); |
1213 | lay->setSpacing( 3 ); | 1213 | lay->setSpacing( 3 ); |
1214 | lay->setMargin( 3 ); | 1214 | lay->setMargin( 3 ); |
1215 | QTextBrowser tb ( &dia ); | 1215 | QTextBrowser tb ( &dia ); |
1216 | lay->addWidget( &tb ); | 1216 | lay->addWidget( &tb ); |
1217 | tb.setText( text ); | 1217 | tb.setText( text ); |
1218 | #ifdef DESKTOP_VERSION | 1218 | #ifdef DESKTOP_VERSION |
1219 | dia.resize( 640, 480); | 1219 | dia.resize( 640, 480); |
1220 | #else | 1220 | #else |
1221 | dia.showMaximized(); | 1221 | dia.showMaximized(); |
1222 | #endif | 1222 | #endif |
1223 | dia.exec(); | 1223 | dia.exec(); |
1224 | } | 1224 | } |
1225 | 1225 | ||
1226 | void MainWindow::features() | 1226 | void MainWindow::features() |
1227 | { | 1227 | { |
1228 | 1228 | ||
1229 | KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); | 1229 | KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); |
1230 | } | 1230 | } |
1231 | 1231 | ||
1232 | void MainWindow::usertrans() | 1232 | void MainWindow::usertrans() |
1233 | { | 1233 | { |
1234 | 1234 | ||
1235 | KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); | 1235 | KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); |
1236 | } | 1236 | } |
1237 | 1237 | ||
1238 | void MainWindow::kdesynchowto() | 1238 | void MainWindow::kdesynchowto() |
1239 | { | 1239 | { |
1240 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); | 1240 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); |
1241 | } | 1241 | } |
1242 | void MainWindow::multisynchowto() | 1242 | void MainWindow::multisynchowto() |
1243 | { | 1243 | { |
1244 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); | 1244 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); |
1245 | } | 1245 | } |
1246 | void MainWindow::synchowto() | 1246 | void MainWindow::synchowto() |
1247 | { | 1247 | { |
1248 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); | 1248 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); |
1249 | } | 1249 | } |
1250 | void MainWindow::faq() | 1250 | void MainWindow::faq() |
1251 | { | 1251 | { |
1252 | KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); | 1252 | KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); |
1253 | 1253 | ||
1254 | } | 1254 | } |
1255 | void MainWindow::whatsNew() | 1255 | void MainWindow::whatsNew() |
1256 | { | 1256 | { |
1257 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); | 1257 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); |
1258 | 1258 | ||
1259 | } | 1259 | } |
1260 | void MainWindow::licence() | 1260 | void MainWindow::licence() |
1261 | { | 1261 | { |
1262 | KApplication::showLicence(); | 1262 | KApplication::showLicence(); |
1263 | 1263 | ||
1264 | } | 1264 | } |
1265 | void MainWindow::about() | 1265 | void MainWindow::about() |
1266 | { | 1266 | { |
1267 | QString version; | 1267 | QString version; |
1268 | #include <../version> | 1268 | #include <../version> |
1269 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), | 1269 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), |
1270 | i18n("KOrganizer/Platform-independent\n") + | 1270 | i18n("KOrganizer/Platform-independent\n") + |
1271 | "(KO/Pi) " + version + " - " + | 1271 | "(KO/Pi) " + version + " - " + |
1272 | 1272 | ||
1273 | #ifdef DESKTOP_VERSION | 1273 | #ifdef DESKTOP_VERSION |
1274 | i18n("Desktop Edition\n") + | 1274 | i18n("Desktop Edition\n") + |
1275 | #else | 1275 | #else |
1276 | i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + | 1276 | i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + |
1277 | #endif | 1277 | #endif |
1278 | 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.net --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") ); | 1278 | 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!") ); |
1279 | } | 1279 | } |
1280 | void MainWindow::keyBindings() | 1280 | void MainWindow::keyBindings() |
1281 | { | 1281 | { |
1282 | QString cap = i18n("KO/Pi Keys + Colors"); | 1282 | QString cap = i18n("KO/Pi Keys + Colors"); |
1283 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + | 1283 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + |
1284 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ | 1284 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ |
1285 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + | 1285 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + |
1286 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ | 1286 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ |
1287 | i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ | 1287 | i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ |
1288 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ | 1288 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ |
1289 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ | 1289 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ |
1290 | i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ | 1290 | i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ |
1291 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ | 1291 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ |
1292 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ | 1292 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ |
1293 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ | 1293 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ |
1294 | i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ | 1294 | i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ |
1295 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ | 1295 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ |
1296 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ | 1296 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ |
1297 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ | 1297 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ |
1298 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ | 1298 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ |
1299 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ | 1299 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ |
1300 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ | 1300 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ |
1301 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ | 1301 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ |
1302 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ | 1302 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ |
1303 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ | 1303 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ |
1304 | i18n("<p><h3>In agenda view:</h3></p>\n") + | 1304 | i18n("<p><h3>In agenda view:</h3></p>\n") + |
1305 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ | 1305 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ |
1306 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ | 1306 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ |
1307 | i18n("<p><h3>In todo view:</h3></p>\n") + | 1307 | i18n("<p><h3>In todo view:</h3></p>\n") + |
1308 | i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ | 1308 | i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ |
1309 | i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ | 1309 | i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ |
1310 | i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ | 1310 | i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ |
1311 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ | 1311 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ |
1312 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1312 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1313 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ | 1313 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ |
1314 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ | 1314 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ |
1315 | i18n("<p><h3>In list view:</h3></p>\n") + | 1315 | i18n("<p><h3>In list view:</h3></p>\n") + |
1316 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1316 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1317 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ | 1317 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ |
1318 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ | 1318 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ |
1319 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ | 1319 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ |
1320 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ | 1320 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ |
1321 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ | 1321 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ |
1322 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + | 1322 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + |
1323 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ | 1323 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ |
1324 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ | 1324 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ |
1325 | i18n("<p><b>E</b>: Edit item</p>\n") + | 1325 | i18n("<p><b>E</b>: Edit item</p>\n") + |
1326 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + | 1326 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + |
1327 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + | 1327 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + |
1328 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ | 1328 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ |
1329 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ | 1329 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ |
1330 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ | 1330 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ |
1331 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ | 1331 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ |
1332 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ | 1332 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ |
1333 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + | 1333 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + |
1334 | i18n("<p><b>White</b>: Item readonly</p>\n"); | 1334 | i18n("<p><b>White</b>: Item readonly</p>\n"); |
1335 | displayText( text, cap); | 1335 | displayText( text, cap); |
1336 | } | 1336 | } |
1337 | void MainWindow::aboutAutoSaving() | 1337 | void MainWindow::aboutAutoSaving() |
1338 | { | 1338 | { |
1339 | 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"); | 1339 | 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"); |
1340 | 1340 | ||
1341 | KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); | 1341 | KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); |
1342 | 1342 | ||
1343 | } | 1343 | } |
1344 | void MainWindow::aboutKnownBugs() | 1344 | void MainWindow::aboutKnownBugs() |
1345 | { | 1345 | { |
1346 | QMessageBox* msg; | 1346 | QMessageBox* msg; |
1347 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), | 1347 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), |
1348 | 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")+ | 1348 | 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")+ |
1349 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ | 1349 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ |
1350 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + | 1350 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + |
1351 | i18n("\nor report them in the bugtracker on\n") + | 1351 | i18n("\nor report them in the bugtracker on\n") + |
1352 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), | 1352 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), |
1353 | QMessageBox::NoIcon, | 1353 | QMessageBox::NoIcon, |
1354 | QMessageBox::Ok, | 1354 | QMessageBox::Ok, |
1355 | QMessageBox::NoButton, | 1355 | QMessageBox::NoButton, |
1356 | QMessageBox::NoButton); | 1356 | QMessageBox::NoButton); |
1357 | msg->exec(); | 1357 | msg->exec(); |
1358 | delete msg; | 1358 | delete msg; |
1359 | 1359 | ||
1360 | } | 1360 | } |
1361 | 1361 | ||
1362 | QString MainWindow::defaultFileName() | 1362 | QString MainWindow::defaultFileName() |
1363 | { | 1363 | { |
1364 | return locateLocal( "data", "korganizer/mycalendar.ics" ); | 1364 | return locateLocal( "data", "korganizer/mycalendar.ics" ); |
1365 | } | 1365 | } |
1366 | QString MainWindow::syncFileName() | 1366 | QString MainWindow::syncFileName() |
1367 | { | 1367 | { |
1368 | #ifdef DESKTOP_VERSION | 1368 | #ifdef DESKTOP_VERSION |
1369 | return locateLocal( "tmp", "synccalendar.ics" ); | 1369 | return locateLocal( "tmp", "synccalendar.ics" ); |
1370 | #else | 1370 | #else |
1371 | return QString( "/tmp/synccalendar.ics" ); | 1371 | return QString( "/tmp/synccalendar.ics" ); |
1372 | #endif | 1372 | #endif |
1373 | } | 1373 | } |
1374 | void MainWindow::updateWeek(QDate seda) | 1374 | void MainWindow::updateWeek(QDate seda) |
1375 | { | 1375 | { |
1376 | int weekNum = 0; | 1376 | int weekNum = 0; |
1377 | QDate d = QDate ( seda.year(), 1,1); | 1377 | QDate d = QDate ( seda.year(), 1,1); |
1378 | seda = seda.addDays( 1-seda.dayOfWeek() );//we are on monday | 1378 | seda = seda.addDays( 1-seda.dayOfWeek() );//we are on monday |
1379 | if ( seda.addDays(6).year() != seda.year() ) { | 1379 | if ( seda.addDays(6).year() != seda.year() ) { |
1380 | if ( seda.year() != d.year() ) { | 1380 | if ( seda.year() != d.year() ) { |
1381 | if ( d.dayOfWeek() > 4 ) | 1381 | if ( d.dayOfWeek() > 4 ) |
1382 | d = QDate ( seda.year(), 1,1); | 1382 | d = QDate ( seda.year(), 1,1); |
1383 | else | 1383 | else |
1384 | weekNum = 1; | 1384 | weekNum = 1; |
1385 | } else { | 1385 | } else { |
1386 | QDate dd( seda.year()+1, 1,1); | 1386 | QDate dd( seda.year()+1, 1,1); |
1387 | if ( dd.dayOfWeek() <= 4 ) | 1387 | if ( dd.dayOfWeek() <= 4 ) |
1388 | weekNum = 1; | 1388 | weekNum = 1; |
1389 | } | 1389 | } |
1390 | } | 1390 | } |
1391 | if ( weekNum == 0 ){ | 1391 | if ( weekNum == 0 ){ |
1392 | int dow = d.dayOfWeek(); | 1392 | int dow = d.dayOfWeek(); |
1393 | if ( dow <= 4 ) | 1393 | if ( dow <= 4 ) |
1394 | d = d.addDays( 1-dow ); | 1394 | d = d.addDays( 1-dow ); |
1395 | else // 5,6,7 | 1395 | else // 5,6,7 |
1396 | d = d.addDays( 8-dow ); | 1396 | d = d.addDays( 8-dow ); |
1397 | // we have the first week of the year.we are on monday | 1397 | // we have the first week of the year.we are on monday |
1398 | weekNum = d.daysTo( seda ) / 7 +1; | 1398 | weekNum = d.daysTo( seda ) / 7 +1; |
1399 | } | 1399 | } |
1400 | 1400 | ||
1401 | mWeekPixmap.fill( mWeekBgColor ); | 1401 | mWeekPixmap.fill( mWeekBgColor ); |
1402 | QPainter p ( &mWeekPixmap ); | 1402 | QPainter p ( &mWeekPixmap ); |
1403 | p.setFont( mWeekFont ); | 1403 | p.setFont( mWeekFont ); |
1404 | p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); | 1404 | p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); |
1405 | p.end(); | 1405 | p.end(); |
1406 | QIconSet icon3 ( mWeekPixmap ); | 1406 | QIconSet icon3 ( mWeekPixmap ); |
1407 | mWeekAction->setIconSet ( icon3 ); | 1407 | mWeekAction->setIconSet ( icon3 ); |
1408 | 1408 | ||
1409 | } | 1409 | } |
1410 | void MainWindow::updateWeekNum(const DateList &selectedDates) | 1410 | void MainWindow::updateWeekNum(const DateList &selectedDates) |
1411 | { | 1411 | { |
1412 | updateWeek( selectedDates.first() ); | 1412 | updateWeek( selectedDates.first() ); |
1413 | } | 1413 | } |
1414 | void MainWindow::processIncidenceSelection( Incidence *incidence ) | 1414 | void MainWindow::processIncidenceSelection( Incidence *incidence ) |
1415 | { | 1415 | { |
1416 | 1416 | ||
1417 | if ( !incidence ) { | 1417 | if ( !incidence ) { |
1418 | enableIncidenceActions( false ); | 1418 | enableIncidenceActions( false ); |
1419 | 1419 | ||
1420 | mNewSubTodoAction->setEnabled( false ); | 1420 | mNewSubTodoAction->setEnabled( false ); |
1421 | setCaptionToDates(); | 1421 | setCaptionToDates(); |
1422 | return; | 1422 | return; |
1423 | 1423 | ||
1424 | } | 1424 | } |
1425 | 1425 | ||
1426 | //KGlobal::locale()->formatDateTime(nextA, true); | 1426 | //KGlobal::locale()->formatDateTime(nextA, true); |
1427 | QString startString = ""; | 1427 | QString startString = ""; |
1428 | if ( incidence->type() != "Todo" ) { | 1428 | if ( incidence->type() != "Todo" ) { |
1429 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { | 1429 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { |
1430 | if ( incidence->doesFloat() ) { | 1430 | if ( incidence->doesFloat() ) { |
1431 | startString += ": "+incidence->dtStartDateStr( true ); | 1431 | startString += ": "+incidence->dtStartDateStr( true ); |
1432 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); | 1432 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); |
1433 | 1433 | ||
1434 | } else { | 1434 | } else { |
1435 | startString = ": "+incidence->dtStartStr(true); | 1435 | startString = ": "+incidence->dtStartStr(true); |
1436 | startString += " --- "+((Event*)incidence)->dtEndStr(true); | 1436 | startString += " --- "+((Event*)incidence)->dtEndStr(true); |
1437 | 1437 | ||
1438 | } | 1438 | } |
1439 | 1439 | ||
1440 | } else { | 1440 | } else { |
1441 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) | 1441 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) |
1442 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ | 1442 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ |
1443 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); | 1443 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); |
1444 | if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) { | 1444 | if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) { |
1445 | bool ok; | 1445 | bool ok; |
1446 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); | 1446 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); |
1447 | if ( ok ) { | 1447 | if ( ok ) { |
1448 | int years = noc.date().year() - incidence->dtStart().date().year(); | 1448 | int years = noc.date().year() - incidence->dtStart().date().year(); |
1449 | startString += i18n(" (%1 y.)"). arg( years ); | 1449 | startString += i18n(" (%1 y.)"). arg( years ); |
1450 | } | 1450 | } |
1451 | } | 1451 | } |
1452 | else | 1452 | else |
1453 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); | 1453 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); |
1454 | } | 1454 | } |
1455 | 1455 | ||
1456 | } | 1456 | } |
1457 | else | 1457 | else |
1458 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); | 1458 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); |
1459 | if ( !incidence->location().isEmpty() ) | 1459 | if ( !incidence->location().isEmpty() ) |
1460 | startString += " (" +incidence->location()+")"; | 1460 | startString += " (" +incidence->location()+")"; |
1461 | setCaption( incidence->summary()+startString); | 1461 | setCaption( incidence->summary()+startString); |
1462 | 1462 | ||
1463 | enableIncidenceActions( true ); | 1463 | enableIncidenceActions( true ); |
1464 | 1464 | ||
1465 | if ( incidence->type() == "Event" ) { | 1465 | if ( incidence->type() == "Event" ) { |
1466 | mShowAction->setText( i18n("Show Event...") ); | 1466 | mShowAction->setText( i18n("Show Event...") ); |
1467 | mEditAction->setText( i18n("Edit Event...") ); | 1467 | mEditAction->setText( i18n("Edit Event...") ); |
1468 | mDeleteAction->setText( i18n("Delete Event...") ); | 1468 | mDeleteAction->setText( i18n("Delete Event...") ); |
1469 | 1469 | ||
1470 | mNewSubTodoAction->setEnabled( false ); | 1470 | mNewSubTodoAction->setEnabled( false ); |
1471 | } else if ( incidence->type() == "Todo" ) { | 1471 | } else if ( incidence->type() == "Todo" ) { |
1472 | mShowAction->setText( i18n("Show Todo...") ); | 1472 | mShowAction->setText( i18n("Show Todo...") ); |
1473 | mEditAction->setText( i18n("Edit Todo...") ); | 1473 | mEditAction->setText( i18n("Edit Todo...") ); |
1474 | mDeleteAction->setText( i18n("Delete Todo...") ); | 1474 | mDeleteAction->setText( i18n("Delete Todo...") ); |
1475 | 1475 | ||
1476 | mNewSubTodoAction->setEnabled( true ); | 1476 | mNewSubTodoAction->setEnabled( true ); |
1477 | } else { | 1477 | } else { |
1478 | mShowAction->setText( i18n("Show...") ); | 1478 | mShowAction->setText( i18n("Show...") ); |
1479 | mShowAction->setText( i18n("Edit...") ); | 1479 | mShowAction->setText( i18n("Edit...") ); |
1480 | mShowAction->setText( i18n("Delete...") ); | 1480 | mShowAction->setText( i18n("Delete...") ); |
1481 | 1481 | ||
1482 | mNewSubTodoAction->setEnabled( false ); | 1482 | mNewSubTodoAction->setEnabled( false ); |
1483 | } | 1483 | } |
1484 | } | 1484 | } |
1485 | 1485 | ||
1486 | void MainWindow::enableIncidenceActions( bool enabled ) | 1486 | void MainWindow::enableIncidenceActions( bool enabled ) |
1487 | { | 1487 | { |
1488 | mShowAction->setEnabled( enabled ); | 1488 | mShowAction->setEnabled( enabled ); |
1489 | mEditAction->setEnabled( enabled ); | 1489 | mEditAction->setEnabled( enabled ); |
1490 | mDeleteAction->setEnabled( enabled ); | 1490 | mDeleteAction->setEnabled( enabled ); |
1491 | 1491 | ||
1492 | mCloneAction->setEnabled( enabled ); | 1492 | mCloneAction->setEnabled( enabled ); |
1493 | mMoveAction->setEnabled( enabled ); | 1493 | mMoveAction->setEnabled( enabled ); |
1494 | mBeamAction->setEnabled( enabled ); | 1494 | mBeamAction->setEnabled( enabled ); |
1495 | mCancelAction->setEnabled( enabled ); | 1495 | mCancelAction->setEnabled( enabled ); |
1496 | } | 1496 | } |
1497 | 1497 | ||
1498 | void MainWindow::importOL() | 1498 | void MainWindow::importOL() |
1499 | { | 1499 | { |
1500 | #ifdef _OL_IMPORT_ | 1500 | #ifdef _OL_IMPORT_ |
1501 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); | 1501 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); |
1502 | id->exec(); | 1502 | id->exec(); |
1503 | delete id; | 1503 | delete id; |
1504 | mView->updateView(); | 1504 | mView->updateView(); |
1505 | #endif | 1505 | #endif |
1506 | } | 1506 | } |
1507 | void MainWindow::importBday() | 1507 | void MainWindow::importBday() |
1508 | { | 1508 | { |
1509 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1509 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1510 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), | 1510 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), |
1511 | i18n("Import!"), i18n("Cancel"), 0, | 1511 | i18n("Import!"), i18n("Cancel"), 0, |
1512 | 0, 1 ); | 1512 | 0, 1 ); |
1513 | if ( result == 0 ) { | 1513 | if ( result == 0 ) { |
1514 | mView->importBday(); | 1514 | mView->importBday(); |
1515 | 1515 | ||
1516 | } | 1516 | } |
1517 | 1517 | ||
1518 | 1518 | ||
1519 | } | 1519 | } |
1520 | void MainWindow::importQtopia() | 1520 | void MainWindow::importQtopia() |
1521 | { | 1521 | { |
1522 | //#ifndef DESKTOP_VERSION | 1522 | //#ifndef DESKTOP_VERSION |
1523 | 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"); | 1523 | 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"); |
1524 | #ifdef DESKTOP_VERSION | 1524 | #ifdef DESKTOP_VERSION |
1525 | 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"); | 1525 | 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"); |
1526 | #endif | 1526 | #endif |
1527 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, | 1527 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, |
1528 | i18n("Import!"), i18n("Cancel"), 0, | 1528 | i18n("Import!"), i18n("Cancel"), 0, |
1529 | 0, 1 ); | 1529 | 0, 1 ); |
1530 | if ( result == 0 ) { | 1530 | if ( result == 0 ) { |
1531 | #ifndef DESKTOP_VERSION | 1531 | #ifndef DESKTOP_VERSION |
1532 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); | 1532 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); |
1533 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); | 1533 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); |
1534 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; | 1534 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; |
1535 | #else | 1535 | #else |
1536 | QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; | 1536 | QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; |
1537 | QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; | 1537 | QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; |
1538 | QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; | 1538 | QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; |
1539 | #endif | 1539 | #endif |
1540 | mView->importQtopia( categories, datebook, todolist ); | 1540 | mView->importQtopia( categories, datebook, todolist ); |
1541 | } | 1541 | } |
1542 | #if 0 | 1542 | #if 0 |