author | zautrix <zautrix> | 2004-10-06 08:41:05 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-06 08:41:05 (UTC) |
commit | 641d3327a51405f7ed995bb5c58d0207de7b5ca2 (patch) (unidiff) | |
tree | 97526f04afd9d3df6244a64bb2e7f91a1c72d6ae | |
parent | 8e5089d2f2011e38d811ae0fc6b6d4edaeaf89b8 (diff) | |
download | kdepimpi-641d3327a51405f7ed995bb5c58d0207de7b5ca2.zip kdepimpi-641d3327a51405f7ed995bb5c58d0207de7b5ca2.tar.gz kdepimpi-641d3327a51405f7ed995bb5c58d0207de7b5ca2.tar.bz2 |
fixes in export phone dialog
-rw-r--r-- | korganizer/mainwindow.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index ef73a78..6a9a2f1 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -34,126 +34,129 @@ | |||
34 | #include <qapplication.h> | 34 | #include <qapplication.h> |
35 | //#include <resource.h> | 35 | //#include <resource.h> |
36 | 36 | ||
37 | #endif | 37 | #endif |
38 | #include <libkcal/calendarlocal.h> | 38 | #include <libkcal/calendarlocal.h> |
39 | #include <libkcal/todo.h> | 39 | #include <libkcal/todo.h> |
40 | #include <libkcal/phoneformat.h> | 40 | #include <libkcal/phoneformat.h> |
41 | #include <libkdepim/ksyncprofile.h> | 41 | #include <libkdepim/ksyncprofile.h> |
42 | #include <libkcal/kincidenceformatter.h> | 42 | #include <libkcal/kincidenceformatter.h> |
43 | #include <libkdepim/kpimglobalprefs.h> | 43 | #include <libkdepim/kpimglobalprefs.h> |
44 | 44 | ||
45 | #include "calendarview.h" | 45 | #include "calendarview.h" |
46 | #include "koviewmanager.h" | 46 | #include "koviewmanager.h" |
47 | #include "datenavigator.h" | 47 | #include "datenavigator.h" |
48 | #include "koagendaview.h" | 48 | #include "koagendaview.h" |
49 | #include "koagenda.h" | 49 | #include "koagenda.h" |
50 | #include "kodialogmanager.h" | 50 | #include "kodialogmanager.h" |
51 | #include "kdialogbase.h" | 51 | #include "kdialogbase.h" |
52 | #include "kapplication.h" | 52 | #include "kapplication.h" |
53 | #include "kofilterview.h" | 53 | #include "kofilterview.h" |
54 | #include "kstandarddirs.h" | 54 | #include "kstandarddirs.h" |
55 | #include "koprefs.h" | 55 | #include "koprefs.h" |
56 | #include "kfiledialog.h" | 56 | #include "kfiledialog.h" |
57 | #include "koglobals.h" | 57 | #include "koglobals.h" |
58 | #include "kglobal.h" | 58 | #include "kglobal.h" |
59 | #include "klocale.h" | 59 | #include "klocale.h" |
60 | #include "kconfig.h" | 60 | #include "kconfig.h" |
61 | #include "simplealarmclient.h" | 61 | #include "simplealarmclient.h" |
62 | #include "externalapphandler.h" | 62 | #include "externalapphandler.h" |
63 | 63 | ||
64 | using namespace KCal; | 64 | using namespace KCal; |
65 | #ifndef _WIN32_ | 65 | #ifndef _WIN32_ |
66 | #include <unistd.h> | 66 | #include <unistd.h> |
67 | #else | 67 | #else |
68 | #include "koimportoldialog.h" | 68 | #include "koimportoldialog.h" |
69 | #endif | 69 | #endif |
70 | #include "mainwindow.h" | 70 | #include "mainwindow.h" |
71 | 71 | ||
72 | class KOex2phonePrefs : public QDialog | 72 | class KOex2phonePrefs : public QDialog |
73 | { | 73 | { |
74 | public: | 74 | public: |
75 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : | 75 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : |
76 | QDialog( parent, name, true ) | 76 | QDialog( parent, name, true ) |
77 | { | 77 | { |
78 | setCaption( i18n("Export to phone options") ); | 78 | setCaption( i18n("Export to phone options") ); |
79 | QVBoxLayout* lay = new QVBoxLayout( this ); | 79 | QVBoxLayout* lay = new QVBoxLayout( this ); |
80 | lay->setSpacing( 3 ); | 80 | lay->setSpacing( 3 ); |
81 | lay->setMargin( 3 ); | 81 | lay->setMargin( 3 ); |
82 | 82 | QLabel *lab; | |
83 | lay->addWidget(new QLabel( i18n("Please read phone sync howto to\nknow more about the connection settings."), this ) ); | 83 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); |
84 | lab->setAlignment (AlignHCenter ); | ||
84 | QHBox* temphb; | 85 | QHBox* temphb; |
85 | temphb = new QHBox( this ); | 86 | temphb = new QHBox( this ); |
86 | new QLabel( i18n("I/O device: "), temphb ); | 87 | new QLabel( i18n("I/O device: "), temphb ); |
87 | mPhoneDevice = new QLineEdit( temphb); | 88 | mPhoneDevice = new QLineEdit( temphb); |
88 | lay->addWidget( temphb ); | 89 | lay->addWidget( temphb ); |
89 | temphb = new QHBox( this ); | 90 | temphb = new QHBox( this ); |
90 | new QLabel( i18n("Connection: "), temphb ); | 91 | new QLabel( i18n("Connection: "), temphb ); |
91 | mPhoneConnection = new QLineEdit( temphb); | 92 | mPhoneConnection = new QLineEdit( temphb); |
92 | lay->addWidget( temphb ); | 93 | lay->addWidget( temphb ); |
93 | temphb = new QHBox( this ); | 94 | temphb = new QHBox( this ); |
94 | new QLabel( i18n("Model(opt.): "), temphb ); | 95 | new QLabel( i18n("Model(opt.): "), temphb ); |
95 | mPhoneModel = new QLineEdit( temphb); | 96 | mPhoneModel = new QLineEdit( temphb); |
96 | lay->addWidget( temphb ); | 97 | lay->addWidget( temphb ); |
97 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); | 98 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); |
98 | mWriteBackFuture->setChecked( true ); | 99 | mWriteBackFuture->setChecked( true ); |
99 | lay->addWidget( mWriteBackFuture ); | 100 | lay->addWidget( mWriteBackFuture ); |
100 | temphb = new QHBox( this ); | 101 | temphb = new QHBox( this ); |
101 | new QLabel( i18n("Max. weeks in future: ") , temphb ); | 102 | new QLabel( i18n("Max. weeks in future: ") , temphb ); |
102 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); | 103 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); |
103 | mWriteBackFutureWeeks->setValue( 8 ); | 104 | mWriteBackFutureWeeks->setValue( 8 ); |
104 | lay->addWidget( temphb ); | 105 | lay->addWidget( temphb ); |
105 | QPushButton * ok = new QPushButton( i18n("Export!"), this ); | 106 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\n todo/calendar data on phone!"), this ) ); |
107 | lab->setAlignment (AlignHCenter ); | ||
108 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); | ||
106 | lay->addWidget( ok ); | 109 | lay->addWidget( ok ); |
107 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 110 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
108 | lay->addWidget( cancel ); | 111 | lay->addWidget( cancel ); |
109 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 112 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
110 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 113 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
111 | resize( 220, 220 ); | 114 | resize( 220, 240 ); |
112 | 115 | ||
113 | } | 116 | } |
114 | 117 | ||
115 | public: | 118 | public: |
116 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; | 119 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; |
117 | QCheckBox* mWriteBackFuture; | 120 | QCheckBox* mWriteBackFuture; |
118 | QSpinBox* mWriteBackFutureWeeks; | 121 | QSpinBox* mWriteBackFutureWeeks; |
119 | }; | 122 | }; |
120 | 123 | ||
121 | int globalFlagBlockStartup; | 124 | int globalFlagBlockStartup; |
122 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | 125 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : |
123 | QMainWindow( parent, name ) | 126 | QMainWindow( parent, name ) |
124 | { | 127 | { |
125 | mPassWordPiSync = "abc"; | 128 | mPassWordPiSync = "abc"; |
126 | #ifdef DESKTOP_VERSION | 129 | #ifdef DESKTOP_VERSION |
127 | setFont( QFont("Arial"), 14 ); | 130 | setFont( QFont("Arial"), 14 ); |
128 | #endif | 131 | #endif |
129 | mSyncActionDialog = 0; | 132 | mSyncActionDialog = 0; |
130 | mServerSocket = 0; | 133 | mServerSocket = 0; |
131 | mClosed = false; | 134 | mClosed = false; |
132 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; | 135 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; |
133 | QString confFile = locateLocal("config","korganizerrc"); | 136 | QString confFile = locateLocal("config","korganizerrc"); |
134 | QFileInfo finf ( confFile ); | 137 | QFileInfo finf ( confFile ); |
135 | bool showWarning = !finf.exists(); | 138 | bool showWarning = !finf.exists(); |
136 | setIcon(SmallIcon( "ko24" ) ); | 139 | setIcon(SmallIcon( "ko24" ) ); |
137 | mBlockAtStartup = true; | 140 | mBlockAtStartup = true; |
138 | mFlagKeyPressed = false; | 141 | mFlagKeyPressed = false; |
139 | setCaption("KOrganizer/Pi"); | 142 | setCaption("KOrganizer/Pi"); |
140 | KOPrefs *p = KOPrefs::instance(); | 143 | KOPrefs *p = KOPrefs::instance(); |
141 | KPimGlobalPrefs::instance()->setGlobalConfig(); | 144 | KPimGlobalPrefs::instance()->setGlobalConfig(); |
142 | // if ( QApplication::desktop()->height() > 480 ) { | 145 | // if ( QApplication::desktop()->height() > 480 ) { |
143 | // if ( p->mHourSize == 4 ) | 146 | // if ( p->mHourSize == 4 ) |
144 | // p->mHourSize = 6; | 147 | // p->mHourSize = 6; |
145 | // } | 148 | // } |
146 | if ( p->mHourSize > 18 ) | 149 | if ( p->mHourSize > 18 ) |
147 | p->mHourSize = 18; | 150 | p->mHourSize = 18; |
148 | QMainWindow::ToolBarDock tbd; | 151 | QMainWindow::ToolBarDock tbd; |
149 | if ( p->mToolBarHor ) { | 152 | if ( p->mToolBarHor ) { |
150 | if ( p->mToolBarUp ) | 153 | if ( p->mToolBarUp ) |
151 | tbd = Bottom; | 154 | tbd = Bottom; |
152 | else | 155 | else |
153 | tbd = Top; | 156 | tbd = Top; |
154 | } | 157 | } |
155 | else { | 158 | else { |
156 | if ( p->mToolBarUp ) | 159 | if ( p->mToolBarUp ) |
157 | tbd = Right; | 160 | tbd = Right; |
158 | else | 161 | else |
159 | tbd = Left; | 162 | tbd = Left; |
@@ -1112,96 +1115,100 @@ void MainWindow::slotSyncMenu( int action ) | |||
1112 | KOPrefs::instance()->mSyncAlgoPrefs = temp->getSyncPrefs(); | 1115 | KOPrefs::instance()->mSyncAlgoPrefs = temp->getSyncPrefs(); |
1113 | KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); | 1116 | KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); |
1114 | KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); | 1117 | KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); |
1115 | KOPrefs::instance()->mWriteBackInFuture = 0; | 1118 | KOPrefs::instance()->mWriteBackInFuture = 0; |
1116 | if ( temp->getWriteBackFuture() ) | 1119 | if ( temp->getWriteBackFuture() ) |
1117 | KOPrefs::instance()->mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); | 1120 | KOPrefs::instance()->mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); |
1118 | KOPrefs::instance()->mShowSyncSummary = temp->getShowSummaryAfterSync(); | 1121 | KOPrefs::instance()->mShowSyncSummary = temp->getShowSummaryAfterSync(); |
1119 | if ( action == 1000 ) { | 1122 | if ( action == 1000 ) { |
1120 | syncSharp(); | 1123 | syncSharp(); |
1121 | 1124 | ||
1122 | } else if ( action == 1001 ) { | 1125 | } else if ( action == 1001 ) { |
1123 | syncLocalFile(); | 1126 | syncLocalFile(); |
1124 | 1127 | ||
1125 | } else if ( action == 1002 ) { | 1128 | } else if ( action == 1002 ) { |
1126 | quickSyncLocalFile(); | 1129 | quickSyncLocalFile(); |
1127 | 1130 | ||
1128 | } else if ( action >= 1003 ) { | 1131 | } else if ( action >= 1003 ) { |
1129 | if ( temp->getIsLocalFileSync() ) { | 1132 | if ( temp->getIsLocalFileSync() ) { |
1130 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) | 1133 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) |
1131 | KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); | 1134 | KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); |
1132 | } else { | 1135 | } else { |
1133 | if ( temp->getIsPhoneSync() ) { | 1136 | if ( temp->getIsPhoneSync() ) { |
1134 | KOPrefs::instance()->mPhoneDevice = temp->getPhoneDevice( ) ; | 1137 | KOPrefs::instance()->mPhoneDevice = temp->getPhoneDevice( ) ; |
1135 | KOPrefs::instance()->mPhoneConnection = temp->getPhoneConnection( ); | 1138 | KOPrefs::instance()->mPhoneConnection = temp->getPhoneConnection( ); |
1136 | KOPrefs::instance()->mPhoneModel = temp->getPhoneModel( ); | 1139 | KOPrefs::instance()->mPhoneModel = temp->getPhoneModel( ); |
1137 | syncPhone(); | 1140 | syncPhone(); |
1138 | } else if ( temp->getIsPiSync() ) { | 1141 | } else if ( temp->getIsPiSync() ) { |
1139 | mPassWordPiSync = temp->getRemotePw(); | 1142 | mPassWordPiSync = temp->getRemotePw(); |
1140 | KOPrefs::instance()->mActiveSyncPort = temp->getRemotePort(); | 1143 | KOPrefs::instance()->mActiveSyncPort = temp->getRemotePort(); |
1141 | KOPrefs::instance()->mActiveSyncIP = temp->getRemoteIP(); | 1144 | KOPrefs::instance()->mActiveSyncIP = temp->getRemoteIP(); |
1142 | syncPi(); | 1145 | syncPi(); |
1143 | } else | 1146 | } else |
1144 | syncRemote( temp ); | 1147 | syncRemote( temp ); |
1145 | 1148 | ||
1146 | } | 1149 | } |
1147 | } | 1150 | } |
1148 | delete temp; | 1151 | delete temp; |
1149 | mBlockSaveFlag = false; | 1152 | mBlockSaveFlag = false; |
1150 | } | 1153 | } |
1151 | void MainWindow::exportToPhone( int mode ) | 1154 | void MainWindow::exportToPhone( int mode ) |
1152 | { | 1155 | { |
1153 | 1156 | ||
1154 | //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); | 1157 | //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); |
1155 | //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); | 1158 | //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); |
1156 | KOex2phonePrefs ex2phone; | 1159 | KOex2phonePrefs ex2phone; |
1157 | ex2phone.mPhoneConnection->setText( KOPrefs::instance()->mEx2PhoneConnection ); | 1160 | ex2phone.mPhoneConnection->setText( KOPrefs::instance()->mEx2PhoneConnection ); |
1158 | ex2phone.mPhoneDevice->setText( KOPrefs::instance()->mEx2PhoneDevice ); | 1161 | ex2phone.mPhoneDevice->setText( KOPrefs::instance()->mEx2PhoneDevice ); |
1159 | ex2phone.mPhoneModel->setText( KOPrefs::instance()->mEx2PhoneModel ); | 1162 | ex2phone.mPhoneModel->setText( KOPrefs::instance()->mEx2PhoneModel ); |
1163 | if ( mode == 1 ) | ||
1164 | ex2phone.setCaption(i18n("Export complete calendar")); | ||
1165 | if ( mode == 2 ) | ||
1166 | ex2phone.setCaption(i18n("Export filtered calendar")); | ||
1160 | 1167 | ||
1161 | if ( !ex2phone.exec() ) { | 1168 | if ( !ex2phone.exec() ) { |
1162 | return; | 1169 | return; |
1163 | } | 1170 | } |
1164 | KOPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); | 1171 | KOPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); |
1165 | KOPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); | 1172 | KOPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); |
1166 | KOPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); | 1173 | KOPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); |
1167 | 1174 | ||
1168 | int inFuture = 0; | 1175 | int inFuture = 0; |
1169 | if ( ex2phone.mWriteBackFuture->isChecked() ) | 1176 | if ( ex2phone.mWriteBackFuture->isChecked() ) |
1170 | inFuture = ex2phone.mWriteBackFutureWeeks->value(); | 1177 | inFuture = ex2phone.mWriteBackFutureWeeks->value(); |
1171 | QPtrList<Incidence> delSel; | 1178 | QPtrList<Incidence> delSel; |
1172 | if ( mode == 1 ) | 1179 | if ( mode == 1 ) |
1173 | delSel = mCalendar->rawIncidences(); | 1180 | delSel = mCalendar->rawIncidences(); |
1174 | if ( mode == 2 ) | 1181 | if ( mode == 2 ) |
1175 | delSel = mCalendar->incidences(); | 1182 | delSel = mCalendar->incidences(); |
1176 | CalendarLocal* cal = new CalendarLocal(); | 1183 | CalendarLocal* cal = new CalendarLocal(); |
1177 | cal->setLocalTime(); | 1184 | cal->setLocalTime(); |
1178 | Incidence *incidence = delSel.first(); | 1185 | Incidence *incidence = delSel.first(); |
1179 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); | 1186 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); |
1180 | QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); | 1187 | QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); |
1181 | while ( incidence ) { | 1188 | while ( incidence ) { |
1182 | if ( incidence->type() != "journal" ) { | 1189 | if ( incidence->type() != "journal" ) { |
1183 | bool add = true; | 1190 | bool add = true; |
1184 | if ( inFuture ) { | 1191 | if ( inFuture ) { |
1185 | QDateTime dt; | 1192 | QDateTime dt; |
1186 | if ( incidence->type() == "Todo" ) { | 1193 | if ( incidence->type() == "Todo" ) { |
1187 | Todo * t = (Todo*)incidence; | 1194 | Todo * t = (Todo*)incidence; |
1188 | if ( t->hasDueDate() ) | 1195 | if ( t->hasDueDate() ) |
1189 | dt = t->dtDue(); | 1196 | dt = t->dtDue(); |
1190 | else | 1197 | else |
1191 | dt = cur.addSecs( 62 ); | 1198 | dt = cur.addSecs( 62 ); |
1192 | } | 1199 | } |
1193 | else { | 1200 | else { |
1194 | bool ok; | 1201 | bool ok; |
1195 | dt = incidence->getNextOccurence( cur, &ok ); | 1202 | dt = incidence->getNextOccurence( cur, &ok ); |
1196 | if ( !ok ) | 1203 | if ( !ok ) |
1197 | dt = cur.addSecs( -62 ); | 1204 | dt = cur.addSecs( -62 ); |
1198 | } | 1205 | } |
1199 | if ( dt < cur || dt > end ) { | 1206 | if ( dt < cur || dt > end ) { |
1200 | add = false; | 1207 | add = false; |
1201 | } | 1208 | } |
1202 | } | 1209 | } |
1203 | if ( add ) { | 1210 | if ( add ) { |
1204 | Incidence *in = incidence->clone(); | 1211 | Incidence *in = incidence->clone(); |
1205 | cal->addIncidence( in ); | 1212 | cal->addIncidence( in ); |
1206 | } | 1213 | } |
1207 | } | 1214 | } |