-rw-r--r-- | bin/kdepim/WhatsNew.txt | 9 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 18 | ||||
-rw-r--r-- | korganizer/mainwindow.h | 1 | ||||
-rw-r--r-- | libkdepim/ksyncmanager.cpp | 13 | ||||
-rw-r--r-- | libkdepim/ksyncmanager.h | 2 |
5 files changed, 34 insertions, 9 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index 65bb075..6ccf763 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt | |||
@@ -1,194 +1,203 @@ | |||
1 | Info about the changes in new versions of KDE-Pim/Pi | 1 | Info about the changes in new versions of KDE-Pim/Pi |
2 | 2 | ||
3 | ********** VERSION 2.0.6 ************ | ||
4 | |||
5 | Two bugfixes in the pi-sync mode. | ||
6 | KO/Pi: | ||
7 | Made the todolist using alternate background. | ||
8 | |||
9 | Other minor fixes in KO/Pi. | ||
10 | |||
11 | |||
3 | ********** VERSION 2.0.5 ************ | 12 | ********** VERSION 2.0.5 ************ |
4 | 13 | ||
5 | Bugfixes in KO/Pi. | 14 | Bugfixes in KO/Pi. |
6 | 15 | ||
7 | ********** VERSION 2.0.4 ************ | 16 | ********** VERSION 2.0.4 ************ |
8 | 17 | ||
9 | KO/Pi: | 18 | KO/Pi: |
10 | Fixed problem loading translations for summary/location edit boxes in event/todo editor. | 19 | Fixed problem loading translations for summary/location edit boxes in event/todo editor. |
11 | 20 | ||
12 | Added a general "select week number" to the toolbar. | 21 | Added a general "select week number" to the toolbar. |
13 | 22 | ||
14 | Fixed some small problem of the new features introduced in version 2.0.3. | 23 | Fixed some small problem of the new features introduced in version 2.0.3. |
15 | 24 | ||
16 | Made it possible to specify one specific category as category color, | 25 | Made it possible to specify one specific category as category color, |
17 | if more than one categories are selected. | 26 | if more than one categories are selected. |
18 | 27 | ||
19 | Fixed a bug in saving colors for categories with non-ascii characters. | 28 | Fixed a bug in saving colors for categories with non-ascii characters. |
20 | (Like, e.g. German Umlauts). | 29 | (Like, e.g. German Umlauts). |
21 | Propably you have to set your colors again for those categories. | 30 | Propably you have to set your colors again for those categories. |
22 | 31 | ||
23 | 32 | ||
24 | ********** VERSION 2.0.3 ************ | 33 | ********** VERSION 2.0.3 ************ |
25 | 34 | ||
26 | KO/Pi: | 35 | KO/Pi: |
27 | Added feature for changing alarm settings for many items at once: | 36 | Added feature for changing alarm settings for many items at once: |
28 | Open list view (or search dialog), select the desired items and choose in | 37 | Open list view (or search dialog), select the desired items and choose in |
29 | the popup menu: Set alarm for selected... | 38 | the popup menu: Set alarm for selected... |
30 | 39 | ||
31 | Added to the event/todo viewer the option to send an email to | 40 | Added to the event/todo viewer the option to send an email to |
32 | all attendees or all selected (with RSVP) attendees. | 41 | all attendees or all selected (with RSVP) attendees. |
33 | 42 | ||
34 | Made the week-month mode changing in month view faster. | 43 | Made the week-month mode changing in month view faster. |
35 | 44 | ||
36 | Made month view better useable with keyboard. | 45 | Made month view better useable with keyboard. |
37 | Now TAB key jumps to next cell with an event/todo. | 46 | Now TAB key jumps to next cell with an event/todo. |
38 | Scroll in cell with coursor keys, scroll in time (next week) with | 47 | Scroll in cell with coursor keys, scroll in time (next week) with |
39 | Shift/Control + coursorkeys. | 48 | Shift/Control + coursorkeys. |
40 | 49 | ||
41 | Fixed bug that the todo view flat mode was reset after first view update. | 50 | Fixed bug that the todo view flat mode was reset after first view update. |
42 | 51 | ||
43 | If a todo is displayed closed in the todo view, | 52 | If a todo is displayed closed in the todo view, |
44 | it is now displayed in overdue/due today color depending on the subtodos overdue/due today properties. | 53 | it is now displayed in overdue/due today color depending on the subtodos overdue/due today properties. |
45 | 54 | ||
46 | Added info about the numbers of years to the caption (title) information about a birthday event. | 55 | Added info about the numbers of years to the caption (title) information about a birthday event. |
47 | 56 | ||
48 | Made completion date in todo editor editable. | 57 | Made completion date in todo editor editable. |
49 | 58 | ||
50 | Added possibility to save/load templates for journals. | 59 | Added possibility to save/load templates for journals. |
51 | (Which is just a simple "save text to file" or "insert text from file". | 60 | (Which is just a simple "save text to file" or "insert text from file". |
52 | 61 | ||
53 | ********** VERSION 2.0.2 ************ | 62 | ********** VERSION 2.0.2 ************ |
54 | 63 | ||
55 | KO/Pi: | 64 | KO/Pi: |
56 | Fixed the layout problem of the day label buttons | 65 | Fixed the layout problem of the day label buttons |
57 | of the agenda view introduced in version 2.0.1. | 66 | of the agenda view introduced in version 2.0.1. |
58 | 67 | ||
59 | Added WhatsThis support for the todo view and the list view. | 68 | Added WhatsThis support for the todo view and the list view. |
60 | 69 | ||
61 | Added a quite useful feature to the montview. | 70 | Added a quite useful feature to the montview. |
62 | Just click on the week numbers on the left. | 71 | Just click on the week numbers on the left. |
63 | And in the top right corner of month view/agenda view | 72 | And in the top right corner of month view/agenda view |
64 | there is now a "week number quick selector". | 73 | there is now a "week number quick selector". |
65 | (Click on the black triangle). | 74 | (Click on the black triangle). |
66 | 75 | ||
67 | Made the quite difficult timezone change in KO/Pi easy. | 76 | Made the quite difficult timezone change in KO/Pi easy. |
68 | 77 | ||
69 | OM/Pi: | 78 | OM/Pi: |
70 | Fixed too small icons on desktop. | 79 | Fixed too small icons on desktop. |
71 | Fixed non visible icons in mainwindow on Z with fastload enabled. | 80 | Fixed non visible icons in mainwindow on Z with fastload enabled. |
72 | Added signature file setting to smtp account config. | 81 | Added signature file setting to smtp account config. |
73 | And the signature can be edited and saved in the edit mail dialog. | 82 | And the signature can be edited and saved in the edit mail dialog. |
74 | That does mean: | 83 | That does mean: |
75 | Simply edit the signature for the selected smtp account in the | 84 | Simply edit the signature for the selected smtp account in the |
76 | edit new mail dialog and press the "save signature" button there. | 85 | edit new mail dialog and press the "save signature" button there. |
77 | Then the signature is saved to the file specified in the smtp account settings. | 86 | Then the signature is saved to the file specified in the smtp account settings. |
78 | If there is no file specified, it is saved automatically to the file | 87 | If there is no file specified, it is saved automatically to the file |
79 | kdepim/apps/kopiemail/<accountname>.sig. | 88 | kdepim/apps/kopiemail/<accountname>.sig. |
80 | 89 | ||
81 | 90 | ||
82 | 91 | ||
83 | ********** VERSION 2.0.1 ************ | 92 | ********** VERSION 2.0.1 ************ |
84 | 93 | ||
85 | Oooops ... I forgot to test on the Zaurus 5500 ... | 94 | Oooops ... I forgot to test on the Zaurus 5500 ... |
86 | 95 | ||
87 | Fixed many problems of new (english) strings (and german translations) | 96 | Fixed many problems of new (english) strings (and german translations) |
88 | introduced in the latest versions, where the text was not fitting on the | 97 | introduced in the latest versions, where the text was not fitting on the |
89 | 240x320 display of the Zaurus 5500. | 98 | 240x320 display of the Zaurus 5500. |
90 | 99 | ||
91 | KO/Pi: | 100 | KO/Pi: |
92 | Added a popup menu ( press pen and hold to get popup ) to the agenda view | 101 | Added a popup menu ( press pen and hold to get popup ) to the agenda view |
93 | with many useful items (add event/todo, show next week, two weeks, month, journal). | 102 | with many useful items (add event/todo, show next week, two weeks, month, journal). |
94 | 103 | ||
95 | Added items to the todolist popup menu for: | 104 | Added items to the todolist popup menu for: |
96 | Display all opened, all closed or all todos flat. | 105 | Display all opened, all closed or all todos flat. |
97 | The "flat" view makes is possible to sort all todos after ,e.g., prio or date. | 106 | The "flat" view makes is possible to sort all todos after ,e.g., prio or date. |
98 | Made the reparenting of todos on the desktop possible via Drag&Drop. | 107 | Made the reparenting of todos on the desktop possible via Drag&Drop. |
99 | Fixed several bugs in setting the completed datetime for todos. | 108 | Fixed several bugs in setting the completed datetime for todos. |
100 | Added info about completed datetime of todos to the todo viewer. | 109 | Added info about completed datetime of todos to the todo viewer. |
101 | Now displaying a completed todo (with completed datetime set) in the agenda view | 110 | Now displaying a completed todo (with completed datetime set) in the agenda view |
102 | at the time of the completion. Such that now it is possible to see in the agenda view | 111 | at the time of the completion. Such that now it is possible to see in the agenda view |
103 | when what todo was completed. | 112 | when what todo was completed. |
104 | Fixed behaviour of automatic setting completion of todos with sub-todos/parent todos. | 113 | Fixed behaviour of automatic setting completion of todos with sub-todos/parent todos. |
105 | Now the behaviour is: | 114 | Now the behaviour is: |
106 | Setting a parent to complete sets all (sub)childs to complete. | 115 | Setting a parent to complete sets all (sub)childs to complete. |
107 | Setting a parent to uncomplete does not change the childs. | 116 | Setting a parent to uncomplete does not change the childs. |
108 | Setting a child to uncomplete sets all parent to uncomplete. | 117 | Setting a child to uncomplete sets all parent to uncomplete. |
109 | Setting a child to complete does not change the parents. | 118 | Setting a child to complete does not change the parents. |
110 | 119 | ||
111 | Smart updating and double buffering of the daymatrix. | 120 | Smart updating and double buffering of the daymatrix. |
112 | Showing holidays in the day matrix. | 121 | Showing holidays in the day matrix. |
113 | Many other small performance updates. | 122 | Many other small performance updates. |
114 | 123 | ||
115 | Made day labels in agenda clickable. By clicking a label, the day is displayed in single day mode. | 124 | Made day labels in agenda clickable. By clicking a label, the day is displayed in single day mode. |
116 | 125 | ||
117 | Now the translation file usertranslation.txt is supposed to be in utf8 format. | 126 | Now the translation file usertranslation.txt is supposed to be in utf8 format. |
118 | If you want to translate a language from western europe, just change the germantranslation.txt file. Please read the updated Usertranslation HowTo in KO/Pi Help menu. | 127 | If you want to translate a language from western europe, just change the germantranslation.txt file. Please read the updated Usertranslation HowTo in KO/Pi Help menu. |
119 | 128 | ||
120 | 129 | ||
121 | ********** VERSION 2.0.0 ************ | 130 | ********** VERSION 2.0.0 ************ |
122 | 131 | ||
123 | Stable release 2.0.0! | 132 | Stable release 2.0.0! |
124 | 133 | ||
125 | KO/Pi: | 134 | KO/Pi: |
126 | Fixed problem in edit dialog recreation at startup. | 135 | Fixed problem in edit dialog recreation at startup. |
127 | Made "toggle view*" menu items enabled context sensitive. | 136 | Made "toggle view*" menu items enabled context sensitive. |
128 | Changed agenda size menu to items 1-10. | 137 | Changed agenda size menu to items 1-10. |
129 | Made it possible to change agenda size quickly by pressing mouse on timelabels in agenda view and move mouse up/down. | 138 | Made it possible to change agenda size quickly by pressing mouse on timelabels in agenda view and move mouse up/down. |
130 | Usebility enhancements in the KO/Pi menus. | 139 | Usebility enhancements in the KO/Pi menus. |
131 | Birthday import now adds year to summary. | 140 | Birthday import now adds year to summary. |
132 | What's Next view shows age in years for birthday. | 141 | What's Next view shows age in years for birthday. |
133 | 142 | ||
134 | OM/Pi: | 143 | OM/Pi: |
135 | Added three info lines to display subject, from and to of selected mails. | 144 | Added three info lines to display subject, from and to of selected mails. |
136 | 145 | ||
137 | KA/Pi: | 146 | KA/Pi: |
138 | Fixed jump bar behaviour on Zaurus. | 147 | Fixed jump bar behaviour on Zaurus. |
139 | Now KA/Pi search field supports searching for a range of starting characters. | 148 | Now KA/Pi search field supports searching for a range of starting characters. |
140 | E.g. to search for all contact beginning with b to n, type | 149 | E.g. to search for all contact beginning with b to n, type |
141 | b-n | 150 | b-n |
142 | in the search field. | 151 | in the search field. |
143 | 152 | ||
144 | ********** VERSION 1.9.20 ************ | 153 | ********** VERSION 1.9.20 ************ |
145 | 154 | ||
146 | KO/Pi: | 155 | KO/Pi: |
147 | Added for the "dislplay one day" agenda mode | 156 | Added for the "dislplay one day" agenda mode |
148 | info in the caption and in the day lables: | 157 | info in the caption and in the day lables: |
149 | Now it is displayed, if the selected day is from "day before yesterday" | 158 | Now it is displayed, if the selected day is from "day before yesterday" |
150 | to "day after tomorrow". | 159 | to "day after tomorrow". |
151 | Made it possible to delete a Todo, which has sub-todos. | 160 | Made it possible to delete a Todo, which has sub-todos. |
152 | Fixed two small problems in the todo view. | 161 | Fixed two small problems in the todo view. |
153 | Added missing German translation for filter edit and print dialog. | 162 | Added missing German translation for filter edit and print dialog. |
154 | Made search dialog closeable by cancel key. | 163 | Made search dialog closeable by cancel key. |
155 | 164 | ||
156 | Made it possible to select in the date picker the (ligt grey ) | 165 | Made it possible to select in the date picker the (ligt grey ) |
157 | dates of the prev./next month with the mouse. | 166 | dates of the prev./next month with the mouse. |
158 | 167 | ||
159 | OM/Pi: | 168 | OM/Pi: |
160 | "Delete mail" icon in main window now deletes all selected mails. | 169 | "Delete mail" icon in main window now deletes all selected mails. |
161 | Fixed the problem, that the state flag of imap mails was ignored. | 170 | Fixed the problem, that the state flag of imap mails was ignored. |
162 | Now mails with "FLAG_SEEN" on the imap server get no icon in the list view | 171 | Now mails with "FLAG_SEEN" on the imap server get no icon in the list view |
163 | to indecate that they are already seen. | 172 | to indecate that they are already seen. |
164 | Fixed the problem that the body of some mails was not displayed in the | 173 | Fixed the problem that the body of some mails was not displayed in the |
165 | mail viewer when fetching them from the imap server directly to read them. | 174 | mail viewer when fetching them from the imap server directly to read them. |
166 | Made it (configurable) possible to show the "To:" field in the list view. | 175 | Made it (configurable) possible to show the "To:" field in the list view. |
167 | Added to the mail viewer the option "View Source" to make it possible to see the raw mail data. | 176 | Added to the mail viewer the option "View Source" to make it possible to see the raw mail data. |
168 | Added a "Download Mail" button to the mail viewer to quickly download the viewed mail to the | 177 | Added a "Download Mail" button to the mail viewer to quickly download the viewed mail to the |
169 | local storage folder (specified in account settings) of the account of the mail. | 178 | local storage folder (specified in account settings) of the account of the mail. |
170 | Removed some memory leaks in OM/Pi. | 179 | Removed some memory leaks in OM/Pi. |
171 | 180 | ||
172 | 181 | ||
173 | ********** VERSION 1.9.19 ************ | 182 | ********** VERSION 1.9.19 ************ |
174 | 183 | ||
175 | Added a lot of missing translations to KA/Pi, | 184 | Added a lot of missing translations to KA/Pi, |
176 | Added some missing translations to KO/Pi and OM/Pi. | 185 | Added some missing translations to KO/Pi and OM/Pi. |
177 | 186 | ||
178 | Fixed some minor problems in KA/Pi + KO/Pi. | 187 | Fixed some minor problems in KA/Pi + KO/Pi. |
179 | 188 | ||
180 | Fixed a crash when closing PwM/Pi. | 189 | Fixed a crash when closing PwM/Pi. |
181 | Added German translation for PwM/Pi. | 190 | Added German translation for PwM/Pi. |
182 | 191 | ||
183 | Made view change and Month View update faster in KO/Pi. | 192 | Made view change and Month View update faster in KO/Pi. |
184 | 193 | ||
185 | 194 | ||
186 | ********** VERSION 1.9.18 ************ | 195 | ********** VERSION 1.9.18 ************ |
187 | 196 | ||
188 | FYI: The VERSION 1.9.17 was a testing release only. | 197 | FYI: The VERSION 1.9.17 was a testing release only. |
189 | Please read the changelog of VERSION 1.9.17 as well. | 198 | Please read the changelog of VERSION 1.9.17 as well. |
190 | 199 | ||
191 | Cleaned up the syncing config dialog. | 200 | Cleaned up the syncing config dialog. |
192 | Added sync config options for date range for events. | 201 | Added sync config options for date range for events. |
193 | Added sync config options for filters on incoming data. | 202 | Added sync config options for filters on incoming data. |
194 | Added sync config options for filters on outgoing data. | 203 | Added sync config options for filters on outgoing data. |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 468fd5b..18a4b12 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -76,385 +76,385 @@ using namespace KCal; | |||
76 | class KOex2phonePrefs : public QDialog | 76 | class KOex2phonePrefs : public QDialog |
77 | { | 77 | { |
78 | public: | 78 | public: |
79 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : | 79 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : |
80 | QDialog( parent, name, true ) | 80 | QDialog( parent, name, true ) |
81 | { | 81 | { |
82 | setCaption( i18n("Export to phone options") ); | 82 | setCaption( i18n("Export to phone options") ); |
83 | QVBoxLayout* lay = new QVBoxLayout( this ); | 83 | QVBoxLayout* lay = new QVBoxLayout( this ); |
84 | lay->setSpacing( 3 ); | 84 | lay->setSpacing( 3 ); |
85 | lay->setMargin( 3 ); | 85 | lay->setMargin( 3 ); |
86 | QLabel *lab; | 86 | QLabel *lab; |
87 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); | 87 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); |
88 | lab->setAlignment (AlignHCenter ); | 88 | lab->setAlignment (AlignHCenter ); |
89 | QHBox* temphb; | 89 | QHBox* temphb; |
90 | temphb = new QHBox( this ); | 90 | temphb = new QHBox( this ); |
91 | new QLabel( i18n("I/O device: "), temphb ); | 91 | new QLabel( i18n("I/O device: "), temphb ); |
92 | mPhoneDevice = new QLineEdit( temphb); | 92 | mPhoneDevice = new QLineEdit( temphb); |
93 | lay->addWidget( temphb ); | 93 | lay->addWidget( temphb ); |
94 | temphb = new QHBox( this ); | 94 | temphb = new QHBox( this ); |
95 | new QLabel( i18n("Connection: "), temphb ); | 95 | new QLabel( i18n("Connection: "), temphb ); |
96 | mPhoneConnection = new QLineEdit( temphb); | 96 | mPhoneConnection = new QLineEdit( temphb); |
97 | lay->addWidget( temphb ); | 97 | lay->addWidget( temphb ); |
98 | temphb = new QHBox( this ); | 98 | temphb = new QHBox( this ); |
99 | new QLabel( i18n("Model(opt.): "), temphb ); | 99 | new QLabel( i18n("Model(opt.): "), temphb ); |
100 | mPhoneModel = new QLineEdit( temphb); | 100 | mPhoneModel = new QLineEdit( temphb); |
101 | lay->addWidget( temphb ); | 101 | lay->addWidget( temphb ); |
102 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); | 102 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); |
103 | mWriteBackFuture->setChecked( true ); | 103 | mWriteBackFuture->setChecked( true ); |
104 | lay->addWidget( mWriteBackFuture ); | 104 | lay->addWidget( mWriteBackFuture ); |
105 | temphb = new QHBox( this ); | 105 | temphb = new QHBox( this ); |
106 | new QLabel( i18n("Max. weeks in future: ") , temphb ); | 106 | new QLabel( i18n("Max. weeks in future: ") , temphb ); |
107 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); | 107 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); |
108 | mWriteBackFutureWeeks->setValue( 8 ); | 108 | mWriteBackFutureWeeks->setValue( 8 ); |
109 | lay->addWidget( temphb ); | 109 | lay->addWidget( temphb ); |
110 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); | 110 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); |
111 | lab->setAlignment (AlignHCenter ); | 111 | lab->setAlignment (AlignHCenter ); |
112 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); | 112 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); |
113 | lay->addWidget( ok ); | 113 | lay->addWidget( ok ); |
114 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 114 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
115 | lay->addWidget( cancel ); | 115 | lay->addWidget( cancel ); |
116 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 116 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
117 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 117 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
118 | resize( 220, 240 ); | 118 | resize( 220, 240 ); |
119 | qApp->processEvents(); | 119 | qApp->processEvents(); |
120 | int dw = QApplication::desktop()->width(); | 120 | int dw = QApplication::desktop()->width(); |
121 | int dh = QApplication::desktop()->height(); | 121 | int dh = QApplication::desktop()->height(); |
122 | move( (dw-width())/2, (dh - height() )/2 ); | 122 | move( (dw-width())/2, (dh - height() )/2 ); |
123 | } | 123 | } |
124 | 124 | ||
125 | public: | 125 | public: |
126 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; | 126 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; |
127 | QCheckBox* mWriteBackFuture; | 127 | QCheckBox* mWriteBackFuture; |
128 | QSpinBox* mWriteBackFutureWeeks; | 128 | QSpinBox* mWriteBackFutureWeeks; |
129 | }; | 129 | }; |
130 | 130 | ||
131 | int globalFlagBlockStartup; | 131 | int globalFlagBlockStartup; |
132 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | 132 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : |
133 | QMainWindow( parent, name ) | 133 | QMainWindow( parent, name ) |
134 | { | 134 | { |
135 | 135 | ||
136 | 136 | ||
137 | #ifdef DESKTOP_VERSION | 137 | #ifdef DESKTOP_VERSION |
138 | setFont( QFont("Arial"), 14 ); | 138 | setFont( QFont("Arial"), 14 ); |
139 | #endif | 139 | #endif |
140 | mClosed = false; | 140 | mClosed = false; |
141 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; | 141 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; |
142 | QString confFile = locateLocal("config","korganizerrc"); | 142 | QString confFile = locateLocal("config","korganizerrc"); |
143 | QFileInfo finf ( confFile ); | 143 | QFileInfo finf ( confFile ); |
144 | bool showWarning = !finf.exists(); | 144 | bool showWarning = !finf.exists(); |
145 | setIcon(SmallIcon( "ko24" ) ); | 145 | setIcon(SmallIcon( "ko24" ) ); |
146 | mBlockAtStartup = true; | 146 | mBlockAtStartup = true; |
147 | mFlagKeyPressed = false; | 147 | mFlagKeyPressed = false; |
148 | setCaption("KOrganizer/Pi"); | 148 | setCaption("KOrganizer/Pi"); |
149 | KOPrefs *p = KOPrefs::instance(); | 149 | KOPrefs *p = KOPrefs::instance(); |
150 | KPimGlobalPrefs::instance()->setGlobalConfig(); | 150 | KPimGlobalPrefs::instance()->setGlobalConfig(); |
151 | if ( p->mHourSize > 22 ) | 151 | if ( p->mHourSize > 22 ) |
152 | p->mHourSize = 22; | 152 | p->mHourSize = 22; |
153 | QMainWindow::ToolBarDock tbd; | 153 | QMainWindow::ToolBarDock tbd; |
154 | if ( p->mToolBarHor ) { | 154 | if ( p->mToolBarHor ) { |
155 | if ( p->mToolBarUp ) | 155 | if ( p->mToolBarUp ) |
156 | tbd = Bottom; | 156 | tbd = Bottom; |
157 | else | 157 | else |
158 | tbd = Top; | 158 | tbd = Top; |
159 | } | 159 | } |
160 | else { | 160 | else { |
161 | if ( p->mToolBarUp ) | 161 | if ( p->mToolBarUp ) |
162 | tbd = Right; | 162 | tbd = Right; |
163 | else | 163 | else |
164 | tbd = Left; | 164 | tbd = Left; |
165 | } | 165 | } |
166 | if ( KOPrefs::instance()->mUseAppColors ) | 166 | if ( KOPrefs::instance()->mUseAppColors ) |
167 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 167 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
168 | globalFlagBlockStartup = 1; | 168 | globalFlagBlockStartup = 1; |
169 | iconToolBar = new QPEToolBar( this ); | 169 | iconToolBar = new QPEToolBar( this ); |
170 | addToolBar (iconToolBar , tbd ); | 170 | addToolBar (iconToolBar , tbd ); |
171 | mCalendarModifiedFlag = false; | 171 | mCalendarModifiedFlag = false; |
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 ); |
220 | if (finfo.exists() ) { | 220 | if (finfo.exists() ) { |
221 | KMessageBox::information( this, message); | 221 | KMessageBox::information( this, message); |
222 | mView->openCalendar( oldFile ); | 222 | mView->openCalendar( oldFile ); |
223 | qApp->processEvents(); | 223 | qApp->processEvents(); |
224 | } | 224 | } |
225 | } | 225 | } |
226 | mView->saveCalendar( defaultFileName() ); | 226 | mView->saveCalendar( defaultFileName() ); |
227 | newFile = true; | 227 | newFile = true; |
228 | } | 228 | } |
229 | 229 | ||
230 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 230 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
231 | mView->openCalendar( defaultFileName() ); | 231 | mView->openCalendar( defaultFileName() ); |
232 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 232 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
233 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); | 233 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); |
234 | 234 | ||
235 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { | 235 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { |
236 | KOPrefs::instance()->setAllDefaults(); | 236 | KOPrefs::instance()->setAllDefaults(); |
237 | int count = mView->addCategories(); | 237 | int count = mView->addCategories(); |
238 | } | 238 | } |
239 | processIncidenceSelection( 0 ); | 239 | processIncidenceSelection( 0 ); |
240 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), | 240 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), |
241 | SLOT( processIncidenceSelection( Incidence * ) ) ); | 241 | SLOT( processIncidenceSelection( Incidence * ) ) ); |
242 | connect( mView, SIGNAL( modifiedChanged( bool ) ), | 242 | connect( mView, SIGNAL( modifiedChanged( bool ) ), |
243 | SLOT( slotModifiedChanged( bool ) ) ); | 243 | SLOT( slotModifiedChanged( bool ) ) ); |
244 | 244 | ||
245 | 245 | ||
246 | connect( mView, SIGNAL( tempDisableBR(bool) ), | 246 | connect( mView, SIGNAL( tempDisableBR(bool) ), |
247 | SLOT( disableBR(bool) ) ); | 247 | SLOT( disableBR(bool) ) ); |
248 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); | 248 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); |
249 | mView->setModified( false ); | 249 | mView->setModified( false ); |
250 | mBlockAtStartup = false; | 250 | mBlockAtStartup = false; |
251 | mView->setModified( false ); | 251 | mView->setModified( false ); |
252 | setCentralWidget( mView ); | 252 | setCentralWidget( mView ); |
253 | globalFlagBlockStartup = 0; | 253 | globalFlagBlockStartup = 0; |
254 | mView->show(); | 254 | mView->show(); |
255 | delete splash; | 255 | delete splash; |
256 | if ( newFile ) | 256 | if ( newFile ) |
257 | mView->updateConfig(); | 257 | mView->updateConfig(); |
258 | // qApp->processEvents(); | 258 | // qApp->processEvents(); |
259 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 259 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
260 | //fillSyncMenu(); | 260 | //fillSyncMenu(); |
261 | 261 | ||
262 | 262 | ||
263 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); | 263 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); |
264 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); | 264 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); |
265 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); | 265 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); |
266 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 266 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); |
267 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 267 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
268 | mSyncManager->setDefaultFileName( defaultFileName()); | 268 | mSyncManager->setDefaultFileName( sentSyncFile()); |
269 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); | 269 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); |
270 | mSyncManager->fillSyncMenu(); | 270 | mSyncManager->fillSyncMenu(); |
271 | 271 | ||
272 | 272 | ||
273 | 273 | ||
274 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); | 274 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); |
275 | if ( showWarning ) { | 275 | if ( showWarning ) { |
276 | KMessageBox::information( this, | 276 | KMessageBox::information( this, |
277 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); | 277 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); |
278 | qApp->processEvents(); | 278 | qApp->processEvents(); |
279 | mView->dialogManager()->showSyncOptions(); | 279 | mView->dialogManager()->showSyncOptions(); |
280 | } | 280 | } |
281 | 281 | ||
282 | //US listen for result adressed from Ka/Pi | 282 | //US listen for result adressed from Ka/Pi |
283 | #ifndef DESKTOP_VERSION | 283 | #ifndef DESKTOP_VERSION |
284 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 284 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
285 | #endif | 285 | #endif |
286 | #ifndef DESKTOP_VERSION | 286 | #ifndef DESKTOP_VERSION |
287 | infrared = 0; | 287 | infrared = 0; |
288 | #endif | 288 | #endif |
289 | updateWeek( mView->startDate() ); | 289 | updateWeek( mView->startDate() ); |
290 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), | 290 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), |
291 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); | 291 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); |
292 | mBRdisabled = false; | 292 | mBRdisabled = false; |
293 | //toggleBeamReceive(); | 293 | //toggleBeamReceive(); |
294 | } | 294 | } |
295 | MainWindow::~MainWindow() | 295 | MainWindow::~MainWindow() |
296 | { | 296 | { |
297 | //qDebug("MainWindow::~MainWindow() "); | 297 | //qDebug("MainWindow::~MainWindow() "); |
298 | //save toolbar location | 298 | //save toolbar location |
299 | delete mCalendar; | 299 | delete mCalendar; |
300 | delete mSyncManager; | 300 | delete mSyncManager; |
301 | #ifndef DESKTOP_VERSION | 301 | #ifndef DESKTOP_VERSION |
302 | if ( infrared ) | 302 | if ( infrared ) |
303 | delete infrared; | 303 | delete infrared; |
304 | #endif | 304 | #endif |
305 | 305 | ||
306 | 306 | ||
307 | } | 307 | } |
308 | 308 | ||
309 | void MainWindow::disableBR(bool b) | 309 | void MainWindow::disableBR(bool b) |
310 | { | 310 | { |
311 | #ifndef DESKTOP_VERSION | 311 | #ifndef DESKTOP_VERSION |
312 | if ( b ) { | 312 | if ( b ) { |
313 | if ( infrared ) { | 313 | if ( infrared ) { |
314 | toggleBeamReceive(); | 314 | toggleBeamReceive(); |
315 | mBRdisabled = true; | 315 | mBRdisabled = true; |
316 | } | 316 | } |
317 | mBRdisabled = true; | 317 | mBRdisabled = true; |
318 | } else { | 318 | } else { |
319 | if ( mBRdisabled ) { | 319 | if ( mBRdisabled ) { |
320 | mBRdisabled = false; | 320 | mBRdisabled = false; |
321 | //makes no sense,because other cal ap is probably running | 321 | //makes no sense,because other cal ap is probably running |
322 | // toggleBeamReceive(); | 322 | // toggleBeamReceive(); |
323 | } | 323 | } |
324 | } | 324 | } |
325 | #endif | 325 | #endif |
326 | 326 | ||
327 | } | 327 | } |
328 | bool MainWindow::beamReceiveEnabled() | 328 | bool MainWindow::beamReceiveEnabled() |
329 | { | 329 | { |
330 | #ifndef DESKTOP_VERSION | 330 | #ifndef DESKTOP_VERSION |
331 | return ( infrared != 0 ); | 331 | return ( infrared != 0 ); |
332 | #endif | 332 | #endif |
333 | return false; | 333 | return false; |
334 | } | 334 | } |
335 | 335 | ||
336 | void MainWindow::toggleBeamReceive() | 336 | void MainWindow::toggleBeamReceive() |
337 | { | 337 | { |
338 | if ( mBRdisabled ) | 338 | if ( mBRdisabled ) |
339 | return; | 339 | return; |
340 | #ifndef DESKTOP_VERSION | 340 | #ifndef DESKTOP_VERSION |
341 | if ( infrared ) { | 341 | if ( infrared ) { |
342 | qDebug("disable BeamReceive "); | 342 | qDebug("disable BeamReceive "); |
343 | delete infrared; | 343 | delete infrared; |
344 | infrared = 0; | 344 | infrared = 0; |
345 | brAction->setOn(false); | 345 | brAction->setOn(false); |
346 | return; | 346 | return; |
347 | } | 347 | } |
348 | qDebug("enable BeamReceive "); | 348 | qDebug("enable BeamReceive "); |
349 | brAction->setOn(true); | 349 | brAction->setOn(true); |
350 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; | 350 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; |
351 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); | 351 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); |
352 | #endif | 352 | #endif |
353 | } | 353 | } |
354 | void MainWindow::showMaximized () | 354 | void MainWindow::showMaximized () |
355 | { | 355 | { |
356 | #ifndef DESKTOP_VERSION | 356 | #ifndef DESKTOP_VERSION |
357 | if ( ! globalFlagBlockStartup ) | 357 | if ( ! globalFlagBlockStartup ) |
358 | if ( mClosed ) | 358 | if ( mClosed ) |
359 | mView->goToday(); | 359 | mView->goToday(); |
360 | #endif | 360 | #endif |
361 | QWidget::showMaximized () ; | 361 | QWidget::showMaximized () ; |
362 | mClosed = false; | 362 | mClosed = false; |
363 | } | 363 | } |
364 | void MainWindow::closeEvent( QCloseEvent* ce ) | 364 | void MainWindow::closeEvent( QCloseEvent* ce ) |
365 | { | 365 | { |
366 | 366 | ||
367 | 367 | ||
368 | 368 | ||
369 | if ( ! KOPrefs::instance()->mAskForQuit ) { | 369 | if ( ! KOPrefs::instance()->mAskForQuit ) { |
370 | saveOnClose(); | 370 | saveOnClose(); |
371 | mClosed = true; | 371 | mClosed = true; |
372 | ce->accept(); | 372 | ce->accept(); |
373 | return; | 373 | return; |
374 | 374 | ||
375 | } | 375 | } |
376 | 376 | ||
377 | switch( QMessageBox::information( this, "KO/Pi", | 377 | switch( QMessageBox::information( this, "KO/Pi", |
378 | i18n("Do you really want\nto close KO/Pi?"), | 378 | i18n("Do you really want\nto close KO/Pi?"), |
379 | i18n("Close"), i18n("No"), | 379 | i18n("Close"), i18n("No"), |
380 | 0, 0 ) ) { | 380 | 0, 0 ) ) { |
381 | case 0: | 381 | case 0: |
382 | saveOnClose(); | 382 | saveOnClose(); |
383 | mClosed = true; | 383 | mClosed = true; |
384 | ce->accept(); | 384 | ce->accept(); |
385 | break; | 385 | break; |
386 | case 1: | 386 | case 1: |
387 | ce->ignore(); | 387 | ce->ignore(); |
388 | break; | 388 | break; |
389 | case 2: | 389 | case 2: |
390 | 390 | ||
391 | default: | 391 | default: |
392 | break; | 392 | break; |
393 | } | 393 | } |
394 | 394 | ||
395 | 395 | ||
396 | } | 396 | } |
397 | 397 | ||
398 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) | 398 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) |
399 | { | 399 | { |
400 | QDataStream stream( data, IO_ReadOnly ); | 400 | QDataStream stream( data, IO_ReadOnly ); |
401 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); | 401 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); |
402 | //QString datamess; | 402 | //QString datamess; |
403 | //qDebug("message "); | 403 | //qDebug("message "); |
404 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); | 404 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); |
405 | 405 | ||
406 | if ( cmsg == "setDocument(QString)" ) { | 406 | if ( cmsg == "setDocument(QString)" ) { |
407 | QDataStream stream( data, IO_ReadOnly ); | 407 | QDataStream stream( data, IO_ReadOnly ); |
408 | QString fileName; | 408 | QString fileName; |
409 | stream >> fileName; | 409 | stream >> fileName; |
410 | //qDebug("filename %s ", fileName.latin1()); | 410 | //qDebug("filename %s ", fileName.latin1()); |
411 | showMaximized(); | 411 | showMaximized(); |
412 | raise(); | 412 | raise(); |
413 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; | 413 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; |
414 | mSyncManager->slotSyncMenu( 1002 ); | 414 | mSyncManager->slotSyncMenu( 1002 ); |
415 | return; | 415 | return; |
416 | } | 416 | } |
417 | 417 | ||
418 | if ( cmsg == "-writeFile" ) { | 418 | if ( cmsg == "-writeFile" ) { |
419 | // I made from the "-writeFile" an "-writeAlarm" | 419 | // I made from the "-writeFile" an "-writeAlarm" |
420 | mView->viewManager()->showWhatsNextView(); | 420 | mView->viewManager()->showWhatsNextView(); |
421 | mCalendar->checkAlarmForIncidence( 0, true); | 421 | mCalendar->checkAlarmForIncidence( 0, true); |
422 | showMaximized(); | 422 | showMaximized(); |
423 | raise(); | 423 | raise(); |
424 | return; | 424 | return; |
425 | 425 | ||
426 | } | 426 | } |
427 | if ( cmsg == "-writeFileSilent" ) { | 427 | if ( cmsg == "-writeFileSilent" ) { |
428 | // I made from the "-writeFile" an "-writeAlarm" | 428 | // I made from the "-writeFile" an "-writeAlarm" |
429 | // mView->viewManager()->showWhatsNextView(); | 429 | // mView->viewManager()->showWhatsNextView(); |
430 | mCalendar->checkAlarmForIncidence( 0, true); | 430 | mCalendar->checkAlarmForIncidence( 0, true); |
431 | //showMaximized(); | 431 | //showMaximized(); |
432 | //raise(); | 432 | //raise(); |
433 | hide(); | 433 | hide(); |
434 | return; | 434 | return; |
435 | } | 435 | } |
436 | if ( cmsg == "-newCountdown" ) { | 436 | if ( cmsg == "-newCountdown" ) { |
437 | qDebug("newCountdown "); | 437 | qDebug("newCountdown "); |
438 | 438 | ||
439 | } | 439 | } |
440 | QString msg ; | 440 | QString msg ; |
441 | QString allmsg = cmsg; | 441 | QString allmsg = cmsg; |
442 | while ( allmsg.length() > 0 ) { | 442 | while ( allmsg.length() > 0 ) { |
443 | int nextC = allmsg.find( "-", 1 ); | 443 | int nextC = allmsg.find( "-", 1 ); |
444 | if ( nextC == -1 ) { | 444 | if ( nextC == -1 ) { |
445 | msg = allmsg; | 445 | msg = allmsg; |
446 | allmsg = ""; | 446 | allmsg = ""; |
447 | } else{ | 447 | } else{ |
448 | msg = allmsg.left( nextC ); | 448 | msg = allmsg.left( nextC ); |
449 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); | 449 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); |
450 | } | 450 | } |
451 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); | 451 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); |
452 | if ( msg == "-newEvent" ) { | 452 | if ( msg == "-newEvent" ) { |
453 | mView->newEvent(); | 453 | mView->newEvent(); |
454 | } | 454 | } |
455 | if ( msg == "-newTodo" ) { | 455 | if ( msg == "-newTodo" ) { |
456 | mView->newTodo(); | 456 | mView->newTodo(); |
457 | 457 | ||
458 | } | 458 | } |
459 | if ( msg == "-showWN" ) { | 459 | if ( msg == "-showWN" ) { |
460 | mView->viewManager()->showWhatsNextView(); | 460 | mView->viewManager()->showWhatsNextView(); |
@@ -1803,264 +1803,276 @@ void MainWindow::configureToolBar( int item ) | |||
1803 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); | 1803 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); |
1804 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); | 1804 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); |
1805 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); | 1805 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); |
1806 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); | 1806 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); |
1807 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); | 1807 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); |
1808 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); | 1808 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); |
1809 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); | 1809 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); |
1810 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); | 1810 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); |
1811 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); | 1811 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); |
1812 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); | 1812 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); |
1813 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); | 1813 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); |
1814 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); | 1814 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); |
1815 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); | 1815 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); |
1816 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); | 1816 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); |
1817 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); | 1817 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); |
1818 | // initActions(); | 1818 | // initActions(); |
1819 | } | 1819 | } |
1820 | 1820 | ||
1821 | void MainWindow::setCaptionToDates() | 1821 | void MainWindow::setCaptionToDates() |
1822 | { | 1822 | { |
1823 | QString selDates; | 1823 | QString selDates; |
1824 | selDates = KGlobal::locale()->formatDate(mView->startDate(), true); | 1824 | selDates = KGlobal::locale()->formatDate(mView->startDate(), true); |
1825 | if (mView->startDate() < mView->endDate() ) | 1825 | if (mView->startDate() < mView->endDate() ) |
1826 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); | 1826 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); |
1827 | else { | 1827 | else { |
1828 | QString addString; | 1828 | QString addString; |
1829 | if ( mView->startDate() == QDateTime::currentDateTime().date() ) | 1829 | if ( mView->startDate() == QDateTime::currentDateTime().date() ) |
1830 | addString = i18n("Today"); | 1830 | addString = i18n("Today"); |
1831 | else if ( mView->startDate() == QDateTime::currentDateTime().date().addDays(1) ) | 1831 | else if ( mView->startDate() == QDateTime::currentDateTime().date().addDays(1) ) |
1832 | addString = i18n("Tomorrow"); | 1832 | addString = i18n("Tomorrow"); |
1833 | if ( !addString.isEmpty() ) | 1833 | if ( !addString.isEmpty() ) |
1834 | selDates = addString+", "+selDates ; | 1834 | selDates = addString+", "+selDates ; |
1835 | } | 1835 | } |
1836 | setCaption( i18n("Dates: ") + selDates ); | 1836 | setCaption( i18n("Dates: ") + selDates ); |
1837 | 1837 | ||
1838 | } | 1838 | } |
1839 | void MainWindow::showConfigureAgenda( ) | 1839 | void MainWindow::showConfigureAgenda( ) |
1840 | { | 1840 | { |
1841 | int iii; | 1841 | int iii; |
1842 | for ( iii = 1;iii<= 10 ;++iii ){ | 1842 | for ( iii = 1;iii<= 10 ;++iii ){ |
1843 | configureAgendaMenu->setItemChecked( (iii+1)*2, false ); | 1843 | configureAgendaMenu->setItemChecked( (iii+1)*2, false ); |
1844 | } | 1844 | } |
1845 | configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); | 1845 | configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); |
1846 | } | 1846 | } |
1847 | void MainWindow::configureAgenda( int item ) | 1847 | void MainWindow::configureAgenda( int item ) |
1848 | { | 1848 | { |
1849 | if ( KOPrefs::instance()->mHourSize == item ) | 1849 | if ( KOPrefs::instance()->mHourSize == item ) |
1850 | return; | 1850 | return; |
1851 | KOPrefs::instance()->mHourSize=item; | 1851 | KOPrefs::instance()->mHourSize=item; |
1852 | mView->viewManager()->agendaView()->updateConfig(); | 1852 | mView->viewManager()->agendaView()->updateConfig(); |
1853 | } | 1853 | } |
1854 | 1854 | ||
1855 | void MainWindow::saveCalendar() | 1855 | void MainWindow::saveCalendar() |
1856 | { | 1856 | { |
1857 | QString fn = KOPrefs::instance()->mLastSaveFile; | 1857 | QString fn = KOPrefs::instance()->mLastSaveFile; |
1858 | fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); | 1858 | fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); |
1859 | 1859 | ||
1860 | if ( fn == "" ) | 1860 | if ( fn == "" ) |
1861 | return; | 1861 | return; |
1862 | QFileInfo info; | 1862 | QFileInfo info; |
1863 | info.setFile( fn ); | 1863 | info.setFile( fn ); |
1864 | QString mes; | 1864 | QString mes; |
1865 | bool createbup = true; | 1865 | bool createbup = true; |
1866 | if ( info. exists() ) { | 1866 | if ( info. exists() ) { |
1867 | mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; | 1867 | mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; |
1868 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 1868 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
1869 | i18n("Overwrite!"), i18n("Cancel"), 0, | 1869 | i18n("Overwrite!"), i18n("Cancel"), 0, |
1870 | 0, 1 ); | 1870 | 0, 1 ); |
1871 | if ( result != 0 ) { | 1871 | if ( result != 0 ) { |
1872 | createbup = false; | 1872 | createbup = false; |
1873 | } | 1873 | } |
1874 | } | 1874 | } |
1875 | if ( createbup ) { | 1875 | if ( createbup ) { |
1876 | mView->saveCalendar( fn ); | 1876 | mView->saveCalendar( fn ); |
1877 | mes = i18n("KO/Pi:Saved %1").arg(fn); | 1877 | mes = i18n("KO/Pi:Saved %1").arg(fn); |
1878 | KOPrefs::instance()->mLastSaveFile = fn; | 1878 | KOPrefs::instance()->mLastSaveFile = fn; |
1879 | setCaption(mes); | 1879 | setCaption(mes); |
1880 | } | 1880 | } |
1881 | } | 1881 | } |
1882 | void MainWindow::loadCalendar() | 1882 | void MainWindow::loadCalendar() |
1883 | { | 1883 | { |
1884 | 1884 | ||
1885 | QString fn = KOPrefs::instance()->mLastLoadFile; | 1885 | QString fn = KOPrefs::instance()->mLastLoadFile; |
1886 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); | 1886 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); |
1887 | 1887 | ||
1888 | if ( fn == "" ) | 1888 | if ( fn == "" ) |
1889 | return; | 1889 | return; |
1890 | QFileInfo info; | 1890 | QFileInfo info; |
1891 | info.setFile( fn ); | 1891 | info.setFile( fn ); |
1892 | QString mess; | 1892 | QString mess; |
1893 | bool loadbup = true; | 1893 | bool loadbup = true; |
1894 | if ( info. exists() ) { | 1894 | if ( info. exists() ) { |
1895 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 1895 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
1896 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", | 1896 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", |
1897 | mess, | 1897 | mess, |
1898 | i18n("Load!"), i18n("Cancel"), 0, | 1898 | i18n("Load!"), i18n("Cancel"), 0, |
1899 | 0, 1 ); | 1899 | 0, 1 ); |
1900 | if ( result != 0 ) { | 1900 | if ( result != 0 ) { |
1901 | loadbup = false; | 1901 | loadbup = false; |
1902 | } | 1902 | } |
1903 | } else { | 1903 | } else { |
1904 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1904 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1905 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, | 1905 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, |
1906 | 0, 1 ); | 1906 | 0, 1 ); |
1907 | 1907 | ||
1908 | return; | 1908 | return; |
1909 | } | 1909 | } |
1910 | if ( loadbup ) { | 1910 | if ( loadbup ) { |
1911 | mView->openCalendar( fn ); | 1911 | mView->openCalendar( fn ); |
1912 | KOPrefs::instance()->mLastLoadFile = fn; | 1912 | KOPrefs::instance()->mLastLoadFile = fn; |
1913 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; | 1913 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; |
1914 | setCaption(mess); | 1914 | setCaption(mess); |
1915 | } | 1915 | } |
1916 | 1916 | ||
1917 | } | 1917 | } |
1918 | void MainWindow::quickImportIcal() | 1918 | void MainWindow::quickImportIcal() |
1919 | { | 1919 | { |
1920 | importFile( KOPrefs::instance()->mLastImportFile, false ); | 1920 | importFile( KOPrefs::instance()->mLastImportFile, false ); |
1921 | } | 1921 | } |
1922 | void MainWindow::importFile( QString fn, bool quick ) | 1922 | void MainWindow::importFile( QString fn, bool quick ) |
1923 | { | 1923 | { |
1924 | QFileInfo info; | 1924 | QFileInfo info; |
1925 | info.setFile( fn ); | 1925 | info.setFile( fn ); |
1926 | QString mess; | 1926 | QString mess; |
1927 | bool loadbup = true; | 1927 | bool loadbup = true; |
1928 | if ( !info. exists() ) { | 1928 | if ( !info. exists() ) { |
1929 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); | 1929 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); |
1930 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1930 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1931 | mess ); | 1931 | mess ); |
1932 | return; | 1932 | return; |
1933 | } | 1933 | } |
1934 | int result = 0; | 1934 | int result = 0; |
1935 | if ( !quick ) { | 1935 | if ( !quick ) { |
1936 | mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 1936 | mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
1937 | result = QMessageBox::warning( this, "KO/Pi: Warning!", | 1937 | result = QMessageBox::warning( this, "KO/Pi: Warning!", |
1938 | mess, | 1938 | mess, |
1939 | "Import", "Cancel", 0, | 1939 | "Import", "Cancel", 0, |
1940 | 0, 1 ); | 1940 | 0, 1 ); |
1941 | } | 1941 | } |
1942 | if ( result == 0 ) { | 1942 | if ( result == 0 ) { |
1943 | if ( mView->openCalendar( fn, true )) { | 1943 | if ( mView->openCalendar( fn, true )) { |
1944 | KOPrefs::instance()->mLastImportFile = fn; | 1944 | KOPrefs::instance()->mLastImportFile = fn; |
1945 | setCaption(i18n("Imported file successfully")); | 1945 | setCaption(i18n("Imported file successfully")); |
1946 | } else { | 1946 | } else { |
1947 | setCaption(i18n("Error importing file")); | 1947 | setCaption(i18n("Error importing file")); |
1948 | } | 1948 | } |
1949 | } | 1949 | } |
1950 | } | 1950 | } |
1951 | 1951 | ||
1952 | void MainWindow::importIcal() | 1952 | void MainWindow::importIcal() |
1953 | { | 1953 | { |
1954 | 1954 | ||
1955 | QString fn =KOPrefs::instance()->mLastImportFile; | 1955 | QString fn =KOPrefs::instance()->mLastImportFile; |
1956 | 1956 | ||
1957 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); | 1957 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); |
1958 | if ( fn == "" ) | 1958 | if ( fn == "" ) |
1959 | return; | 1959 | return; |
1960 | importFile( fn, true ); | 1960 | importFile( fn, true ); |
1961 | 1961 | ||
1962 | } | 1962 | } |
1963 | 1963 | ||
1964 | void MainWindow::exportVCalendar() | 1964 | void MainWindow::exportVCalendar() |
1965 | { | 1965 | { |
1966 | QString fn = KOPrefs::instance()->mLastVcalFile; | 1966 | QString fn = KOPrefs::instance()->mLastVcalFile; |
1967 | fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); | 1967 | fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); |
1968 | if ( fn == "" ) | 1968 | if ( fn == "" ) |
1969 | return; | 1969 | return; |
1970 | QFileInfo info; | 1970 | QFileInfo info; |
1971 | info.setFile( fn ); | 1971 | info.setFile( fn ); |
1972 | QString mes; | 1972 | QString mes; |
1973 | bool createbup = true; | 1973 | bool createbup = true; |
1974 | if ( info. exists() ) { | 1974 | if ( info. exists() ) { |
1975 | mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); | 1975 | mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); |
1976 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 1976 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
1977 | i18n("Overwrite!"), i18n("Cancel"), 0, | 1977 | i18n("Overwrite!"), i18n("Cancel"), 0, |
1978 | 0, 1 ); | 1978 | 0, 1 ); |
1979 | if ( result != 0 ) { | 1979 | if ( result != 0 ) { |
1980 | createbup = false; | 1980 | createbup = false; |
1981 | } | 1981 | } |
1982 | } | 1982 | } |
1983 | if ( createbup ) { | 1983 | if ( createbup ) { |
1984 | if ( mView->exportVCalendar( fn ) ) { | 1984 | if ( mView->exportVCalendar( fn ) ) { |
1985 | KOPrefs::instance()->mLastVcalFile = fn; | 1985 | KOPrefs::instance()->mLastVcalFile = fn; |
1986 | if ( fn.length() > 20 ) | 1986 | if ( fn.length() > 20 ) |
1987 | mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; | 1987 | mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; |
1988 | else | 1988 | else |
1989 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); | 1989 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); |
1990 | setCaption(mes); | 1990 | setCaption(mes); |
1991 | } | 1991 | } |
1992 | } | 1992 | } |
1993 | 1993 | ||
1994 | } | 1994 | } |
1995 | QString MainWindow::sentSyncFile() | ||
1996 | { | ||
1997 | #ifdef DESKTOP_VERSION | ||
1998 | return locateLocal( "tmp", "copysynccal.ics" ); | ||
1999 | #else | ||
2000 | return QString( "/tmp/copysynccal.ics" ); | ||
2001 | #endif | ||
2002 | } | ||
1995 | 2003 | ||
1996 | void MainWindow::syncFileRequest() | 2004 | void MainWindow::syncFileRequest() |
1997 | { | 2005 | { |
1998 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { | 2006 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { |
1999 | mSyncManager->slotSyncMenu( 999 ); | 2007 | mSyncManager->slotSyncMenu( 999 ); |
2000 | } | 2008 | } |
2001 | save(); | 2009 | |
2010 | setCaption(i18n("Saving Data to temp file ..." )); | ||
2011 | mView->saveCalendar( sentSyncFile() ); | ||
2012 | setCaption(i18n("Data saved to temp file!" )); | ||
2013 | |||
2002 | } | 2014 | } |
2003 | void MainWindow::getFile( bool success ) | 2015 | void MainWindow::getFile( bool success ) |
2004 | { | 2016 | { |
2005 | if ( ! success ) { | 2017 | if ( ! success ) { |
2006 | setCaption( i18n("Error receiving file. Nothing changed!") ); | 2018 | setCaption( i18n("Error receiving file. Nothing changed!") ); |
2007 | return; | 2019 | return; |
2008 | } | 2020 | } |
2009 | mView->openCalendar( defaultFileName() ); | 2021 | mView->openCalendar( sentSyncFile() ); |
2010 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { | 2022 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { |
2011 | mSyncManager->slotSyncMenu( 999 ); | 2023 | mSyncManager->slotSyncMenu( 999 ); |
2012 | } | 2024 | } |
2013 | setCaption( i18n("Pi-Sync successful!") ); | 2025 | setCaption( i18n("Pi-Sync successful!") ); |
2014 | } | 2026 | } |
2015 | 2027 | ||
2016 | void MainWindow::printSel( ) | 2028 | void MainWindow::printSel( ) |
2017 | { | 2029 | { |
2018 | mView->viewManager()->agendaView()->agenda()->printSelection(); | 2030 | mView->viewManager()->agendaView()->agenda()->printSelection(); |
2019 | } | 2031 | } |
2020 | 2032 | ||
2021 | void MainWindow::printCal() | 2033 | void MainWindow::printCal() |
2022 | { | 2034 | { |
2023 | mView->print();//mCp->showDialog(); | 2035 | mView->print();//mCp->showDialog(); |
2024 | } | 2036 | } |
2025 | 2037 | ||
2026 | 2038 | ||
2027 | #include "libkdepim/kdatepicker.h" | 2039 | #include "libkdepim/kdatepicker.h" |
2028 | #include <kdatetbl.h> | 2040 | #include <kdatetbl.h> |
2029 | void MainWindow::weekAction() | 2041 | void MainWindow::weekAction() |
2030 | { | 2042 | { |
2031 | int month; | 2043 | int month; |
2032 | KPopupFrame* popup = new KPopupFrame(this); | 2044 | KPopupFrame* popup = new KPopupFrame(this); |
2033 | KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); | 2045 | KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); |
2034 | // ----- | 2046 | // ----- |
2035 | picker->resize(picker->sizeHint()); | 2047 | picker->resize(picker->sizeHint()); |
2036 | popup->setMainWidget(picker); | 2048 | popup->setMainWidget(picker); |
2037 | picker->setFocus(); | 2049 | picker->setFocus(); |
2038 | connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); | 2050 | connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); |
2039 | int x = 0; | 2051 | int x = 0; |
2040 | int y = iconToolBar->height(); | 2052 | int y = iconToolBar->height(); |
2041 | int dX = 0; | 2053 | int dX = 0; |
2042 | int dY = 0; | 2054 | int dY = 0; |
2043 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 2055 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
2044 | if ( iconToolBar->y() > height()/2 ) { | 2056 | if ( iconToolBar->y() > height()/2 ) { |
2045 | dY = picker->sizeHint().height()+8; | 2057 | dY = picker->sizeHint().height()+8; |
2046 | y = 0; | 2058 | y = 0; |
2047 | } | 2059 | } |
2048 | } else { | 2060 | } else { |
2049 | if ( iconToolBar->x() > width()/2 ) { // right side | 2061 | if ( iconToolBar->x() > width()/2 ) { // right side |
2050 | x=0; | 2062 | x=0; |
2051 | dX= picker->sizeHint().width()+8; | 2063 | dX= picker->sizeHint().width()+8; |
2052 | y = 0; | 2064 | y = 0; |
2053 | } else { | 2065 | } else { |
2054 | x= iconToolBar->width(); | 2066 | x= iconToolBar->width(); |
2055 | y = 0; | 2067 | y = 0; |
2056 | } | 2068 | } |
2057 | } | 2069 | } |
2058 | //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); | 2070 | //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); |
2059 | if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) | 2071 | if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) |
2060 | { | 2072 | { |
2061 | month = picker->getResult(); | 2073 | month = picker->getResult(); |
2062 | emit selectWeek ( month ); | 2074 | emit selectWeek ( month ); |
2063 | //qDebug("weekSelected %d ", month); | 2075 | //qDebug("weekSelected %d ", month); |
2064 | } | 2076 | } |
2065 | delete popup; | 2077 | delete popup; |
2066 | } | 2078 | } |
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h index 5b9f903..5808700 100644 --- a/korganizer/mainwindow.h +++ b/korganizer/mainwindow.h | |||
@@ -1,158 +1,159 @@ | |||
1 | #ifndef KORGE_MAINWINDOW_H | 1 | #ifndef KORGE_MAINWINDOW_H |
2 | #define KORGE_MAINWINDOW_H | 2 | #define KORGE_MAINWINDOW_H |
3 | 3 | ||
4 | #include <qmainwindow.h> | 4 | #include <qmainwindow.h> |
5 | #include <qtimer.h> | 5 | #include <qtimer.h> |
6 | #include <qdict.h> | 6 | #include <qdict.h> |
7 | #include <qfile.h> | 7 | #include <qfile.h> |
8 | #include <qmenubar.h> | 8 | #include <qmenubar.h> |
9 | #include <qtextstream.h> | 9 | #include <qtextstream.h> |
10 | #include <qregexp.h> | 10 | #include <qregexp.h> |
11 | 11 | ||
12 | #include <libkcal/incidence.h> | 12 | #include <libkcal/incidence.h> |
13 | #include "simplealarmclient.h" | 13 | #include "simplealarmclient.h" |
14 | #include <ksyncmanager.h> | 14 | #include <ksyncmanager.h> |
15 | #ifndef DESKTOP_VERSION | 15 | #ifndef DESKTOP_VERSION |
16 | #include <qcopchannel_qws.h> | 16 | #include <qcopchannel_qws.h> |
17 | #endif | 17 | #endif |
18 | class QAction; | 18 | class QAction; |
19 | class CalendarView; | 19 | class CalendarView; |
20 | class KSyncProfile; | 20 | class KSyncProfile; |
21 | #ifdef DESKTOP_VERSION | 21 | #ifdef DESKTOP_VERSION |
22 | 22 | ||
23 | #define QPEToolBar QToolBar | 23 | #define QPEToolBar QToolBar |
24 | #define QPEMenuBar QMenuBar | 24 | #define QPEMenuBar QMenuBar |
25 | #endif | 25 | #endif |
26 | class QPEToolBar; | 26 | class QPEToolBar; |
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 | 33 | class KOMenuBar : public QMenuBar |
34 | { | 34 | { |
35 | public: | 35 | public: |
36 | KOMenuBar( QWidget *parent=0 ): QMenuBar (parent ) {;} | 36 | KOMenuBar( QWidget *parent=0 ): QMenuBar (parent ) {;} |
37 | QSize sizeHint () const{ qDebug("sizejint ");return QSize ( 40,25 );} | 37 | QSize sizeHint () const{ qDebug("sizejint ");return QSize ( 40,25 );} |
38 | }; | 38 | }; |
39 | 39 | ||
40 | using namespace KCal; | 40 | using namespace KCal; |
41 | 41 | ||
42 | class MainWindow : public QMainWindow | 42 | class MainWindow : public QMainWindow |
43 | { | 43 | { |
44 | Q_OBJECT | 44 | Q_OBJECT |
45 | public: | 45 | public: |
46 | MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); | 46 | MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); |
47 | ~MainWindow(); | 47 | ~MainWindow(); |
48 | bool beamReceiveEnabled(); | 48 | bool beamReceiveEnabled(); |
49 | static QString defaultFileName(); | 49 | static QString defaultFileName(); |
50 | static QString syncFileName(); | 50 | static QString syncFileName(); |
51 | static QString resourcePath(); | 51 | static QString resourcePath(); |
52 | public slots: | 52 | public slots: |
53 | void updateWeekNum(const KCal::DateList &); | 53 | void updateWeekNum(const KCal::DateList &); |
54 | void updateWeek(QDate); | 54 | void updateWeek(QDate); |
55 | virtual void showMaximized (); | 55 | virtual void showMaximized (); |
56 | void configureAgenda( int ); | 56 | void configureAgenda( int ); |
57 | void recieve( const QCString& msg, const QByteArray& data ); | 57 | void recieve( const QCString& msg, const QByteArray& data ); |
58 | protected slots: | 58 | protected slots: |
59 | void setCaptionToDates(); | 59 | void setCaptionToDates(); |
60 | void weekAction(); | 60 | void weekAction(); |
61 | void about(); | 61 | void about(); |
62 | void licence(); | 62 | void licence(); |
63 | void faq(); | 63 | void faq(); |
64 | void usertrans(); | 64 | void usertrans(); |
65 | void features(); | 65 | void features(); |
66 | void synchowto(); | 66 | void synchowto(); |
67 | void kdesynchowto(); | 67 | void kdesynchowto(); |
68 | void multisynchowto(); | 68 | void multisynchowto(); |
69 | void whatsNew(); | 69 | void whatsNew(); |
70 | void keyBindings(); | 70 | void keyBindings(); |
71 | void aboutAutoSaving();; | 71 | void aboutAutoSaving();; |
72 | void aboutKnownBugs(); | 72 | void aboutKnownBugs(); |
73 | 73 | ||
74 | void processIncidenceSelection( Incidence * ); | 74 | void processIncidenceSelection( Incidence * ); |
75 | 75 | ||
76 | void importQtopia(); | 76 | void importQtopia(); |
77 | void importBday(); | 77 | void importBday(); |
78 | void importOL(); | 78 | void importOL(); |
79 | void importIcal(); | 79 | void importIcal(); |
80 | void importFile( QString, bool ); | 80 | void importFile( QString, bool ); |
81 | void quickImportIcal(); | 81 | void quickImportIcal(); |
82 | 82 | ||
83 | void slotModifiedChanged( bool ); | 83 | void slotModifiedChanged( bool ); |
84 | 84 | ||
85 | void save(); | 85 | void save(); |
86 | void saveStopTimer(); | 86 | void saveStopTimer(); |
87 | void configureToolBar( int ); | 87 | void configureToolBar( int ); |
88 | void printSel(); | 88 | void printSel(); |
89 | void printCal(); | 89 | void printCal(); |
90 | void saveCalendar(); | 90 | void saveCalendar(); |
91 | void loadCalendar(); | 91 | void loadCalendar(); |
92 | void exportVCalendar(); | 92 | void exportVCalendar(); |
93 | void fillFilterMenu(); | 93 | void fillFilterMenu(); |
94 | void selectFilter( int ); | 94 | void selectFilter( int ); |
95 | void exportToPhone( int ); | 95 | void exportToPhone( int ); |
96 | void toggleBeamReceive(); | 96 | void toggleBeamReceive(); |
97 | void disableBR(bool); | 97 | void disableBR(bool); |
98 | signals: | 98 | signals: |
99 | void selectWeek ( int ); | 99 | void selectWeek ( int ); |
100 | private slots: | 100 | private slots: |
101 | void showConfigureAgenda(); | 101 | void showConfigureAgenda(); |
102 | void getFile( bool ); | 102 | void getFile( bool ); |
103 | void syncFileRequest(); | 103 | void syncFileRequest(); |
104 | 104 | ||
105 | protected: | 105 | protected: |
106 | QString sentSyncFile(); | ||
106 | void displayText( QString, QString); | 107 | void displayText( QString, QString); |
107 | void enableIncidenceActions( bool ); | 108 | void enableIncidenceActions( bool ); |
108 | 109 | ||
109 | private: | 110 | private: |
110 | bool mBRdisabled; | 111 | bool mBRdisabled; |
111 | #ifndef DESKTOP_VERSION | 112 | #ifndef DESKTOP_VERSION |
112 | QCopChannel* infrared; | 113 | QCopChannel* infrared; |
113 | #endif | 114 | #endif |
114 | QAction* brAction; | 115 | QAction* brAction; |
115 | KSyncManager* mSyncManager; | 116 | KSyncManager* mSyncManager; |
116 | bool mClosed; | 117 | bool mClosed; |
117 | void saveOnClose(); | 118 | void saveOnClose(); |
118 | bool mFlagKeyPressed; | 119 | bool mFlagKeyPressed; |
119 | bool mBlockAtStartup; | 120 | bool mBlockAtStartup; |
120 | QPEToolBar *iconToolBar; | 121 | QPEToolBar *iconToolBar; |
121 | void initActions(); | 122 | void initActions(); |
122 | void setDefaultPreferences(); | 123 | void setDefaultPreferences(); |
123 | void keyPressEvent ( QKeyEvent * ) ; | 124 | void keyPressEvent ( QKeyEvent * ) ; |
124 | void keyReleaseEvent ( QKeyEvent * ) ; | 125 | void keyReleaseEvent ( QKeyEvent * ) ; |
125 | QPopupMenu *configureToolBarMenu; | 126 | QPopupMenu *configureToolBarMenu; |
126 | QPopupMenu *selectFilterMenu; | 127 | QPopupMenu *selectFilterMenu; |
127 | QPopupMenu *configureAgendaMenu, *syncMenu; | 128 | QPopupMenu *configureAgendaMenu, *syncMenu; |
128 | CalendarLocal *mCalendar; | 129 | CalendarLocal *mCalendar; |
129 | CalendarView *mView; | 130 | CalendarView *mView; |
130 | QAction *mNewSubTodoAction; | 131 | QAction *mNewSubTodoAction; |
131 | QAction *mWeekAction; | 132 | QAction *mWeekAction; |
132 | QFont mWeekFont; | 133 | QFont mWeekFont; |
133 | QPixmap mWeekPixmap; | 134 | QPixmap mWeekPixmap; |
134 | QColor mWeekBgColor; | 135 | QColor mWeekBgColor; |
135 | 136 | ||
136 | QAction *mShowAction; | 137 | QAction *mShowAction; |
137 | QAction *mEditAction; | 138 | QAction *mEditAction; |
138 | QAction *mDeleteAction; | 139 | QAction *mDeleteAction; |
139 | QAction *mCloneAction; | 140 | QAction *mCloneAction; |
140 | QAction *mMoveAction; | 141 | QAction *mMoveAction; |
141 | QAction *mBeamAction; | 142 | QAction *mBeamAction; |
142 | QAction *mCancelAction; | 143 | QAction *mCancelAction; |
143 | 144 | ||
144 | QAction *mToggleNav; | 145 | QAction *mToggleNav; |
145 | QAction *mToggleFilter; | 146 | QAction *mToggleFilter; |
146 | QAction *mToggleAllday; | 147 | QAction *mToggleAllday; |
147 | 148 | ||
148 | 149 | ||
149 | void closeEvent( QCloseEvent* ce ); | 150 | void closeEvent( QCloseEvent* ce ); |
150 | SimpleAlarmClient mAlarmClient; | 151 | SimpleAlarmClient mAlarmClient; |
151 | QTimer mSaveTimer; | 152 | QTimer mSaveTimer; |
152 | //bool mBlockSaveFlag; | 153 | //bool mBlockSaveFlag; |
153 | bool mCalendarModifiedFlag; | 154 | bool mCalendarModifiedFlag; |
154 | QPixmap loadPixmap( QString ); | 155 | QPixmap loadPixmap( QString ); |
155 | }; | 156 | }; |
156 | 157 | ||
157 | 158 | ||
158 | #endif | 159 | #endif |
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index 9177f63..c8d0e0d 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp | |||
@@ -1,607 +1,610 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KDE-Pim/Pi. | 2 | This file is part of KDE-Pim/Pi. |
3 | Copyright (c) 2004 Ulf Schenk | 3 | Copyright (c) 2004 Ulf Schenk |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | // $Id$ | 21 | // $Id$ |
22 | 22 | ||
23 | #include "ksyncmanager.h" | 23 | #include "ksyncmanager.h" |
24 | 24 | ||
25 | #include <stdlib.h> | 25 | #include <stdlib.h> |
26 | 26 | ||
27 | #ifndef _WIN32_ | 27 | #ifndef _WIN32_ |
28 | #include <unistd.h> | 28 | #include <unistd.h> |
29 | #endif | 29 | #endif |
30 | 30 | ||
31 | 31 | ||
32 | #include "ksyncprofile.h" | 32 | #include "ksyncprofile.h" |
33 | #include "ksyncprefsdialog.h" | 33 | #include "ksyncprefsdialog.h" |
34 | #include "kpimprefs.h" | 34 | #include "kpimprefs.h" |
35 | #include <kmessagebox.h> | 35 | #include <kmessagebox.h> |
36 | 36 | ||
37 | #include <qdir.h> | 37 | #include <qdir.h> |
38 | #include <qprogressbar.h> | 38 | #include <qprogressbar.h> |
39 | #include <qpopupmenu.h> | 39 | #include <qpopupmenu.h> |
40 | #include <qpushbutton.h> | 40 | #include <qpushbutton.h> |
41 | #include <qradiobutton.h> | 41 | #include <qradiobutton.h> |
42 | #include <qbuttongroup.h> | 42 | #include <qbuttongroup.h> |
43 | #include <qtimer.h> | 43 | #include <qtimer.h> |
44 | #include <qmessagebox.h> | 44 | #include <qmessagebox.h> |
45 | #include <qapplication.h> | 45 | #include <qapplication.h> |
46 | #include <qlineedit.h> | 46 | #include <qlineedit.h> |
47 | #include <qdialog.h> | 47 | #include <qdialog.h> |
48 | #include <qlayout.h> | 48 | #include <qlayout.h> |
49 | #include <qtextcodec.h> | 49 | #include <qtextcodec.h> |
50 | #include <qlabel.h> | 50 | #include <qlabel.h> |
51 | #include <qcheckbox.h> | 51 | #include <qcheckbox.h> |
52 | 52 | ||
53 | #include <klocale.h> | 53 | #include <klocale.h> |
54 | #include <kglobal.h> | 54 | #include <kglobal.h> |
55 | #include <kconfig.h> | 55 | #include <kconfig.h> |
56 | #include <kfiledialog.h> | 56 | #include <kfiledialog.h> |
57 | 57 | ||
58 | QDateTime KSyncManager::mRequestedSyncEvent; | 58 | QDateTime KSyncManager::mRequestedSyncEvent; |
59 | 59 | ||
60 | 60 | ||
61 | KSyncManager::KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu) | 61 | KSyncManager::KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu) |
62 | : QObject(), mPrefs(prefs ), mParent(parent),mImplementation(implementation), mTargetApp(ta), mSyncMenu(syncmenu) | 62 | : QObject(), mPrefs(prefs ), mParent(parent),mImplementation(implementation), mTargetApp(ta), mSyncMenu(syncmenu) |
63 | { | 63 | { |
64 | mServerSocket = 0; | 64 | mServerSocket = 0; |
65 | bar = new QProgressBar ( 1, 0 ); | 65 | bar = new QProgressBar ( 1, 0 ); |
66 | bar->setCaption (""); | 66 | bar->setCaption (""); |
67 | mWriteBackInPast = 2; | 67 | mWriteBackInPast = 2; |
68 | int w = 300; | 68 | int w = 300; |
69 | if ( QApplication::desktop()->width() < 320 ) | 69 | if ( QApplication::desktop()->width() < 320 ) |
70 | w = 220; | 70 | w = 220; |
71 | int h = bar->sizeHint().height() ; | 71 | int h = bar->sizeHint().height() ; |
72 | int dw = QApplication::desktop()->width(); | 72 | int dw = QApplication::desktop()->width(); |
73 | int dh = QApplication::desktop()->height(); | 73 | int dh = QApplication::desktop()->height(); |
74 | bar->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 74 | bar->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
75 | if ( mPrefs->mPassiveSyncAutoStart ) | ||
76 | enableQuick( false ); | ||
77 | 75 | ||
78 | } | 76 | } |
79 | 77 | ||
80 | KSyncManager::~KSyncManager() | 78 | KSyncManager::~KSyncManager() |
81 | { | 79 | { |
82 | delete bar; | 80 | delete bar; |
83 | } | 81 | } |
84 | 82 | ||
83 | void KSyncManager::setDefaultFileName( QString s) | ||
84 | { | ||
85 | mDefFileName = s ; | ||
86 | if ( mPrefs->mPassiveSyncAutoStart ) | ||
87 | enableQuick( false ); | ||
88 | } | ||
85 | 89 | ||
86 | void KSyncManager::fillSyncMenu() | 90 | void KSyncManager::fillSyncMenu() |
87 | { | 91 | { |
88 | if ( mSyncMenu->count() ) | 92 | if ( mSyncMenu->count() ) |
89 | mSyncMenu->clear(); | 93 | mSyncMenu->clear(); |
90 | 94 | ||
91 | mSyncMenu->insertItem( i18n("Configure..."), 0 ); | 95 | mSyncMenu->insertItem( i18n("Configure..."), 0 ); |
92 | mSyncMenu->insertSeparator(); | 96 | mSyncMenu->insertSeparator(); |
93 | QPopupMenu *clearMenu = new QPopupMenu ( mSyncMenu ); | 97 | QPopupMenu *clearMenu = new QPopupMenu ( mSyncMenu ); |
94 | mSyncMenu->insertItem( i18n("Remove sync info"),clearMenu, 5000 ); | 98 | mSyncMenu->insertItem( i18n("Remove sync info"),clearMenu, 5000 ); |
95 | clearMenu->insertItem( i18n("For all profiles"), 1 ); | 99 | clearMenu->insertItem( i18n("For all profiles"), 1 ); |
96 | clearMenu->insertSeparator(); | 100 | clearMenu->insertSeparator(); |
97 | connect ( clearMenu, SIGNAL( activated ( int ) ), this, SLOT (slotClearMenu( int ) ) ); | 101 | connect ( clearMenu, SIGNAL( activated ( int ) ), this, SLOT (slotClearMenu( int ) ) ); |
98 | mSyncMenu->insertSeparator(); | 102 | mSyncMenu->insertSeparator(); |
99 | if ( mServerSocket == 0 ) { | 103 | if ( mServerSocket == 0 ) { |
100 | mSyncMenu->insertItem( i18n("Enable Pi-Sync"), 2 ); | 104 | mSyncMenu->insertItem( i18n("Enable Pi-Sync"), 2 ); |
101 | } else { | 105 | } else { |
102 | mSyncMenu->insertItem( i18n("Disable Pi-Sync"), 3 ); | 106 | mSyncMenu->insertItem( i18n("Disable Pi-Sync"), 3 ); |
103 | } | 107 | } |
104 | mSyncMenu->insertSeparator(); | 108 | mSyncMenu->insertSeparator(); |
105 | mSyncMenu->insertItem( i18n("Multiple sync"), 1 ); | 109 | mSyncMenu->insertItem( i18n("Multiple sync"), 1 ); |
106 | mSyncMenu->insertSeparator(); | 110 | mSyncMenu->insertSeparator(); |
107 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); | 111 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); |
108 | config.setGroup("General"); | 112 | config.setGroup("General"); |
109 | QStringList prof = config.readListEntry("SyncProfileNames"); | 113 | QStringList prof = config.readListEntry("SyncProfileNames"); |
110 | mLocalMachineName = config.readEntry("LocalMachineName","undefined"); | 114 | mLocalMachineName = config.readEntry("LocalMachineName","undefined"); |
111 | if ( prof.count() < 2 ) { | 115 | if ( prof.count() < 2 ) { |
112 | prof.clear(); | 116 | prof.clear(); |
113 | QString externalName; | 117 | QString externalName; |
114 | #ifdef DESKTOP_VERSION | 118 | #ifdef DESKTOP_VERSION |
115 | #ifdef _WIN32_ | 119 | #ifdef _WIN32_ |
116 | externalName = "OutLook(not_implemented)"; | 120 | externalName = "OutLook(not_implemented)"; |
117 | #else | 121 | #else |
118 | externalName = "KDE_Desktop"; | 122 | externalName = "KDE_Desktop"; |
119 | #endif | 123 | #endif |
120 | #else | 124 | #else |
121 | externalName = "Sharp_DTM"; | 125 | externalName = "Sharp_DTM"; |
122 | #endif | 126 | #endif |
123 | prof << externalName; | 127 | prof << externalName; |
124 | prof << i18n("Local_file"); | 128 | prof << i18n("Local_file"); |
125 | prof << i18n("Last_file"); | 129 | prof << i18n("Last_file"); |
126 | KSyncProfile* temp = new KSyncProfile (); | 130 | KSyncProfile* temp = new KSyncProfile (); |
127 | temp->setName( prof[0] ); | 131 | temp->setName( prof[0] ); |
128 | temp->writeConfig(&config); | 132 | temp->writeConfig(&config); |
129 | temp->setName( prof[1] ); | 133 | temp->setName( prof[1] ); |
130 | temp->writeConfig(&config); | 134 | temp->writeConfig(&config); |
131 | temp->setName( prof[2] ); | 135 | temp->setName( prof[2] ); |
132 | temp->writeConfig(&config); | 136 | temp->writeConfig(&config); |
133 | config.setGroup("General"); | 137 | config.setGroup("General"); |
134 | config.writeEntry("SyncProfileNames",prof); | 138 | config.writeEntry("SyncProfileNames",prof); |
135 | config.writeEntry("ExternSyncProfiles",externalName); | 139 | config.writeEntry("ExternSyncProfiles",externalName); |
136 | config.sync(); | 140 | config.sync(); |
137 | delete temp; | 141 | delete temp; |
138 | } | 142 | } |
139 | mExternSyncProfiles = config.readListEntry("ExternSyncProfiles"); | 143 | mExternSyncProfiles = config.readListEntry("ExternSyncProfiles"); |
140 | mSyncProfileNames = prof; | 144 | mSyncProfileNames = prof; |
141 | unsigned int i; | 145 | unsigned int i; |
142 | for ( i = 0; i < prof.count(); ++i ) { | 146 | for ( i = 0; i < prof.count(); ++i ) { |
143 | mSyncMenu->insertItem( prof[i], 1000+i ); | 147 | mSyncMenu->insertItem( prof[i], 1000+i ); |
144 | clearMenu->insertItem( prof[i], 1000+i ); | 148 | clearMenu->insertItem( prof[i], 1000+i ); |
145 | if ( i == 2 ) | 149 | if ( i == 2 ) |
146 | mSyncMenu->insertSeparator(); | 150 | mSyncMenu->insertSeparator(); |
147 | } | 151 | } |
148 | QDir app_dir; | 152 | QDir app_dir; |
149 | //US do not display SharpDTM if app is pwmpi, or no sharpfiles available | 153 | //US do not display SharpDTM if app is pwmpi, or no sharpfiles available |
150 | if ( mTargetApp == PWMPI) { | 154 | if ( mTargetApp == PWMPI) { |
151 | mSyncMenu->removeItem( 1000 ); | 155 | mSyncMenu->removeItem( 1000 ); |
152 | clearMenu->removeItem( 1000 ); | 156 | clearMenu->removeItem( 1000 ); |
153 | } | 157 | } |
154 | #ifndef DESKTOP_VERSION | 158 | #ifndef DESKTOP_VERSION |
155 | else if (!app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) { | 159 | else if (!app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) { |
156 | mSyncMenu->removeItem( 1000 ); | 160 | mSyncMenu->removeItem( 1000 ); |
157 | clearMenu->removeItem( 1000 ); | 161 | clearMenu->removeItem( 1000 ); |
158 | } | 162 | } |
159 | #endif | 163 | #endif |
160 | mSyncMenu->removeItem( 1002 ); | 164 | mSyncMenu->removeItem( 1002 ); |
161 | clearMenu->removeItem( 1002 ); | 165 | clearMenu->removeItem( 1002 ); |
162 | } | 166 | } |
163 | void KSyncManager::slotClearMenu( int action ) | 167 | void KSyncManager::slotClearMenu( int action ) |
164 | { | 168 | { |
165 | QString syncDevice; | 169 | QString syncDevice; |
166 | if ( action > 999 ) { | 170 | if ( action > 999 ) { |
167 | syncDevice = mSyncProfileNames[action - 1000] ; | 171 | syncDevice = mSyncProfileNames[action - 1000] ; |
168 | } | 172 | } |
169 | 173 | ||
170 | 174 | ||
171 | 175 | ||
172 | int result = 0; | 176 | int result = 0; |
173 | QString sd; | 177 | QString sd; |
174 | if ( syncDevice.isEmpty() ) | 178 | if ( syncDevice.isEmpty() ) |
175 | sd = i18n("Do you want to\nclear all sync info\nof all profiles?"); | 179 | sd = i18n("Do you want to\nclear all sync info\nof all profiles?"); |
176 | else | 180 | else |
177 | sd = i18n("Do you want to\nclear the sync\ninfo of profile\n%1?\n"). arg( syncDevice ); | 181 | sd = i18n("Do you want to\nclear the sync\ninfo of profile\n%1?\n"). arg( syncDevice ); |
178 | 182 | ||
179 | result = QMessageBox::warning( mParent, i18n("Warning!"),sd,i18n("OK"), i18n("Cancel"), 0, | 183 | result = QMessageBox::warning( mParent, i18n("Warning!"),sd,i18n("OK"), i18n("Cancel"), 0, |
180 | 0, 1 ); | 184 | 0, 1 ); |
181 | if ( result ) | 185 | if ( result ) |
182 | return; | 186 | return; |
183 | mImplementation->removeSyncInfo( syncDevice ); | 187 | mImplementation->removeSyncInfo( syncDevice ); |
184 | } | 188 | } |
185 | void KSyncManager::slotSyncMenu( int action ) | 189 | void KSyncManager::slotSyncMenu( int action ) |
186 | { | 190 | { |
187 | qDebug("KSM::syncaction %d ", action); | 191 | qDebug("KSM::syncaction %d ", action); |
188 | if ( action == 5000 ) | 192 | if ( action == 5000 ) |
189 | return; | 193 | return; |
190 | mSyncWithDesktop = false; | 194 | mSyncWithDesktop = false; |
191 | if ( action == 0 ) { | 195 | if ( action == 0 ) { |
192 | 196 | ||
193 | // seems to be a Qt2 event handling bug | 197 | // seems to be a Qt2 event handling bug |
194 | // syncmenu.clear causes a segfault at first time | 198 | // syncmenu.clear causes a segfault at first time |
195 | // when we call it after the main event loop, it is ok | 199 | // when we call it after the main event loop, it is ok |
196 | // same behaviour when calling OM/Pi via QCOP for the first time | 200 | // same behaviour when calling OM/Pi via QCOP for the first time |
197 | QTimer::singleShot ( 1, this, SLOT ( confSync() ) ); | 201 | QTimer::singleShot ( 1, this, SLOT ( confSync() ) ); |
198 | //confSync(); | 202 | //confSync(); |
199 | 203 | ||
200 | return; | 204 | return; |
201 | } | 205 | } |
202 | if ( action == 1 ) { | 206 | if ( action == 1 ) { |
203 | multiSync( true ); | 207 | multiSync( true ); |
204 | return; | 208 | return; |
205 | } | 209 | } |
206 | if ( action == 2 ) { | 210 | if ( action == 2 ) { |
207 | enableQuick(); | 211 | enableQuick(); |
208 | QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); | 212 | QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); |
209 | return; | 213 | return; |
210 | } | 214 | } |
211 | if ( action == 3 ) { | 215 | if ( action == 3 ) { |
212 | delete mServerSocket; | 216 | delete mServerSocket; |
213 | mServerSocket = 0; | 217 | mServerSocket = 0; |
214 | QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); | 218 | QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); |
215 | return; | 219 | return; |
216 | } | 220 | } |
217 | 221 | ||
218 | if (blockSave()) | 222 | if (blockSave()) |
219 | return; | 223 | return; |
220 | 224 | ||
221 | setBlockSave(true); | 225 | setBlockSave(true); |
222 | bool silent = false; | 226 | bool silent = false; |
223 | if ( action == 999 ) { | 227 | if ( action == 999 ) { |
224 | //special mode for silent syncing | 228 | //special mode for silent syncing |
225 | action = 1000; | 229 | action = 1000; |
226 | silent = true; | 230 | silent = true; |
227 | } | 231 | } |
228 | 232 | ||
229 | mCurrentSyncProfile = action - 1000 ; | 233 | mCurrentSyncProfile = action - 1000 ; |
230 | mCurrentSyncDevice = mSyncProfileNames[mCurrentSyncProfile] ; | 234 | mCurrentSyncDevice = mSyncProfileNames[mCurrentSyncProfile] ; |
231 | mCurrentSyncName = mLocalMachineName ; | 235 | mCurrentSyncName = mLocalMachineName ; |
232 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); | 236 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); |
233 | KSyncProfile* temp = new KSyncProfile (); | 237 | KSyncProfile* temp = new KSyncProfile (); |
234 | temp->setName(mSyncProfileNames[mCurrentSyncProfile]); | 238 | temp->setName(mSyncProfileNames[mCurrentSyncProfile]); |
235 | temp->readConfig(&config); | 239 | temp->readConfig(&config); |
236 | if (silent) { | 240 | if (silent) { |
237 | mAskForPreferences = false; | 241 | mAskForPreferences = false; |
238 | mShowSyncSummary = false; | 242 | mShowSyncSummary = false; |
239 | mWriteBackFile = true; | 243 | mWriteBackFile = true; |
240 | mSyncAlgoPrefs = 2;// take newest | 244 | mSyncAlgoPrefs = 2;// take newest |
241 | } | 245 | } |
242 | else { | 246 | else { |
243 | mAskForPreferences = temp->getAskForPreferences(); | 247 | mAskForPreferences = temp->getAskForPreferences(); |
244 | mShowSyncSummary = temp->getShowSummaryAfterSync(); | 248 | mShowSyncSummary = temp->getShowSummaryAfterSync(); |
245 | mWriteBackFile = temp->getWriteBackFile(); | 249 | mWriteBackFile = temp->getWriteBackFile(); |
246 | mSyncAlgoPrefs = temp->getSyncPrefs(); | 250 | mSyncAlgoPrefs = temp->getSyncPrefs(); |
247 | } | 251 | } |
248 | mWriteBackExistingOnly = temp->getWriteBackExisting(); | 252 | mWriteBackExistingOnly = temp->getWriteBackExisting(); |
249 | mIsKapiFile = temp->getIsKapiFile(); | 253 | mIsKapiFile = temp->getIsKapiFile(); |
250 | mWriteBackInFuture = 0; | 254 | mWriteBackInFuture = 0; |
251 | if ( temp->getWriteBackFuture() ) { | 255 | if ( temp->getWriteBackFuture() ) { |
252 | mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); | 256 | mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); |
253 | mWriteBackInPast = temp->getWriteBackPastWeeks( ); | 257 | mWriteBackInPast = temp->getWriteBackPastWeeks( ); |
254 | } | 258 | } |
255 | mFilterInCal = temp->getFilterInCal(); | 259 | mFilterInCal = temp->getFilterInCal(); |
256 | mFilterOutCal = temp->getFilterOutCal(); | 260 | mFilterOutCal = temp->getFilterOutCal(); |
257 | mFilterInAB = temp->getFilterInAB(); | 261 | mFilterInAB = temp->getFilterInAB(); |
258 | mFilterOutAB = temp->getFilterOutAB(); | 262 | mFilterOutAB = temp->getFilterOutAB(); |
259 | 263 | ||
260 | if ( action == 1000 ) { | 264 | if ( action == 1000 ) { |
261 | mIsKapiFile = false; | 265 | mIsKapiFile = false; |
262 | #ifdef DESKTOP_VERSION | 266 | #ifdef DESKTOP_VERSION |
263 | syncKDE(); | 267 | syncKDE(); |
264 | #else | 268 | #else |
265 | syncSharp(); | 269 | syncSharp(); |
266 | #endif | 270 | #endif |
267 | 271 | ||
268 | } else if ( action == 1001 ) { | 272 | } else if ( action == 1001 ) { |
269 | syncLocalFile(); | 273 | syncLocalFile(); |
270 | 274 | ||
271 | } else if ( action == 1002 ) { | 275 | } else if ( action == 1002 ) { |
272 | mWriteBackFile = false; | 276 | mWriteBackFile = false; |
273 | mAskForPreferences = false; | 277 | mAskForPreferences = false; |
274 | mShowSyncSummary = false; | 278 | mShowSyncSummary = false; |
275 | mSyncAlgoPrefs = 3; | 279 | mSyncAlgoPrefs = 3; |
276 | quickSyncLocalFile(); | 280 | quickSyncLocalFile(); |
277 | 281 | ||
278 | } else if ( action >= 1003 ) { | 282 | } else if ( action >= 1003 ) { |
279 | if ( temp->getIsLocalFileSync() ) { | 283 | if ( temp->getIsLocalFileSync() ) { |
280 | switch(mTargetApp) | 284 | switch(mTargetApp) |
281 | { | 285 | { |
282 | case (KAPI): | 286 | case (KAPI): |
283 | if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) | 287 | if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) |
284 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB(); | 288 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB(); |
285 | break; | 289 | break; |
286 | case (KOPI): | 290 | case (KOPI): |
287 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) | 291 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) |
288 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName(); | 292 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName(); |
289 | break; | 293 | break; |
290 | case (PWMPI): | 294 | case (PWMPI): |
291 | if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) ) | 295 | if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) ) |
292 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); | 296 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); |
293 | break; | 297 | break; |
294 | default: | 298 | default: |
295 | qDebug("KSM::slotSyncMenu: invalid apptype selected"); | 299 | qDebug("KSM::slotSyncMenu: invalid apptype selected"); |
296 | break; | 300 | break; |
297 | 301 | ||
298 | } | 302 | } |
299 | } else { | 303 | } else { |
300 | if ( temp->getIsPhoneSync() ) { | 304 | if ( temp->getIsPhoneSync() ) { |
301 | mPhoneDevice = temp->getPhoneDevice( ) ; | 305 | mPhoneDevice = temp->getPhoneDevice( ) ; |
302 | mPhoneConnection = temp->getPhoneConnection( ); | 306 | mPhoneConnection = temp->getPhoneConnection( ); |
303 | mPhoneModel = temp->getPhoneModel( ); | 307 | mPhoneModel = temp->getPhoneModel( ); |
304 | syncPhone(); | 308 | syncPhone(); |
305 | } else if ( temp->getIsPiSync() ) { | 309 | } else if ( temp->getIsPiSync() ) { |
306 | if ( mTargetApp == KAPI ) { | 310 | if ( mTargetApp == KAPI ) { |
307 | mPassWordPiSync = temp->getRemotePwAB(); | 311 | mPassWordPiSync = temp->getRemotePwAB(); |
308 | mActiveSyncPort = temp->getRemotePortAB(); | 312 | mActiveSyncPort = temp->getRemotePortAB(); |
309 | mActiveSyncIP = temp->getRemoteIPAB(); | 313 | mActiveSyncIP = temp->getRemoteIPAB(); |
310 | } else if ( mTargetApp == KOPI ) { | 314 | } else if ( mTargetApp == KOPI ) { |
311 | mPassWordPiSync = temp->getRemotePw(); | 315 | mPassWordPiSync = temp->getRemotePw(); |
312 | mActiveSyncPort = temp->getRemotePort(); | 316 | mActiveSyncPort = temp->getRemotePort(); |
313 | mActiveSyncIP = temp->getRemoteIP(); | 317 | mActiveSyncIP = temp->getRemoteIP(); |
314 | } else { | 318 | } else { |
315 | mPassWordPiSync = temp->getRemotePwPWM(); | 319 | mPassWordPiSync = temp->getRemotePwPWM(); |
316 | mActiveSyncPort = temp->getRemotePortPWM(); | 320 | mActiveSyncPort = temp->getRemotePortPWM(); |
317 | mActiveSyncIP = temp->getRemoteIPPWM(); | 321 | mActiveSyncIP = temp->getRemoteIPPWM(); |
318 | } | 322 | } |
319 | syncPi(); | 323 | syncPi(); |
320 | while ( !mPisyncFinished ) { | 324 | while ( !mPisyncFinished ) { |
321 | //qDebug("waiting "); | 325 | //qDebug("waiting "); |
322 | qApp->processEvents(); | 326 | qApp->processEvents(); |
323 | } | 327 | } |
324 | } else | 328 | } else |
325 | syncRemote( temp ); | 329 | syncRemote( temp ); |
326 | 330 | ||
327 | } | 331 | } |
328 | } | 332 | } |
329 | delete temp; | 333 | delete temp; |
330 | setBlockSave(false); | 334 | setBlockSave(false); |
331 | } | 335 | } |
332 | 336 | ||
333 | void KSyncManager::enableQuick( bool ask ) | 337 | void KSyncManager::enableQuick( bool ask ) |
334 | { | 338 | { |
335 | bool autoStart; | 339 | bool autoStart; |
336 | bool changed = false; | 340 | bool changed = false; |
337 | if ( ask ) { | 341 | if ( ask ) { |
338 | QDialog dia ( 0, "input-dialog", true ); | 342 | QDialog dia ( 0, "input-dialog", true ); |
339 | QLineEdit lab ( &dia ); | 343 | QLineEdit lab ( &dia ); |
340 | QVBoxLayout lay( &dia ); | 344 | QVBoxLayout lay( &dia ); |
341 | lab.setText( mPrefs->mPassiveSyncPort ); | 345 | lab.setText( mPrefs->mPassiveSyncPort ); |
342 | lay.setMargin(7); | 346 | lay.setMargin(7); |
343 | lay.setSpacing(7); | 347 | lay.setSpacing(7); |
344 | int po = 9197+mTargetApp; | 348 | int po = 9197+mTargetApp; |
345 | QLabel label ( i18n("Port number (Default: %1)").arg(po), &dia ); | 349 | QLabel label ( i18n("Port number (Default: %1)").arg(po), &dia ); |
346 | lay.addWidget( &label); | 350 | lay.addWidget( &label); |
347 | lay.addWidget( &lab); | 351 | lay.addWidget( &lab); |
348 | 352 | ||
349 | QLineEdit lepw ( &dia ); | 353 | QLineEdit lepw ( &dia ); |
350 | lepw.setText( mPrefs->mPassiveSyncPw ); | 354 | lepw.setText( mPrefs->mPassiveSyncPw ); |
351 | QLabel label2 ( i18n("Password to enable\naccess from remote:"), &dia ); | 355 | QLabel label2 ( i18n("Password to enable\naccess from remote:"), &dia ); |
352 | lay.addWidget( &label2); | 356 | lay.addWidget( &label2); |
353 | lay.addWidget( &lepw); | 357 | lay.addWidget( &lepw); |
354 | QCheckBox autostart(i18n("Automatically start\nat application startup"), &dia ); | 358 | QCheckBox autostart(i18n("Automatically start\nat application startup"), &dia ); |
355 | lay.addWidget( &autostart); | 359 | lay.addWidget( &autostart); |
356 | autostart.setChecked( mPrefs->mPassiveSyncAutoStart ); | 360 | autostart.setChecked( mPrefs->mPassiveSyncAutoStart ); |
357 | #ifdef DESKTOP_VERSION | 361 | #ifdef DESKTOP_VERSION |
358 | #ifdef _WIN32_ | 362 | #ifdef _WIN32_ |
359 | QCheckBox syncdesktop( i18n("Automatically sync with Outlook\nwhen receiving sync request"),&dia ); | 363 | QCheckBox syncdesktop( i18n("Automatically sync with Outlook\nwhen receiving sync request"),&dia ); |
360 | syncdesktop.hide();// not implemented! | 364 | syncdesktop.hide();// not implemented! |
361 | #else | 365 | #else |
362 | QCheckBox syncdesktop( i18n("Automatically sync with KDE-Desktop\nwhen receiving sync request"),&dia ); | 366 | QCheckBox syncdesktop( i18n("Automatically sync with KDE-Desktop\nwhen receiving sync request"),&dia ); |
363 | #endif | 367 | #endif |
364 | lay.addWidget( &syncdesktop); | 368 | lay.addWidget( &syncdesktop); |
365 | #else | 369 | #else |
366 | mPrefs->mPassiveSyncWithDesktop = false; | 370 | mPrefs->mPassiveSyncWithDesktop = false; |
367 | QCheckBox syncdesktop( i18n("Automatically sync\nwith KDE-Desktop"),&dia ); | 371 | QCheckBox syncdesktop( i18n("Automatically sync\nwith KDE-Desktop"),&dia ); |
368 | syncdesktop.hide(); | 372 | syncdesktop.hide(); |
369 | #endif | 373 | #endif |
370 | syncdesktop.setChecked( mPrefs->mPassiveSyncWithDesktop ); | 374 | syncdesktop.setChecked( mPrefs->mPassiveSyncWithDesktop ); |
371 | 375 | ||
372 | QPushButton pb ( "OK", &dia); | 376 | QPushButton pb ( "OK", &dia); |
373 | lay.addWidget( &pb ); | 377 | lay.addWidget( &pb ); |
374 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); | 378 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); |
375 | dia.resize( 230,120 ); | 379 | dia.resize( 230,120 ); |
376 | dia.setCaption( i18n("Enter port for Pi-Sync") ); | 380 | dia.setCaption( i18n("Enter port for Pi-Sync") ); |
377 | dia.show(); | 381 | dia.show(); |
378 | #ifndef DESKTOP_VERSION | 382 | #ifndef DESKTOP_VERSION |
379 | int dw = QApplication::desktop()->width(); | 383 | int dw = QApplication::desktop()->width(); |
380 | int dh = QApplication::desktop()->height(); | 384 | int dh = QApplication::desktop()->height(); |
381 | dia.move( (dw-dia.width())/2, (dh - dia.height() )/2 ); | 385 | dia.move( (dw-dia.width())/2, (dh - dia.height() )/2 ); |
382 | #endif | 386 | #endif |
383 | if ( ! dia.exec() ) | 387 | if ( ! dia.exec() ) |
384 | return; | 388 | return; |
385 | dia.hide(); | 389 | dia.hide(); |
386 | qApp->processEvents(); | 390 | qApp->processEvents(); |
387 | if ( mPrefs->mPassiveSyncPw != lepw.text() ) { | 391 | if ( mPrefs->mPassiveSyncPw != lepw.text() ) { |
388 | changed = true; | 392 | changed = true; |
389 | mPrefs->mPassiveSyncPw = lepw.text(); | 393 | mPrefs->mPassiveSyncPw = lepw.text(); |
390 | } | 394 | } |
391 | if ( mPrefs->mPassiveSyncPort != lab.text() ) { | 395 | if ( mPrefs->mPassiveSyncPort != lab.text() ) { |
392 | mPrefs->mPassiveSyncPort = lab.text(); | 396 | mPrefs->mPassiveSyncPort = lab.text(); |
393 | changed = true; | 397 | changed = true; |
394 | } | 398 | } |
395 | autoStart = autostart.isChecked(); | 399 | autoStart = autostart.isChecked(); |
396 | if (mPrefs->mPassiveSyncWithDesktop != syncdesktop.isChecked() ) { | 400 | if (mPrefs->mPassiveSyncWithDesktop != syncdesktop.isChecked() ) { |
397 | changed = true; | 401 | changed = true; |
398 | mPrefs->mPassiveSyncWithDesktop = syncdesktop.isChecked(); | 402 | mPrefs->mPassiveSyncWithDesktop = syncdesktop.isChecked(); |
399 | } | 403 | } |
400 | } | 404 | } |
401 | else | 405 | else |
402 | autoStart = mPrefs->mPassiveSyncAutoStart; | 406 | autoStart = mPrefs->mPassiveSyncAutoStart; |
403 | if ( autoStart != mPrefs->mPassiveSyncAutoStart ) | 407 | if ( autoStart != mPrefs->mPassiveSyncAutoStart ) |
404 | changed = true; | 408 | changed = true; |
405 | bool ok; | 409 | bool ok; |
406 | mPrefs->mPassiveSyncAutoStart = false; | 410 | mPrefs->mPassiveSyncAutoStart = false; |
407 | Q_UINT16 port = mPrefs->mPassiveSyncPort.toUInt(&ok); | 411 | Q_UINT16 port = mPrefs->mPassiveSyncPort.toUInt(&ok); |
408 | if ( ! ok ) { | 412 | if ( ! ok ) { |
409 | KMessageBox::information( 0, i18n("No valid port")); | 413 | KMessageBox::information( 0, i18n("No valid port")); |
410 | return; | 414 | return; |
411 | } | 415 | } |
412 | //qDebug("port %d ", port); | 416 | //qDebug("port %d ", port); |
413 | mServerSocket = new KServerSocket ( mPrefs->mPassiveSyncPw, port ,1 ); | 417 | mServerSocket = new KServerSocket ( mPrefs->mPassiveSyncPw, port ,1 ); |
414 | mServerSocket->setFileName( defaultFileName() );//bbb | 418 | mServerSocket->setFileName( defaultFileName() );//bbb |
415 | //qDebug("connected "); | ||
416 | if ( !mServerSocket->ok() ) { | 419 | if ( !mServerSocket->ok() ) { |
417 | KMessageBox::information( 0, i18n("Failed to bind or\nlisten to the port!")); | 420 | KMessageBox::information( 0, i18n("Failed to bind or\nlisten to the port!")); |
418 | delete mServerSocket; | 421 | delete mServerSocket; |
419 | mServerSocket = 0; | 422 | mServerSocket = 0; |
420 | return; | 423 | return; |
421 | } | 424 | } |
422 | mPrefs->mPassiveSyncAutoStart = autoStart; | 425 | mPrefs->mPassiveSyncAutoStart = autoStart; |
423 | if ( changed ) { | 426 | if ( changed ) { |
424 | mPrefs->writeConfig(); | 427 | mPrefs->writeConfig(); |
425 | } | 428 | } |
426 | connect( mServerSocket, SIGNAL ( request_file() ),this, SIGNAL ( request_file() ) ); | 429 | connect( mServerSocket, SIGNAL ( request_file() ),this, SIGNAL ( request_file() ) ); |
427 | connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SIGNAL ( getFile( bool ) ) ); | 430 | connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SIGNAL ( getFile( bool ) ) ); |
428 | } | 431 | } |
429 | 432 | ||
430 | void KSyncManager::syncLocalFile() | 433 | void KSyncManager::syncLocalFile() |
431 | { | 434 | { |
432 | 435 | ||
433 | QString fn =mPrefs->mLastSyncedLocalFile; | 436 | QString fn =mPrefs->mLastSyncedLocalFile; |
434 | QString ext; | 437 | QString ext; |
435 | 438 | ||
436 | switch(mTargetApp) | 439 | switch(mTargetApp) |
437 | { | 440 | { |
438 | case (KAPI): | 441 | case (KAPI): |
439 | ext = "(*.vcf)"; | 442 | ext = "(*.vcf)"; |
440 | break; | 443 | break; |
441 | case (KOPI): | 444 | case (KOPI): |
442 | ext = "(*.ics/*.vcs)"; | 445 | ext = "(*.ics/*.vcs)"; |
443 | break; | 446 | break; |
444 | case (PWMPI): | 447 | case (PWMPI): |
445 | ext = "(*.pwm)"; | 448 | ext = "(*.pwm)"; |
446 | break; | 449 | break; |
447 | default: | 450 | default: |
448 | qDebug("KSM::syncLocalFile: invalid apptype selected"); | 451 | qDebug("KSM::syncLocalFile: invalid apptype selected"); |
449 | break; | 452 | break; |
450 | 453 | ||
451 | } | 454 | } |
452 | 455 | ||
453 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename"+ext), mParent ); | 456 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename"+ext), mParent ); |
454 | if ( fn == "" ) | 457 | if ( fn == "" ) |
455 | return; | 458 | return; |
456 | if ( syncWithFile( fn, false ) ) { | 459 | if ( syncWithFile( fn, false ) ) { |
457 | qDebug("KSM::syncLocalFile() successful "); | 460 | qDebug("KSM::syncLocalFile() successful "); |
458 | } | 461 | } |
459 | 462 | ||
460 | } | 463 | } |
461 | 464 | ||
462 | bool KSyncManager::syncWithFile( QString fn , bool quick ) | 465 | bool KSyncManager::syncWithFile( QString fn , bool quick ) |
463 | { | 466 | { |
464 | bool ret = false; | 467 | bool ret = false; |
465 | QFileInfo info; | 468 | QFileInfo info; |
466 | info.setFile( fn ); | 469 | info.setFile( fn ); |
467 | QString mess; | 470 | QString mess; |
468 | if ( !info. exists() ) { | 471 | if ( !info. exists() ) { |
469 | mess = i18n( "Sync file \n...%1\ndoes not exist!\nNothing synced!\n").arg(fn.right( 30) ); | 472 | mess = i18n( "Sync file \n...%1\ndoes not exist!\nNothing synced!\n").arg(fn.right( 30) ); |
470 | QMessageBox::warning( mParent, i18n("Warning!"), | 473 | QMessageBox::warning( mParent, i18n("Warning!"), |
471 | mess ); | 474 | mess ); |
472 | return ret; | 475 | return ret; |
473 | } | 476 | } |
474 | int result = 0; | 477 | int result = 0; |
475 | if ( !quick ) { | 478 | if ( !quick ) { |
476 | mess = i18n("Sync with file \n...%1\nfrom:\n%2\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 479 | mess = i18n("Sync with file \n...%1\nfrom:\n%2\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
477 | result = QMessageBox::warning( mParent, i18n("Warning!"), | 480 | result = QMessageBox::warning( mParent, i18n("Warning!"), |
478 | mess, | 481 | mess, |
479 | i18n("Sync"), i18n("Cancel"), 0, | 482 | i18n("Sync"), i18n("Cancel"), 0, |
480 | 0, 1 ); | 483 | 0, 1 ); |
481 | if ( result ) | 484 | if ( result ) |
482 | return false; | 485 | return false; |
483 | } | 486 | } |
484 | if ( mAskForPreferences ) | 487 | if ( mAskForPreferences ) |
485 | if ( !edit_sync_options()) { | 488 | if ( !edit_sync_options()) { |
486 | mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); | 489 | mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); |
487 | return false; | 490 | return false; |
488 | } | 491 | } |
489 | if ( result == 0 ) { | 492 | if ( result == 0 ) { |
490 | //qDebug("Now sycing ... "); | 493 | //qDebug("Now sycing ... "); |
491 | if ( ret = mImplementation->sync( this, fn, mSyncAlgoPrefs ) ) | 494 | if ( ret = mImplementation->sync( this, fn, mSyncAlgoPrefs ) ) |
492 | mParent->topLevelWidget()->setCaption( i18n("Synchronization successful") ); | 495 | mParent->topLevelWidget()->setCaption( i18n("Synchronization successful") ); |
493 | else | 496 | else |
494 | mParent->topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") ); | 497 | mParent->topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") ); |
495 | if ( ! quick ) | 498 | if ( ! quick ) |
496 | mPrefs->mLastSyncedLocalFile = fn; | 499 | mPrefs->mLastSyncedLocalFile = fn; |
497 | } | 500 | } |
498 | return ret; | 501 | return ret; |
499 | } | 502 | } |
500 | 503 | ||
501 | void KSyncManager::quickSyncLocalFile() | 504 | void KSyncManager::quickSyncLocalFile() |
502 | { | 505 | { |
503 | 506 | ||
504 | if ( syncWithFile( mPrefs->mLastSyncedLocalFile, true ) ) { | 507 | if ( syncWithFile( mPrefs->mLastSyncedLocalFile, true ) ) { |
505 | qDebug("KSM::quick syncLocalFile() successful "); | 508 | qDebug("KSM::quick syncLocalFile() successful "); |
506 | 509 | ||
507 | } | 510 | } |
508 | } | 511 | } |
509 | 512 | ||
510 | void KSyncManager::multiSync( bool askforPrefs ) | 513 | void KSyncManager::multiSync( bool askforPrefs ) |
511 | { | 514 | { |
512 | if (blockSave()) | 515 | if (blockSave()) |
513 | return; | 516 | return; |
514 | setBlockSave(true); | 517 | setBlockSave(true); |
515 | QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); | 518 | QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); |
516 | if ( QMessageBox::information( mParent, i18n("KDE-Pim Sync"), | 519 | if ( QMessageBox::information( mParent, i18n("KDE-Pim Sync"), |
517 | question, | 520 | question, |
518 | i18n("Yes"), i18n("No"), | 521 | i18n("Yes"), i18n("No"), |
519 | 0, 0 ) != 0 ) { | 522 | 0, 0 ) != 0 ) { |
520 | setBlockSave(false); | 523 | setBlockSave(false); |
521 | mParent->topLevelWidget()->setCaption(i18n("Aborted! Nothing synced!")); | 524 | mParent->topLevelWidget()->setCaption(i18n("Aborted! Nothing synced!")); |
522 | return; | 525 | return; |
523 | } | 526 | } |
524 | mCurrentSyncDevice = i18n("Multiple profiles") ; | 527 | mCurrentSyncDevice = i18n("Multiple profiles") ; |
525 | mSyncAlgoPrefs = mPrefs->mRingSyncAlgoPrefs; | 528 | mSyncAlgoPrefs = mPrefs->mRingSyncAlgoPrefs; |
526 | if ( askforPrefs ) { | 529 | if ( askforPrefs ) { |
527 | if ( !edit_sync_options()) { | 530 | if ( !edit_sync_options()) { |
528 | mParent->topLevelWidget()->setCaption( i18n("Syncing aborted.") ); | 531 | mParent->topLevelWidget()->setCaption( i18n("Syncing aborted.") ); |
529 | return; | 532 | return; |
530 | } | 533 | } |
531 | mPrefs->mRingSyncAlgoPrefs = mSyncAlgoPrefs; | 534 | mPrefs->mRingSyncAlgoPrefs = mSyncAlgoPrefs; |
532 | } | 535 | } |
533 | mParent->topLevelWidget()->setCaption(i18n("Multiple sync started.") ); | 536 | mParent->topLevelWidget()->setCaption(i18n("Multiple sync started.") ); |
534 | qApp->processEvents(); | 537 | qApp->processEvents(); |
535 | int num = ringSync() ; | 538 | int num = ringSync() ; |
536 | if ( num > 1 ) | 539 | if ( num > 1 ) |
537 | ringSync(); | 540 | ringSync(); |
538 | setBlockSave(false); | 541 | setBlockSave(false); |
539 | if ( num ) | 542 | if ( num ) |
540 | emit save(); | 543 | emit save(); |
541 | if ( num ) | 544 | if ( num ) |
542 | mParent->topLevelWidget()->setCaption(i18n("%1 profiles synced. Multiple sync complete!").arg(num) ); | 545 | mParent->topLevelWidget()->setCaption(i18n("%1 profiles synced. Multiple sync complete!").arg(num) ); |
543 | else | 546 | else |
544 | mParent->topLevelWidget()->setCaption(i18n("Nothing synced! No profiles defined for multisync!")); | 547 | mParent->topLevelWidget()->setCaption(i18n("Nothing synced! No profiles defined for multisync!")); |
545 | return; | 548 | return; |
546 | } | 549 | } |
547 | 550 | ||
548 | int KSyncManager::ringSync() | 551 | int KSyncManager::ringSync() |
549 | { | 552 | { |
550 | 553 | ||
551 | int syncedProfiles = 0; | 554 | int syncedProfiles = 0; |
552 | unsigned int i; | 555 | unsigned int i; |
553 | QTime timer; | 556 | QTime timer; |
554 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); | 557 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); |
555 | QStringList syncProfileNames = mSyncProfileNames; | 558 | QStringList syncProfileNames = mSyncProfileNames; |
556 | KSyncProfile* temp = new KSyncProfile (); | 559 | KSyncProfile* temp = new KSyncProfile (); |
557 | mAskForPreferences = false; | 560 | mAskForPreferences = false; |
558 | for ( i = 0; i < syncProfileNames.count(); ++i ) { | 561 | for ( i = 0; i < syncProfileNames.count(); ++i ) { |
559 | mCurrentSyncProfile = i; | 562 | mCurrentSyncProfile = i; |
560 | temp->setName(syncProfileNames[mCurrentSyncProfile]); | 563 | temp->setName(syncProfileNames[mCurrentSyncProfile]); |
561 | temp->readConfig(&config); | 564 | temp->readConfig(&config); |
562 | 565 | ||
563 | bool includeInRingSync = false; | 566 | bool includeInRingSync = false; |
564 | switch(mTargetApp) | 567 | switch(mTargetApp) |
565 | { | 568 | { |
566 | case (KAPI): | 569 | case (KAPI): |
567 | includeInRingSync = temp->getIncludeInRingSyncAB(); | 570 | includeInRingSync = temp->getIncludeInRingSyncAB(); |
568 | break; | 571 | break; |
569 | case (KOPI): | 572 | case (KOPI): |
570 | includeInRingSync = temp->getIncludeInRingSync(); | 573 | includeInRingSync = temp->getIncludeInRingSync(); |
571 | break; | 574 | break; |
572 | case (PWMPI): | 575 | case (PWMPI): |
573 | includeInRingSync = temp->getIncludeInRingSyncPWM(); | 576 | includeInRingSync = temp->getIncludeInRingSyncPWM(); |
574 | break; | 577 | break; |
575 | default: | 578 | default: |
576 | qDebug("KSM::ringSync: invalid apptype selected"); | 579 | qDebug("KSM::ringSync: invalid apptype selected"); |
577 | break; | 580 | break; |
578 | 581 | ||
579 | } | 582 | } |
580 | 583 | ||
581 | 584 | ||
582 | if ( includeInRingSync && ( i < 1 || i > 2 )) { | 585 | if ( includeInRingSync && ( i < 1 || i > 2 )) { |
583 | mParent->topLevelWidget()->setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); | 586 | mParent->topLevelWidget()->setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); |
584 | ++syncedProfiles; | 587 | ++syncedProfiles; |
585 | mSyncWithDesktop = false; | 588 | mSyncWithDesktop = false; |
586 | // mAskForPreferences = temp->getAskForPreferences(); | 589 | // mAskForPreferences = temp->getAskForPreferences(); |
587 | mWriteBackFile = temp->getWriteBackFile(); | 590 | mWriteBackFile = temp->getWriteBackFile(); |
588 | mWriteBackExistingOnly = temp->getWriteBackExisting(); | 591 | mWriteBackExistingOnly = temp->getWriteBackExisting(); |
589 | mIsKapiFile = temp->getIsKapiFile(); | 592 | mIsKapiFile = temp->getIsKapiFile(); |
590 | mWriteBackInFuture = 0; | 593 | mWriteBackInFuture = 0; |
591 | if ( temp->getWriteBackFuture() ) { | 594 | if ( temp->getWriteBackFuture() ) { |
592 | mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); | 595 | mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); |
593 | mWriteBackInPast = temp->getWriteBackPastWeeks( ); | 596 | mWriteBackInPast = temp->getWriteBackPastWeeks( ); |
594 | } | 597 | } |
595 | mFilterInCal = temp->getFilterInCal(); | 598 | mFilterInCal = temp->getFilterInCal(); |
596 | mFilterOutCal = temp->getFilterOutCal(); | 599 | mFilterOutCal = temp->getFilterOutCal(); |
597 | mFilterInAB = temp->getFilterInAB(); | 600 | mFilterInAB = temp->getFilterInAB(); |
598 | mFilterOutAB = temp->getFilterOutAB(); | 601 | mFilterOutAB = temp->getFilterOutAB(); |
599 | mShowSyncSummary = false; | 602 | mShowSyncSummary = false; |
600 | mCurrentSyncDevice = syncProfileNames[i] ; | 603 | mCurrentSyncDevice = syncProfileNames[i] ; |
601 | mCurrentSyncName = mLocalMachineName; | 604 | mCurrentSyncName = mLocalMachineName; |
602 | if ( i == 0 ) { | 605 | if ( i == 0 ) { |
603 | mIsKapiFile = false; | 606 | mIsKapiFile = false; |
604 | #ifdef DESKTOP_VERSION | 607 | #ifdef DESKTOP_VERSION |
605 | syncKDE(); | 608 | syncKDE(); |
606 | #else | 609 | #else |
607 | syncSharp(); | 610 | syncSharp(); |
@@ -928,385 +931,385 @@ void KSyncManager::syncKDE() | |||
928 | } | 931 | } |
929 | 932 | ||
930 | } | 933 | } |
931 | break; | 934 | break; |
932 | case (KOPI): | 935 | case (KOPI): |
933 | { | 936 | { |
934 | #ifdef DESKTOP_VERSION | 937 | #ifdef DESKTOP_VERSION |
935 | QString command = qApp->applicationDirPath () + "/kdecaldump"; | 938 | QString command = qApp->applicationDirPath () + "/kdecaldump"; |
936 | #else | 939 | #else |
937 | QString command = "kdecaldump"; | 940 | QString command = "kdecaldump"; |
938 | #endif | 941 | #endif |
939 | if ( ! QFile::exists ( command ) ) | 942 | if ( ! QFile::exists ( command ) ) |
940 | command = "kdecaldump"; | 943 | command = "kdecaldump"; |
941 | QString fileName = QDir::homeDirPath ()+"/.kdecalendardump.ics"; | 944 | QString fileName = QDir::homeDirPath ()+"/.kdecalendardump.ics"; |
942 | system ( command.latin1()); | 945 | system ( command.latin1()); |
943 | if ( syncWithFile( fileName,true ) ) { | 946 | if ( syncWithFile( fileName,true ) ) { |
944 | if ( mWriteBackFile ) { | 947 | if ( mWriteBackFile ) { |
945 | command += " --read"; | 948 | command += " --read"; |
946 | system ( command.latin1()); | 949 | system ( command.latin1()); |
947 | } | 950 | } |
948 | } | 951 | } |
949 | 952 | ||
950 | } | 953 | } |
951 | break; | 954 | break; |
952 | case (PWMPI): | 955 | case (PWMPI): |
953 | 956 | ||
954 | break; | 957 | break; |
955 | default: | 958 | default: |
956 | qDebug("KSM::slotSyncMenu: invalid apptype selected"); | 959 | qDebug("KSM::slotSyncMenu: invalid apptype selected"); |
957 | break; | 960 | break; |
958 | 961 | ||
959 | } | 962 | } |
960 | } | 963 | } |
961 | 964 | ||
962 | void KSyncManager::syncSharp() | 965 | void KSyncManager::syncSharp() |
963 | { | 966 | { |
964 | 967 | ||
965 | if ( ! syncExternalApplication("sharp") ) | 968 | if ( ! syncExternalApplication("sharp") ) |
966 | qDebug("KSM::ERROR sync sharp "); | 969 | qDebug("KSM::ERROR sync sharp "); |
967 | } | 970 | } |
968 | 971 | ||
969 | bool KSyncManager::syncExternalApplication(QString resource) | 972 | bool KSyncManager::syncExternalApplication(QString resource) |
970 | { | 973 | { |
971 | 974 | ||
972 | emit save(); | 975 | emit save(); |
973 | 976 | ||
974 | if ( mAskForPreferences ) | 977 | if ( mAskForPreferences ) |
975 | if ( !edit_sync_options()) { | 978 | if ( !edit_sync_options()) { |
976 | mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); | 979 | mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); |
977 | return false; | 980 | return false; |
978 | } | 981 | } |
979 | 982 | ||
980 | qDebug("KSM::Sync extern %s", resource.latin1()); | 983 | qDebug("KSM::Sync extern %s", resource.latin1()); |
981 | 984 | ||
982 | bool syncOK = mImplementation->syncExternal(this, resource); | 985 | bool syncOK = mImplementation->syncExternal(this, resource); |
983 | 986 | ||
984 | return syncOK; | 987 | return syncOK; |
985 | 988 | ||
986 | } | 989 | } |
987 | 990 | ||
988 | void KSyncManager::syncPhone() | 991 | void KSyncManager::syncPhone() |
989 | { | 992 | { |
990 | 993 | ||
991 | syncExternalApplication("phone"); | 994 | syncExternalApplication("phone"); |
992 | 995 | ||
993 | } | 996 | } |
994 | 997 | ||
995 | void KSyncManager::showProgressBar(int percentage, QString caption, int total) | 998 | void KSyncManager::showProgressBar(int percentage, QString caption, int total) |
996 | { | 999 | { |
997 | if (!bar->isVisible()) | 1000 | if (!bar->isVisible()) |
998 | { | 1001 | { |
999 | bar->setCaption (caption); | 1002 | bar->setCaption (caption); |
1000 | bar->setTotalSteps ( total ) ; | 1003 | bar->setTotalSteps ( total ) ; |
1001 | bar->show(); | 1004 | bar->show(); |
1002 | } | 1005 | } |
1003 | bar->raise(); | 1006 | bar->raise(); |
1004 | bar->setProgress( percentage ); | 1007 | bar->setProgress( percentage ); |
1005 | qApp->processEvents(); | 1008 | qApp->processEvents(); |
1006 | } | 1009 | } |
1007 | 1010 | ||
1008 | void KSyncManager::hideProgressBar() | 1011 | void KSyncManager::hideProgressBar() |
1009 | { | 1012 | { |
1010 | bar->hide(); | 1013 | bar->hide(); |
1011 | qApp->processEvents(); | 1014 | qApp->processEvents(); |
1012 | } | 1015 | } |
1013 | 1016 | ||
1014 | bool KSyncManager::isProgressBarCanceled() | 1017 | bool KSyncManager::isProgressBarCanceled() |
1015 | { | 1018 | { |
1016 | return !bar->isVisible(); | 1019 | return !bar->isVisible(); |
1017 | } | 1020 | } |
1018 | 1021 | ||
1019 | QString KSyncManager::syncFileName() | 1022 | QString KSyncManager::syncFileName() |
1020 | { | 1023 | { |
1021 | 1024 | ||
1022 | QString fn = "tempfile"; | 1025 | QString fn = "tempfile"; |
1023 | switch(mTargetApp) | 1026 | switch(mTargetApp) |
1024 | { | 1027 | { |
1025 | case (KAPI): | 1028 | case (KAPI): |
1026 | fn = "tempsyncab.vcf"; | 1029 | fn = "tempsyncab.vcf"; |
1027 | break; | 1030 | break; |
1028 | case (KOPI): | 1031 | case (KOPI): |
1029 | fn = "tempsynccal.ics"; | 1032 | fn = "tempsynccal.ics"; |
1030 | break; | 1033 | break; |
1031 | case (PWMPI): | 1034 | case (PWMPI): |
1032 | fn = "tempsyncpw.pwm"; | 1035 | fn = "tempsyncpw.pwm"; |
1033 | break; | 1036 | break; |
1034 | default: | 1037 | default: |
1035 | break; | 1038 | break; |
1036 | } | 1039 | } |
1037 | #ifdef _WIN32_ | 1040 | #ifdef _WIN32_ |
1038 | return locateLocal( "tmp", fn ); | 1041 | return locateLocal( "tmp", fn ); |
1039 | #else | 1042 | #else |
1040 | return (QString( "/tmp/" )+ fn ); | 1043 | return (QString( "/tmp/" )+ fn ); |
1041 | #endif | 1044 | #endif |
1042 | } | 1045 | } |
1043 | 1046 | ||
1044 | void KSyncManager::syncPi() | 1047 | void KSyncManager::syncPi() |
1045 | { | 1048 | { |
1046 | mIsKapiFile = true; | 1049 | mIsKapiFile = true; |
1047 | mPisyncFinished = false; | 1050 | mPisyncFinished = false; |
1048 | qApp->processEvents(); | 1051 | qApp->processEvents(); |
1049 | if ( mAskForPreferences ) | 1052 | if ( mAskForPreferences ) |
1050 | if ( !edit_pisync_options()) { | 1053 | if ( !edit_pisync_options()) { |
1051 | mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); | 1054 | mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); |
1052 | return; | 1055 | return; |
1053 | } | 1056 | } |
1054 | bool ok; | 1057 | bool ok; |
1055 | Q_UINT16 port = mActiveSyncPort.toUInt(&ok); | 1058 | Q_UINT16 port = mActiveSyncPort.toUInt(&ok); |
1056 | if ( ! ok ) { | 1059 | if ( ! ok ) { |
1057 | mParent->topLevelWidget()->setCaption( i18n("Sorry, no valid port.Syncing cancelled.") ); | 1060 | mParent->topLevelWidget()->setCaption( i18n("Sorry, no valid port.Syncing cancelled.") ); |
1058 | return; | 1061 | return; |
1059 | } | 1062 | } |
1060 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, port, mActiveSyncIP, this, mParent->topLevelWidget() ); | 1063 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, port, mActiveSyncIP, this, mParent->topLevelWidget() ); |
1061 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) ); | 1064 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) ); |
1062 | commandSocket->readFile( syncFileName() ); | 1065 | commandSocket->readFile( syncFileName() ); |
1063 | } | 1066 | } |
1064 | 1067 | ||
1065 | void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state) | 1068 | void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state) |
1066 | { | 1069 | { |
1067 | //enum { success, errorW, errorR, quiet }; | 1070 | //enum { success, errorW, errorR, quiet }; |
1068 | if ( state == KCommandSocket::errorR ||state == KCommandSocket::errorTO ) { | 1071 | if ( state == KCommandSocket::errorR ||state == KCommandSocket::errorTO ) { |
1069 | mParent->topLevelWidget()->setCaption( i18n("ERROR: Receiving remote file failed.") ); | 1072 | mParent->topLevelWidget()->setCaption( i18n("ERROR: Receiving remote file failed.") ); |
1070 | delete s; | 1073 | delete s; |
1071 | if ( state == KCommandSocket::errorR ) { | 1074 | if ( state == KCommandSocket::errorR ) { |
1072 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this, mParent->topLevelWidget()); | 1075 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this, mParent->topLevelWidget()); |
1073 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); | 1076 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); |
1074 | commandSocket->sendStop(); | 1077 | commandSocket->sendStop(); |
1075 | } | 1078 | } |
1076 | mPisyncFinished = true; | 1079 | mPisyncFinished = true; |
1077 | return; | 1080 | return; |
1078 | 1081 | ||
1079 | } else if ( state == KCommandSocket::errorW ) { | 1082 | } else if ( state == KCommandSocket::errorW ) { |
1080 | mParent->topLevelWidget()->setCaption( i18n("ERROR:Writing back file failed.") ); | 1083 | mParent->topLevelWidget()->setCaption( i18n("ERROR:Writing back file failed.") ); |
1081 | mPisyncFinished = true; | 1084 | mPisyncFinished = true; |
1082 | 1085 | ||
1083 | } else if ( state == KCommandSocket::successR ) { | 1086 | } else if ( state == KCommandSocket::successR ) { |
1084 | QTimer::singleShot( 1, this , SLOT ( readFileFromSocket())); | 1087 | QTimer::singleShot( 1, this , SLOT ( readFileFromSocket())); |
1085 | 1088 | ||
1086 | } else if ( state == KCommandSocket::successW ) { | 1089 | } else if ( state == KCommandSocket::successW ) { |
1087 | mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") ); | 1090 | mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") ); |
1088 | mPisyncFinished = true; | 1091 | mPisyncFinished = true; |
1089 | } | 1092 | } |
1090 | 1093 | ||
1091 | delete s; | 1094 | delete s; |
1092 | } | 1095 | } |
1093 | 1096 | ||
1094 | void KSyncManager::readFileFromSocket() | 1097 | void KSyncManager::readFileFromSocket() |
1095 | { | 1098 | { |
1096 | QString fileName = syncFileName(); | 1099 | QString fileName = syncFileName(); |
1097 | mParent->topLevelWidget()->setCaption( i18n("Remote file saved to temp file.") ); | 1100 | mParent->topLevelWidget()->setCaption( i18n("Remote file saved to temp file.") ); |
1098 | if ( ! syncWithFile( fileName , true ) ) { | 1101 | if ( ! syncWithFile( fileName , true ) ) { |
1099 | mParent->topLevelWidget()->setCaption( i18n("Syncing failed.") ); | 1102 | mParent->topLevelWidget()->setCaption( i18n("Syncing failed.") ); |
1100 | mPisyncFinished = true; | 1103 | mPisyncFinished = true; |
1101 | return; | 1104 | return; |
1102 | } | 1105 | } |
1103 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this, mParent->topLevelWidget() ); | 1106 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this, mParent->topLevelWidget() ); |
1104 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); | 1107 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); |
1105 | if ( mWriteBackFile ) | 1108 | if ( mWriteBackFile ) |
1106 | commandSocket->writeFile( fileName ); | 1109 | commandSocket->writeFile( fileName ); |
1107 | else { | 1110 | else { |
1108 | commandSocket->sendStop(); | 1111 | commandSocket->sendStop(); |
1109 | mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") ); | 1112 | mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") ); |
1110 | mPisyncFinished = true; | 1113 | mPisyncFinished = true; |
1111 | } | 1114 | } |
1112 | } | 1115 | } |
1113 | 1116 | ||
1114 | KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject * parent, const char * name ) : QServerSocket( port, backlog, parent, name ) | 1117 | KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject * parent, const char * name ) : QServerSocket( port, backlog, parent, name ) |
1115 | { | 1118 | { |
1116 | mPassWord = pw; | 1119 | mPassWord = pw; |
1117 | mSocket = 0; | 1120 | mSocket = 0; |
1118 | mSyncActionDialog = 0; | 1121 | mSyncActionDialog = 0; |
1119 | blockRC = false; | 1122 | blockRC = false; |
1120 | }; | 1123 | } |
1121 | 1124 | ||
1122 | void KServerSocket::newConnection ( int socket ) | 1125 | void KServerSocket::newConnection ( int socket ) |
1123 | { | 1126 | { |
1124 | // qDebug("KServerSocket:New connection %d ", socket); | 1127 | // qDebug("KServerSocket:New connection %d ", socket); |
1125 | if ( mSocket ) { | 1128 | if ( mSocket ) { |
1126 | qDebug("KSS::newConnection Socket deleted! "); | 1129 | qDebug("KSS::newConnection Socket deleted! "); |
1127 | delete mSocket; | 1130 | delete mSocket; |
1128 | mSocket = 0; | 1131 | mSocket = 0; |
1129 | } | 1132 | } |
1130 | mSocket = new QSocket( this ); | 1133 | mSocket = new QSocket( this ); |
1131 | connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) ); | 1134 | connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) ); |
1132 | connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) ); | 1135 | connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) ); |
1133 | mSocket->setSocket( socket ); | 1136 | mSocket->setSocket( socket ); |
1134 | } | 1137 | } |
1135 | 1138 | ||
1136 | void KServerSocket::discardClient() | 1139 | void KServerSocket::discardClient() |
1137 | { | 1140 | { |
1138 | //qDebug(" KServerSocket::discardClient()"); | 1141 | //qDebug(" KServerSocket::discardClient()"); |
1139 | if ( mSocket ) { | 1142 | if ( mSocket ) { |
1140 | delete mSocket; | 1143 | delete mSocket; |
1141 | mSocket = 0; | 1144 | mSocket = 0; |
1142 | } | 1145 | } |
1143 | //emit endConnect(); | 1146 | //emit endConnect(); |
1144 | } | 1147 | } |
1145 | void KServerSocket::readClient() | 1148 | void KServerSocket::readClient() |
1146 | { | 1149 | { |
1147 | if ( blockRC ) | 1150 | if ( blockRC ) |
1148 | return; | 1151 | return; |
1149 | if ( mSocket == 0 ) { | 1152 | if ( mSocket == 0 ) { |
1150 | qDebug("ERROR::KSS::readClient(): mSocket == 0 "); | 1153 | qDebug("ERROR::KSS::readClient(): mSocket == 0 "); |
1151 | return; | 1154 | return; |
1152 | } | 1155 | } |
1153 | //qDebug("KServerSocket::readClient()"); | 1156 | //qDebug("KServerSocket::readClient()"); |
1154 | if ( mSocket->canReadLine() ) { | 1157 | if ( mSocket->canReadLine() ) { |
1155 | QString line = mSocket->readLine(); | 1158 | QString line = mSocket->readLine(); |
1156 | //qDebug("KServerSocket readline: %s ", line.latin1()); | 1159 | //qDebug("KServerSocket readline: %s ", line.latin1()); |
1157 | QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), line ); | 1160 | QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), line ); |
1158 | if ( tokens[0] == "GET" ) { | 1161 | if ( tokens[0] == "GET" ) { |
1159 | if ( tokens[1] == mPassWord ) { | 1162 | if ( tokens[1] == mPassWord ) { |
1160 | //emit sendFile( mSocket ); | 1163 | //emit sendFile( mSocket ); |
1161 | bool ok = false; | 1164 | bool ok = false; |
1162 | QDateTime dt = KGlobal::locale()->readDateTime( tokens[2], KLocale::ISODate, &ok); | 1165 | QDateTime dt = KGlobal::locale()->readDateTime( tokens[2], KLocale::ISODate, &ok); |
1163 | if ( ok ) { | 1166 | if ( ok ) { |
1164 | KSyncManager::mRequestedSyncEvent = dt; | 1167 | KSyncManager::mRequestedSyncEvent = dt; |
1165 | } | 1168 | } |
1166 | else | 1169 | else |
1167 | KSyncManager::mRequestedSyncEvent = QDateTime(); | 1170 | KSyncManager::mRequestedSyncEvent = QDateTime(); |
1168 | send_file(); | 1171 | send_file(); |
1169 | } | 1172 | } |
1170 | else { | 1173 | else { |
1171 | KMessageBox::error( 0, i18n("Got send file request\nwith invalid password")); | 1174 | KMessageBox::error( 0, i18n("Got send file request\nwith invalid password")); |
1172 | //qDebug("password %s, invalid password %s ",mPassWord.latin1(), tokens[1].latin1() ); | 1175 | //qDebug("password %s, invalid password %s ",mPassWord.latin1(), tokens[1].latin1() ); |
1173 | } | 1176 | } |
1174 | } | 1177 | } |
1175 | if ( tokens[0] == "PUT" ) { | 1178 | if ( tokens[0] == "PUT" ) { |
1176 | if ( tokens[1] == mPassWord ) { | 1179 | if ( tokens[1] == mPassWord ) { |
1177 | //emit getFile( mSocket ); | 1180 | //emit getFile( mSocket ); |
1178 | blockRC = true; | 1181 | blockRC = true; |
1179 | get_file(); | 1182 | get_file(); |
1180 | } | 1183 | } |
1181 | else { | 1184 | else { |
1182 | KMessageBox::error( 0, i18n("Got receive file request\nwith invalid password")); | 1185 | KMessageBox::error( 0, i18n("Got receive file request\nwith invalid password")); |
1183 | //qDebug("password %s, invalid password %s ",mPassWord.latin1(), tokens[1].latin1() ); | 1186 | //qDebug("password %s, invalid password %s ",mPassWord.latin1(), tokens[1].latin1() ); |
1184 | } | 1187 | } |
1185 | } | 1188 | } |
1186 | if ( tokens[0] == "STOP" ) { | 1189 | if ( tokens[0] == "STOP" ) { |
1187 | //emit endConnect(); | 1190 | //emit endConnect(); |
1188 | end_connect(); | 1191 | end_connect(); |
1189 | } | 1192 | } |
1190 | } | 1193 | } |
1191 | } | 1194 | } |
1192 | void KServerSocket::end_connect() | 1195 | void KServerSocket::end_connect() |
1193 | { | 1196 | { |
1194 | delete mSyncActionDialog; | 1197 | delete mSyncActionDialog; |
1195 | mSyncActionDialog = 0; | 1198 | mSyncActionDialog = 0; |
1196 | } | 1199 | } |
1197 | void KServerSocket::send_file() | 1200 | void KServerSocket::send_file() |
1198 | { | 1201 | { |
1199 | //qDebug("MainWindow::sendFile(QSocket* s) "); | 1202 | //qDebug("MainWindow::sendFile(QSocket* s) "); |
1200 | if ( mSyncActionDialog ) | 1203 | if ( mSyncActionDialog ) |
1201 | delete mSyncActionDialog; | 1204 | delete mSyncActionDialog; |
1202 | mSyncActionDialog = new QDialog ( 0, "input-dialog", true ); | 1205 | mSyncActionDialog = new QDialog ( 0, "input-dialog", true ); |
1203 | mSyncActionDialog->setCaption(i18n("Received sync request")); | 1206 | mSyncActionDialog->setCaption(i18n("Received sync request")); |
1204 | QLabel* label = new QLabel( i18n("Synchronizing from remote ...\n\nDo not use this application!\n\nIf syncing fails\nyou can close this dialog."), mSyncActionDialog ); | 1207 | QLabel* label = new QLabel( i18n("Synchronizing from remote ...\n\nDo not use this application!\n\nIf syncing fails\nyou can close this dialog."), mSyncActionDialog ); |
1205 | label->setAlignment ( Qt::AlignHCenter ); | 1208 | label->setAlignment ( Qt::AlignHCenter ); |
1206 | QVBoxLayout* lay = new QVBoxLayout( mSyncActionDialog ); | 1209 | QVBoxLayout* lay = new QVBoxLayout( mSyncActionDialog ); |
1207 | lay->addWidget( label); | 1210 | lay->addWidget( label); |
1208 | lay->setMargin(7); | 1211 | lay->setMargin(7); |
1209 | lay->setSpacing(7); | 1212 | lay->setSpacing(7); |
1210 | if ( KSyncManager::mRequestedSyncEvent.isValid() ) { | 1213 | if ( KSyncManager::mRequestedSyncEvent.isValid() ) { |
1211 | int secs = QDateTime::currentDateTime().secsTo( KSyncManager::mRequestedSyncEvent ); | 1214 | int secs = QDateTime::currentDateTime().secsTo( KSyncManager::mRequestedSyncEvent ); |
1212 | if ( secs < 0 ) | 1215 | if ( secs < 0 ) |
1213 | secs = secs * (-1); | 1216 | secs = secs * (-1); |
1214 | if ( secs > 30 ) | 1217 | if ( secs > 30 ) |
1215 | //if ( true ) | 1218 | //if ( true ) |
1216 | { | 1219 | { |
1217 | QString warning = i18n("Clock skew of\nsyncing devices\nis %1 seconds!").arg( secs ); | 1220 | QString warning = i18n("Clock skew of\nsyncing devices\nis %1 seconds!").arg( secs ); |
1218 | QLabel* label = new QLabel( warning, mSyncActionDialog ); | 1221 | QLabel* label = new QLabel( warning, mSyncActionDialog ); |
1219 | label->setAlignment ( Qt::AlignHCenter ); | 1222 | label->setAlignment ( Qt::AlignHCenter ); |
1220 | lay->addWidget( label); | 1223 | lay->addWidget( label); |
1221 | if ( secs > 180 ) | 1224 | if ( secs > 180 ) |
1222 | { | 1225 | { |
1223 | if ( secs > 300 ) { | 1226 | if ( secs > 300 ) { |
1224 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(0, i18n("The clocks of the syncing\ndevices have a difference\n of more than 5 minutes.\nPlease adjust your clocks.\n<b>You may get wrong syncing results!<\b>\nPlease confirm synchronization!"), i18n("High clock skew!"),i18n("Synchronize!"))) { | 1227 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(0, i18n("The clocks of the syncing\ndevices have a difference\n of more than 5 minutes.\nPlease adjust your clocks.\n<b>You may get wrong syncing results!<\b>\nPlease confirm synchronization!"), i18n("High clock skew!"),i18n("Synchronize!"))) { |
1225 | qDebug("KSS::Sync cancelled ,cs"); | 1228 | qDebug("KSS::Sync cancelled ,cs"); |
1226 | return ; | 1229 | return ; |
1227 | } | 1230 | } |
1228 | } | 1231 | } |
1229 | QFont f = label->font(); | 1232 | QFont f = label->font(); |
1230 | f.setPointSize ( f.pointSize() *2 ); | 1233 | f.setPointSize ( f.pointSize() *2 ); |
1231 | f. setBold (true ); | 1234 | f. setBold (true ); |
1232 | QLabel* label = new QLabel( warning, mSyncActionDialog ); | 1235 | QLabel* label = new QLabel( warning, mSyncActionDialog ); |
1233 | label->setFont( f ); | 1236 | label->setFont( f ); |
1234 | warning = i18n("ADJUST\nYOUR\nCLOCKS!"); | 1237 | warning = i18n("ADJUST\nYOUR\nCLOCKS!"); |
1235 | label->setText( warning ); | 1238 | label->setText( warning ); |
1236 | label->setAlignment ( Qt::AlignHCenter ); | 1239 | label->setAlignment ( Qt::AlignHCenter ); |
1237 | lay->addWidget( label); | 1240 | lay->addWidget( label); |
1238 | mSyncActionDialog->setFixedSize( 230, 300); | 1241 | mSyncActionDialog->setFixedSize( 230, 300); |
1239 | } else { | 1242 | } else { |
1240 | mSyncActionDialog->setFixedSize( 230, 200); | 1243 | mSyncActionDialog->setFixedSize( 230, 200); |
1241 | } | 1244 | } |
1242 | } else { | 1245 | } else { |
1243 | mSyncActionDialog->setFixedSize( 230, 120); | 1246 | mSyncActionDialog->setFixedSize( 230, 120); |
1244 | } | 1247 | } |
1245 | } else | 1248 | } else |
1246 | mSyncActionDialog->setFixedSize( 230, 120); | 1249 | mSyncActionDialog->setFixedSize( 230, 120); |
1247 | mSyncActionDialog->show(); | 1250 | mSyncActionDialog->show(); |
1248 | mSyncActionDialog->raise(); | 1251 | mSyncActionDialog->raise(); |
1249 | emit request_file(); | 1252 | emit request_file(); |
1250 | qApp->processEvents(); | 1253 | qApp->processEvents(); |
1251 | QString fileName = mFileName; | 1254 | QString fileName = mFileName; |
1252 | QFile file( fileName ); | 1255 | QFile file( fileName ); |
1253 | if (!file.open( IO_ReadOnly ) ) { | 1256 | if (!file.open( IO_ReadOnly ) ) { |
1254 | delete mSyncActionDialog; | 1257 | delete mSyncActionDialog; |
1255 | mSyncActionDialog = 0; | 1258 | mSyncActionDialog = 0; |
1256 | qDebug("KSS::error open sync file: %s ", fileName.latin1()); | 1259 | qDebug("KSS::error open sync file: %s ", fileName.latin1()); |
1257 | mSocket->close(); | 1260 | mSocket->close(); |
1258 | if ( mSocket->state() == QSocket::Idle ) | 1261 | if ( mSocket->state() == QSocket::Idle ) |
1259 | QTimer::singleShot( 10, this , SLOT ( discardClient())); | 1262 | QTimer::singleShot( 10, this , SLOT ( discardClient())); |
1260 | return ; | 1263 | return ; |
1261 | 1264 | ||
1262 | } | 1265 | } |
1263 | mSyncActionDialog->setCaption( i18n("Sending file...") ); | 1266 | mSyncActionDialog->setCaption( i18n("Sending file...") ); |
1264 | QTextStream ts( &file ); | 1267 | QTextStream ts( &file ); |
1265 | ts.setEncoding( QTextStream::Latin1 ); | 1268 | ts.setEncoding( QTextStream::Latin1 ); |
1266 | 1269 | ||
1267 | QTextStream os( mSocket ); | 1270 | QTextStream os( mSocket ); |
1268 | os.setEncoding( QTextStream::Latin1 ); | 1271 | os.setEncoding( QTextStream::Latin1 ); |
1269 | while ( ! ts.atEnd() ) { | 1272 | while ( ! ts.atEnd() ) { |
1270 | os << ts.readLine() << "\r\n\r\n"; | 1273 | os << ts.readLine() << "\r\n\r\n"; |
1271 | } | 1274 | } |
1272 | //os << ts.read(); | 1275 | //os << ts.read(); |
1273 | file.close(); | 1276 | file.close(); |
1274 | mSyncActionDialog->setCaption( i18n("Waiting for synced file...") ); | 1277 | mSyncActionDialog->setCaption( i18n("Waiting for synced file...") ); |
1275 | mSocket->close(); | 1278 | mSocket->close(); |
1276 | if ( mSocket->state() == QSocket::Idle ) | 1279 | if ( mSocket->state() == QSocket::Idle ) |
1277 | QTimer::singleShot( 10, this , SLOT ( discardClient())); | 1280 | QTimer::singleShot( 10, this , SLOT ( discardClient())); |
1278 | } | 1281 | } |
1279 | void KServerSocket::get_file() | 1282 | void KServerSocket::get_file() |
1280 | { | 1283 | { |
1281 | mSyncActionDialog->setCaption( i18n("Receiving synced file...") ); | 1284 | mSyncActionDialog->setCaption( i18n("Receiving synced file...") ); |
1282 | 1285 | ||
1283 | piTime.start(); | 1286 | piTime.start(); |
1284 | piFileString = ""; | 1287 | piFileString = ""; |
1285 | QTimer::singleShot( 1, this , SLOT (readBackFileFromSocket( ) )); | 1288 | QTimer::singleShot( 1, this , SLOT (readBackFileFromSocket( ) )); |
1286 | } | 1289 | } |
1287 | 1290 | ||
1288 | 1291 | ||
1289 | void KServerSocket::readBackFileFromSocket() | 1292 | void KServerSocket::readBackFileFromSocket() |
1290 | { | 1293 | { |
1291 | //qDebug("readBackFileFromSocket() %d ", piTime.elapsed ()); | 1294 | //qDebug("readBackFileFromSocket() %d ", piTime.elapsed ()); |
1292 | while ( mSocket->canReadLine () ) { | 1295 | while ( mSocket->canReadLine () ) { |
1293 | piTime.restart(); | 1296 | piTime.restart(); |
1294 | QString line = mSocket->readLine (); | 1297 | QString line = mSocket->readLine (); |
1295 | piFileString += line; | 1298 | piFileString += line; |
1296 | //qDebug("readline: %s ", line.latin1()); | 1299 | //qDebug("readline: %s ", line.latin1()); |
1297 | mSyncActionDialog->setCaption( i18n("Received %1 bytes").arg( piFileString.length() ) ); | 1300 | mSyncActionDialog->setCaption( i18n("Received %1 bytes").arg( piFileString.length() ) ); |
1298 | 1301 | ||
1299 | } | 1302 | } |
1300 | if ( piTime.elapsed () < 3000 ) { | 1303 | if ( piTime.elapsed () < 3000 ) { |
1301 | // wait for more | 1304 | // wait for more |
1302 | //qDebug("waitformore "); | 1305 | //qDebug("waitformore "); |
1303 | QTimer::singleShot( 100, this , SLOT (readBackFileFromSocket( ) )); | 1306 | QTimer::singleShot( 100, this , SLOT (readBackFileFromSocket( ) )); |
1304 | return; | 1307 | return; |
1305 | } | 1308 | } |
1306 | QString fileName = mFileName; | 1309 | QString fileName = mFileName; |
1307 | QFile file ( fileName ); | 1310 | QFile file ( fileName ); |
1308 | if (!file.open( IO_WriteOnly ) ) { | 1311 | if (!file.open( IO_WriteOnly ) ) { |
1309 | delete mSyncActionDialog; | 1312 | delete mSyncActionDialog; |
1310 | mSyncActionDialog = 0; | 1313 | mSyncActionDialog = 0; |
1311 | qDebug("KSS:Error open read back file "); | 1314 | qDebug("KSS:Error open read back file "); |
1312 | piFileString = ""; | 1315 | piFileString = ""; |
diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h index 9a3066e..09bd1c1 100644 --- a/libkdepim/ksyncmanager.h +++ b/libkdepim/ksyncmanager.h | |||
@@ -1,225 +1,225 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KDE-Pim/Pi. | 2 | This file is part of KDE-Pim/Pi. |
3 | Copyright (c) 2004 Ulf Schenk | 3 | Copyright (c) 2004 Ulf Schenk |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | $Id$ | 20 | $Id$ |
21 | */ | 21 | */ |
22 | #ifndef _KSYNCMANAGER_H | 22 | #ifndef _KSYNCMANAGER_H |
23 | #define _KSYNCMANAGER_H | 23 | #define _KSYNCMANAGER_H |
24 | 24 | ||
25 | #include <qobject.h> | 25 | #include <qobject.h> |
26 | #include <qstring.h> | 26 | #include <qstring.h> |
27 | #include <qsocket.h> | 27 | #include <qsocket.h> |
28 | #include <qdatetime.h> | 28 | #include <qdatetime.h> |
29 | #include <qserversocket.h> | 29 | #include <qserversocket.h> |
30 | #include <qtextstream.h> | 30 | #include <qtextstream.h> |
31 | #include <qregexp.h> | 31 | #include <qregexp.h> |
32 | 32 | ||
33 | class QPopupMenu; | 33 | class QPopupMenu; |
34 | class KSyncProfile; | 34 | class KSyncProfile; |
35 | class KPimPrefs; | 35 | class KPimPrefs; |
36 | class QWidget; | 36 | class QWidget; |
37 | class KSyncManager; | 37 | class KSyncManager; |
38 | class KSyncInterface; | 38 | class KSyncInterface; |
39 | class QProgressBar; | 39 | class QProgressBar; |
40 | 40 | ||
41 | 41 | ||
42 | class KServerSocket : public QServerSocket | 42 | class KServerSocket : public QServerSocket |
43 | { | 43 | { |
44 | Q_OBJECT | 44 | Q_OBJECT |
45 | 45 | ||
46 | public: | 46 | public: |
47 | KServerSocket ( QString password, Q_UINT16 port, int backlog = 0, QObject * parent=0, const char * name=0 ); | 47 | KServerSocket ( QString password, Q_UINT16 port, int backlog = 0, QObject * parent=0, const char * name=0 ); |
48 | 48 | ||
49 | void newConnection ( int socket ) ; | 49 | void newConnection ( int socket ) ; |
50 | void setFileName( QString fn ) {mFileName = fn;}; | 50 | void setFileName( QString fn ) {mFileName = fn;}; |
51 | signals: | 51 | signals: |
52 | void file_received( bool ); | 52 | void file_received( bool ); |
53 | void request_file(); | 53 | void request_file(); |
54 | void saveFile(); | 54 | void saveFile(); |
55 | void endConnect(); | 55 | void endConnect(); |
56 | private slots: | 56 | private slots: |
57 | void discardClient(); | 57 | void discardClient(); |
58 | void readClient(); | 58 | void readClient(); |
59 | void readBackFileFromSocket(); | 59 | void readBackFileFromSocket(); |
60 | private : | 60 | private : |
61 | bool blockRC; | 61 | bool blockRC; |
62 | void send_file(); | 62 | void send_file(); |
63 | void get_file(); | 63 | void get_file(); |
64 | void end_connect(); | 64 | void end_connect(); |
65 | QDialog* mSyncActionDialog; | 65 | QDialog* mSyncActionDialog; |
66 | QSocket* mSocket; | 66 | QSocket* mSocket; |
67 | QString mPassWord; | 67 | QString mPassWord; |
68 | QString mFileName; | 68 | QString mFileName; |
69 | QTime piTime; | 69 | QTime piTime; |
70 | QString piFileString; | 70 | QString piFileString; |
71 | }; | 71 | }; |
72 | 72 | ||
73 | class KCommandSocket : public QObject | 73 | class KCommandSocket : public QObject |
74 | { | 74 | { |
75 | Q_OBJECT | 75 | Q_OBJECT |
76 | public: | 76 | public: |
77 | enum state { successR, errorR, successW, errorW, errorTO, quiet }; | 77 | enum state { successR, errorR, successW, errorW, errorTO, quiet }; |
78 | KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent=0, QWidget* cap = 0, const char * name=0 ); | 78 | KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent=0, QWidget* cap = 0, const char * name=0 ); |
79 | void readFile( QString ); | 79 | void readFile( QString ); |
80 | void writeFile( QString ); | 80 | void writeFile( QString ); |
81 | void sendStop(); | 81 | void sendStop(); |
82 | 82 | ||
83 | private slots : | 83 | private slots : |
84 | void sendFileRequest(); | 84 | void sendFileRequest(); |
85 | 85 | ||
86 | signals: | 86 | signals: |
87 | void commandFinished( KCommandSocket*, int ); | 87 | void commandFinished( KCommandSocket*, int ); |
88 | private slots: | 88 | private slots: |
89 | void startReadFileFromSocket(); | 89 | void startReadFileFromSocket(); |
90 | void readFileFromSocket(); | 90 | void readFileFromSocket(); |
91 | void deleteSocket(); | 91 | void deleteSocket(); |
92 | void writeFileToSocket(); | 92 | void writeFileToSocket(); |
93 | private : | 93 | private : |
94 | QWidget* tlw; | 94 | QWidget* tlw; |
95 | QSocket* mSocket; | 95 | QSocket* mSocket; |
96 | QString mPassWord; | 96 | QString mPassWord; |
97 | Q_UINT16 mPort; | 97 | Q_UINT16 mPort; |
98 | QString mHost; | 98 | QString mHost; |
99 | QString mFileName; | 99 | QString mFileName; |
100 | QTimer* mTimerSocket; | 100 | QTimer* mTimerSocket; |
101 | int mRetVal; | 101 | int mRetVal; |
102 | QTime mTime; | 102 | QTime mTime; |
103 | QString mFileString; | 103 | QString mFileString; |
104 | bool mFirst; | 104 | bool mFirst; |
105 | }; | 105 | }; |
106 | 106 | ||
107 | 107 | ||
108 | class KSyncManager : public QObject | 108 | class KSyncManager : public QObject |
109 | { | 109 | { |
110 | Q_OBJECT | 110 | Q_OBJECT |
111 | 111 | ||
112 | public: | 112 | public: |
113 | enum TargetApp { | 113 | enum TargetApp { |
114 | KOPI = 0, | 114 | KOPI = 0, |
115 | KAPI = 1, | 115 | KAPI = 1, |
116 | PWMPI = 2 }; | 116 | PWMPI = 2 }; |
117 | 117 | ||
118 | KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu); | 118 | KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu); |
119 | ~KSyncManager() ; | 119 | ~KSyncManager() ; |
120 | 120 | ||
121 | void multiSync( bool askforPrefs ); | 121 | void multiSync( bool askforPrefs ); |
122 | bool blockSave() { return mBlockSaveFlag; } | 122 | bool blockSave() { return mBlockSaveFlag; } |
123 | void setBlockSave(bool sa) { mBlockSaveFlag = sa; } | 123 | void setBlockSave(bool sa) { mBlockSaveFlag = sa; } |
124 | void setDefaultFileName( QString s) { mDefFileName = s ;} | 124 | void setDefaultFileName( QString s) ; |
125 | QString defaultFileName() { return mDefFileName ;} | 125 | QString defaultFileName() { return mDefFileName ;} |
126 | QString syncFileName(); | 126 | QString syncFileName(); |
127 | void enableQuick( bool ask = true); | 127 | void enableQuick( bool ask = true); |
128 | 128 | ||
129 | bool syncWithDesktop () { return mSyncWithDesktop;} | 129 | bool syncWithDesktop () { return mSyncWithDesktop;} |
130 | QString getCurrentSyncDevice() { return mCurrentSyncDevice; } | 130 | QString getCurrentSyncDevice() { return mCurrentSyncDevice; } |
131 | QString getCurrentSyncName() { return mCurrentSyncName; } | 131 | QString getCurrentSyncName() { return mCurrentSyncName; } |
132 | 132 | ||
133 | void showProgressBar(int percentage, QString caption = QString::null, int total=100); | 133 | void showProgressBar(int percentage, QString caption = QString::null, int total=100); |
134 | void hideProgressBar(); | 134 | void hideProgressBar(); |
135 | bool isProgressBarCanceled(); | 135 | bool isProgressBarCanceled(); |
136 | 136 | ||
137 | // sync stuff | 137 | // sync stuff |
138 | QString mLocalMachineName; | 138 | QString mLocalMachineName; |
139 | QStringList mExternSyncProfiles; | 139 | QStringList mExternSyncProfiles; |
140 | QStringList mSyncProfileNames; | 140 | QStringList mSyncProfileNames; |
141 | bool mAskForPreferences; | 141 | bool mAskForPreferences; |
142 | bool mShowSyncSummary; | 142 | bool mShowSyncSummary; |
143 | bool mIsKapiFile; | 143 | bool mIsKapiFile; |
144 | bool mWriteBackExistingOnly; | 144 | bool mWriteBackExistingOnly; |
145 | int mSyncAlgoPrefs; | 145 | int mSyncAlgoPrefs; |
146 | bool mWriteBackFile; | 146 | bool mWriteBackFile; |
147 | int mWriteBackInFuture; | 147 | int mWriteBackInFuture; |
148 | int mWriteBackInPast; | 148 | int mWriteBackInPast; |
149 | QString mPhoneDevice; | 149 | QString mPhoneDevice; |
150 | QString mPhoneConnection; | 150 | QString mPhoneConnection; |
151 | QString mPhoneModel; | 151 | QString mPhoneModel; |
152 | QString mPassWordPiSync; | 152 | QString mPassWordPiSync; |
153 | QString mActiveSyncPort; | 153 | QString mActiveSyncPort; |
154 | QString mActiveSyncIP ; | 154 | QString mActiveSyncIP ; |
155 | QString mFilterInCal; | 155 | QString mFilterInCal; |
156 | QString mFilterOutCal; | 156 | QString mFilterOutCal; |
157 | QString mFilterInAB; | 157 | QString mFilterInAB; |
158 | QString mFilterOutAB; | 158 | QString mFilterOutAB; |
159 | static QDateTime mRequestedSyncEvent; | 159 | static QDateTime mRequestedSyncEvent; |
160 | 160 | ||
161 | signals: | 161 | signals: |
162 | void save(); | 162 | void save(); |
163 | void request_file(); | 163 | void request_file(); |
164 | void getFile( bool ); | 164 | void getFile( bool ); |
165 | 165 | ||
166 | public slots: | 166 | public slots: |
167 | void slotSyncMenu( int ); | 167 | void slotSyncMenu( int ); |
168 | void slotClearMenu( int action ); | 168 | void slotClearMenu( int action ); |
169 | void deleteCommandSocket(KCommandSocket*s, int state); | 169 | void deleteCommandSocket(KCommandSocket*s, int state); |
170 | void readFileFromSocket(); | 170 | void readFileFromSocket(); |
171 | void fillSyncMenu(); | 171 | void fillSyncMenu(); |
172 | 172 | ||
173 | private: | 173 | private: |
174 | void syncPi(); | 174 | void syncPi(); |
175 | KServerSocket * mServerSocket; | 175 | KServerSocket * mServerSocket; |
176 | KPimPrefs* mPrefs; | 176 | KPimPrefs* mPrefs; |
177 | QString mDefFileName; | 177 | QString mDefFileName; |
178 | QString mCurrentSyncDevice; | 178 | QString mCurrentSyncDevice; |
179 | QString mCurrentSyncName; | 179 | QString mCurrentSyncName; |
180 | void quickSyncLocalFile(); | 180 | void quickSyncLocalFile(); |
181 | bool syncWithFile( QString fn , bool quick ); | 181 | bool syncWithFile( QString fn , bool quick ); |
182 | void syncLocalFile(); | 182 | void syncLocalFile(); |
183 | void syncPhone(); | 183 | void syncPhone(); |
184 | void syncSharp(); | 184 | void syncSharp(); |
185 | void syncKDE(); | 185 | void syncKDE(); |
186 | bool syncExternalApplication(QString); | 186 | bool syncExternalApplication(QString); |
187 | int mCurrentSyncProfile ; | 187 | int mCurrentSyncProfile ; |
188 | void syncRemote( KSyncProfile* prof, bool ask = true); | 188 | void syncRemote( KSyncProfile* prof, bool ask = true); |
189 | bool edit_sync_options(); | 189 | bool edit_sync_options(); |
190 | bool edit_pisync_options(); | 190 | bool edit_pisync_options(); |
191 | int ringSync(); | 191 | int ringSync(); |
192 | QString getPassword( ); | 192 | QString getPassword( ); |
193 | bool mPisyncFinished; | 193 | bool mPisyncFinished; |
194 | bool mBlockSaveFlag; | 194 | bool mBlockSaveFlag; |
195 | QWidget* mParent; | 195 | QWidget* mParent; |
196 | KSyncInterface* mImplementation; | 196 | KSyncInterface* mImplementation; |
197 | TargetApp mTargetApp; | 197 | TargetApp mTargetApp; |
198 | QPopupMenu* mSyncMenu; | 198 | QPopupMenu* mSyncMenu; |
199 | QProgressBar* bar; | 199 | QProgressBar* bar; |
200 | bool mSyncWithDesktop; | 200 | bool mSyncWithDesktop; |
201 | 201 | ||
202 | private slots: | 202 | private slots: |
203 | void confSync(); | 203 | void confSync(); |
204 | 204 | ||
205 | 205 | ||
206 | }; | 206 | }; |
207 | 207 | ||
208 | 208 | ||
209 | class KSyncInterface | 209 | class KSyncInterface |
210 | { | 210 | { |
211 | public : | 211 | public : |
212 | virtual void removeSyncInfo( QString syncProfile) = 0; | 212 | virtual void removeSyncInfo( QString syncProfile) = 0; |
213 | virtual bool sync(KSyncManager* manager, QString filename, int mode) = 0; | 213 | virtual bool sync(KSyncManager* manager, QString filename, int mode) = 0; |
214 | virtual bool syncExternal(KSyncManager* manager, QString resource) | 214 | virtual bool syncExternal(KSyncManager* manager, QString resource) |
215 | { | 215 | { |
216 | // empty implementation, because some syncable applications do not | 216 | // empty implementation, because some syncable applications do not |
217 | // have an external(sharpdtm) syncmode, like pwmanager. | 217 | // have an external(sharpdtm) syncmode, like pwmanager. |
218 | return false; | 218 | return false; |
219 | } | 219 | } |
220 | 220 | ||
221 | 221 | ||
222 | }; | 222 | }; |
223 | 223 | ||
224 | 224 | ||
225 | #endif | 225 | #endif |