author | zautrix <zautrix> | 2004-08-01 13:25:33 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-08-01 13:25:33 (UTC) |
commit | 043f0968a982bd7d2d288615530f8976aeb98002 (patch) (unidiff) | |
tree | 275caee79fbe7e6517068336cfa421cb6eefc0db | |
parent | 2de3f124cc4c2fb542b3ebf7cfc944f69a211b0f (diff) | |
download | kdepimpi-043f0968a982bd7d2d288615530f8976aeb98002.zip kdepimpi-043f0968a982bd7d2d288615530f8976aeb98002.tar.gz kdepimpi-043f0968a982bd7d2d288615530f8976aeb98002.tar.bz2 |
sync dialog moved
-rw-r--r-- | korganizer/calendarview.cpp | 6 | ||||
-rw-r--r-- | korganizer/kosyncprefsdialog.cpp | 468 | ||||
-rw-r--r-- | korganizer/kosyncprefsdialog.h | 113 |
3 files changed, 3 insertions, 584 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index c75d10e..387b751 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -1,157 +1,157 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | 3 | ||
4 | Requires the Qt and KDE widget libraries, available at no cost at | 4 | Requires the Qt and KDE widget libraries, available at no cost at |
5 | http://www.troll.no and http://www.kde.org respectively | 5 | http://www.troll.no and http://www.kde.org respectively |
6 | 6 | ||
7 | Copyright (c) 1997, 1998, 1999 | 7 | Copyright (c) 1997, 1998, 1999 |
8 | Preston Brown (preston.brown@yale.edu) | 8 | Preston Brown (preston.brown@yale.edu) |
9 | Fester Zigterman (F.J.F.ZigtermanRustenburg@student.utwente.nl) | 9 | Fester Zigterman (F.J.F.ZigtermanRustenburg@student.utwente.nl) |
10 | Ian Dawes (iadawes@globalserve.net) | 10 | Ian Dawes (iadawes@globalserve.net) |
11 | Laszlo Boloni (boloni@cs.purdue.edu) | 11 | Laszlo Boloni (boloni@cs.purdue.edu) |
12 | 12 | ||
13 | Copyright (c) 2000, 2001, 2002 | 13 | Copyright (c) 2000, 2001, 2002 |
14 | Cornelius Schumacher <schumacher@kde.org> | 14 | Cornelius Schumacher <schumacher@kde.org> |
15 | 15 | ||
16 | This program is free software; you can redistribute it and/or modify | 16 | This program is free software; you can redistribute it and/or modify |
17 | it under the terms of the GNU General Public License as published by | 17 | it under the terms of the GNU General Public License as published by |
18 | the Free Software Foundation; either version 2 of the License, or | 18 | the Free Software Foundation; either version 2 of the License, or |
19 | (at your option) any later version. | 19 | (at your option) any later version. |
20 | 20 | ||
21 | This program is distributed in the hope that it will be useful, | 21 | This program is distributed in the hope that it will be useful, |
22 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 22 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
23 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the | 23 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the |
24 | GNU General Public License for more details. | 24 | GNU General Public License for more details. |
25 | 25 | ||
26 | You should have received a copy of the GNU General Public License | 26 | You should have received a copy of the GNU General Public License |
27 | along with this program; if not, write to the Free Software | 27 | along with this program; if not, write to the Free Software |
28 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 28 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include <stdlib.h> | 31 | #include <stdlib.h> |
32 | 32 | ||
33 | #include <qapplication.h> | 33 | #include <qapplication.h> |
34 | #include <qradiobutton.h> | 34 | #include <qradiobutton.h> |
35 | #include <qbuttongroup.h> | 35 | #include <qbuttongroup.h> |
36 | #include <qlayout.h> | 36 | #include <qlayout.h> |
37 | #include <qclipboard.h> | 37 | #include <qclipboard.h> |
38 | #include <qcursor.h> | 38 | #include <qcursor.h> |
39 | #include <qmessagebox.h> | 39 | #include <qmessagebox.h> |
40 | #include <qprogressbar.h> | 40 | #include <qprogressbar.h> |
41 | #include <qmultilineedit.h> | 41 | #include <qmultilineedit.h> |
42 | #include <qtimer.h> | 42 | #include <qtimer.h> |
43 | #include <qwidgetstack.h> | 43 | #include <qwidgetstack.h> |
44 | #include <qptrlist.h> | 44 | #include <qptrlist.h> |
45 | #include <qregexp.h> | 45 | #include <qregexp.h> |
46 | #include <qgroupbox.h> | 46 | #include <qgroupbox.h> |
47 | #include <qfile.h> | 47 | #include <qfile.h> |
48 | #include <qdir.h> | 48 | #include <qdir.h> |
49 | #ifndef KORG_NOSPLITTER | 49 | #ifndef KORG_NOSPLITTER |
50 | #include <qsplitter.h> | 50 | #include <qsplitter.h> |
51 | #endif | 51 | #endif |
52 | 52 | ||
53 | #include <kglobal.h> | 53 | #include <kglobal.h> |
54 | #include <kdebug.h> | 54 | #include <kdebug.h> |
55 | #include <kstandarddirs.h> | 55 | #include <kstandarddirs.h> |
56 | #include <kfiledialog.h> | 56 | #include <kfiledialog.h> |
57 | #include <kmessagebox.h> | 57 | #include <kmessagebox.h> |
58 | #include <knotifyclient.h> | 58 | #include <knotifyclient.h> |
59 | #include <kconfig.h> | 59 | #include <kconfig.h> |
60 | 60 | ||
61 | #include "kosyncprefsdialog.h" | 61 | #include <libkdepim/ksyncprefsdialog.h> |
62 | #include <krun.h> | 62 | #include <krun.h> |
63 | #include <kdirwatch.h> | 63 | #include <kdirwatch.h> |
64 | #include <libkdepim/kdatepicker.h> | 64 | #include <libkdepim/kdatepicker.h> |
65 | #include <libkdepim/ksyncprofile.h> | 65 | #include <libkdepim/ksyncprofile.h> |
66 | 66 | ||
67 | #include <libkcal/vcaldrag.h> | 67 | #include <libkcal/vcaldrag.h> |
68 | #include <libkcal/icaldrag.h> | 68 | #include <libkcal/icaldrag.h> |
69 | #include <libkcal/icalformat.h> | 69 | #include <libkcal/icalformat.h> |
70 | #include <libkcal/vcalformat.h> | 70 | #include <libkcal/vcalformat.h> |
71 | #include <libkcal/scheduler.h> | 71 | #include <libkcal/scheduler.h> |
72 | #include <libkcal/calendarlocal.h> | 72 | #include <libkcal/calendarlocal.h> |
73 | #include <libkcal/journal.h> | 73 | #include <libkcal/journal.h> |
74 | #include <libkcal/calfilter.h> | 74 | #include <libkcal/calfilter.h> |
75 | #include <libkcal/attendee.h> | 75 | #include <libkcal/attendee.h> |
76 | #include <libkcal/dndfactory.h> | 76 | #include <libkcal/dndfactory.h> |
77 | #include <libkcal/freebusy.h> | 77 | #include <libkcal/freebusy.h> |
78 | #include <libkcal/filestorage.h> | 78 | #include <libkcal/filestorage.h> |
79 | #include <libkcal/calendarresources.h> | 79 | #include <libkcal/calendarresources.h> |
80 | #include <libkcal/qtopiaformat.h> | 80 | #include <libkcal/qtopiaformat.h> |
81 | #include "../kalarmd/alarmdialog.h" | 81 | #include "../kalarmd/alarmdialog.h" |
82 | 82 | ||
83 | #ifndef DESKTOP_VERSION | 83 | #ifndef DESKTOP_VERSION |
84 | #include <libkcal/sharpformat.h> | 84 | #include <libkcal/sharpformat.h> |
85 | #endif | 85 | #endif |
86 | #ifndef KORG_NOMAIL | 86 | #ifndef KORG_NOMAIL |
87 | #include "komailclient.h" | 87 | #include "komailclient.h" |
88 | #endif | 88 | #endif |
89 | #ifndef KORG_NOPRINTER | 89 | #ifndef KORG_NOPRINTER |
90 | #include "calprinter.h" | 90 | #include "calprinter.h" |
91 | #endif | 91 | #endif |
92 | #ifndef KORG_NOPLUGINS | 92 | #ifndef KORG_NOPLUGINS |
93 | #include "kocore.h" | 93 | #include "kocore.h" |
94 | #endif | 94 | #endif |
95 | #include "koeventeditor.h" | 95 | #include "koeventeditor.h" |
96 | #include "kotodoeditor.h" | 96 | #include "kotodoeditor.h" |
97 | #include "koprefs.h" | 97 | #include "koprefs.h" |
98 | #include "koeventviewerdialog.h" | 98 | #include "koeventviewerdialog.h" |
99 | #include "publishdialog.h" | 99 | #include "publishdialog.h" |
100 | #include "kofilterview.h" | 100 | #include "kofilterview.h" |
101 | #include "koglobals.h" | 101 | #include "koglobals.h" |
102 | #include "koviewmanager.h" | 102 | #include "koviewmanager.h" |
103 | #include "koagendaview.h" | 103 | #include "koagendaview.h" |
104 | #include "kodialogmanager.h" | 104 | #include "kodialogmanager.h" |
105 | #include "outgoingdialog.h" | 105 | #include "outgoingdialog.h" |
106 | #include "incomingdialog.h" | 106 | #include "incomingdialog.h" |
107 | #include "statusdialog.h" | 107 | #include "statusdialog.h" |
108 | #include "kdatenavigator.h" | 108 | #include "kdatenavigator.h" |
109 | #include "kotodoview.h" | 109 | #include "kotodoview.h" |
110 | #include "datenavigator.h" | 110 | #include "datenavigator.h" |
111 | #include "resourceview.h" | 111 | #include "resourceview.h" |
112 | #include "navigatorbar.h" | 112 | #include "navigatorbar.h" |
113 | #include "searchdialog.h" | 113 | #include "searchdialog.h" |
114 | #include "mainwindow.h" | 114 | #include "mainwindow.h" |
115 | 115 | ||
116 | #include "calendarview.h" | 116 | #include "calendarview.h" |
117 | #ifndef DESKTOP_VERSION | 117 | #ifndef DESKTOP_VERSION |
118 | #include <qtopia/alarmserver.h> | 118 | #include <qtopia/alarmserver.h> |
119 | #endif | 119 | #endif |
120 | #ifndef _WIN32_ | 120 | #ifndef _WIN32_ |
121 | #include <stdlib.h> | 121 | #include <stdlib.h> |
122 | #include <stdio.h> | 122 | #include <stdio.h> |
123 | #include <unistd.h> | 123 | #include <unistd.h> |
124 | #else | 124 | #else |
125 | #include <qprocess.h> | 125 | #include <qprocess.h> |
126 | #endif | 126 | #endif |
127 | using namespace KOrg; | 127 | using namespace KOrg; |
128 | using namespace KCal; | 128 | using namespace KCal; |
129 | extern int globalFlagBlockAgenda; | 129 | extern int globalFlagBlockAgenda; |
130 | extern int globalFlagBlockStartup; | 130 | extern int globalFlagBlockStartup; |
131 | 131 | ||
132 | 132 | ||
133 | 133 | ||
134 | class KOBeamPrefs : public QDialog | 134 | class KOBeamPrefs : public QDialog |
135 | { | 135 | { |
136 | public: | 136 | public: |
137 | KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : | 137 | KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : |
138 | QDialog( parent, name, true ) | 138 | QDialog( parent, name, true ) |
139 | { | 139 | { |
140 | setCaption( i18n("Beam Options") ); | 140 | setCaption( i18n("Beam Options") ); |
141 | QVBoxLayout* lay = new QVBoxLayout( this ); | 141 | QVBoxLayout* lay = new QVBoxLayout( this ); |
142 | lay->setSpacing( 3 ); | 142 | lay->setSpacing( 3 ); |
143 | lay->setMargin( 3 ); | 143 | lay->setMargin( 3 ); |
144 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); | 144 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); |
145 | lay->addWidget( format ); | 145 | lay->addWidget( format ); |
146 | format->setExclusive ( true ) ; | 146 | format->setExclusive ( true ) ; |
147 | QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); | 147 | QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); |
148 | lay->addWidget( time ); time->setExclusive ( true ) ; | 148 | lay->addWidget( time ); time->setExclusive ( true ) ; |
149 | vcal = new QRadioButton(" vCalendar ", format ); | 149 | vcal = new QRadioButton(" vCalendar ", format ); |
150 | ical = new QRadioButton(" iCalendar ", format ); | 150 | ical = new QRadioButton(" iCalendar ", format ); |
151 | vcal->setChecked( true ); | 151 | vcal->setChecked( true ); |
152 | tz = new QRadioButton(i18n(" With timezone "), time ); | 152 | tz = new QRadioButton(i18n(" With timezone "), time ); |
153 | local = new QRadioButton(i18n(" Local time "), time ); | 153 | local = new QRadioButton(i18n(" Local time "), time ); |
154 | tz->setChecked( true ); | 154 | tz->setChecked( true ); |
155 | QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); | 155 | QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); |
156 | lay->addWidget( ok ); | 156 | lay->addWidget( ok ); |
157 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 157 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
@@ -592,195 +592,195 @@ void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString ¬i ) | |||
592 | { | 592 | { |
593 | //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 593 | //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
594 | 594 | ||
595 | mSuspendAlarmNotification = noti; | 595 | mSuspendAlarmNotification = noti; |
596 | int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; | 596 | int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; |
597 | //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); | 597 | //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); |
598 | mSuspendTimer->start( ms , true ); | 598 | mSuspendTimer->start( ms , true ); |
599 | 599 | ||
600 | } | 600 | } |
601 | 601 | ||
602 | void CalendarView::addAlarm(const QDateTime &qdt, const QString ¬i ) | 602 | void CalendarView::addAlarm(const QDateTime &qdt, const QString ¬i ) |
603 | { | 603 | { |
604 | //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 604 | //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
605 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { | 605 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { |
606 | #ifndef DESKTOP_VERSION | 606 | #ifndef DESKTOP_VERSION |
607 | AlarmServer::addAlarm ( qdt,"koalarm", noti.latin1() ); | 607 | AlarmServer::addAlarm ( qdt,"koalarm", noti.latin1() ); |
608 | #endif | 608 | #endif |
609 | return; | 609 | return; |
610 | } | 610 | } |
611 | int maxSec; | 611 | int maxSec; |
612 | //maxSec = 5; //testing only | 612 | //maxSec = 5; //testing only |
613 | maxSec = 86400+3600; // one day+1hour | 613 | maxSec = 86400+3600; // one day+1hour |
614 | mAlarmNotification = noti; | 614 | mAlarmNotification = noti; |
615 | int sec = QDateTime::currentDateTime().secsTo( qdt ); | 615 | int sec = QDateTime::currentDateTime().secsTo( qdt ); |
616 | if ( sec > maxSec ) { | 616 | if ( sec > maxSec ) { |
617 | mRecheckAlarmTimer->start( maxSec * 1000 ); | 617 | mRecheckAlarmTimer->start( maxSec * 1000 ); |
618 | // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); | 618 | // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); |
619 | return; | 619 | return; |
620 | } else { | 620 | } else { |
621 | mRecheckAlarmTimer->stop(); | 621 | mRecheckAlarmTimer->stop(); |
622 | } | 622 | } |
623 | //qDebug("Alarm timer started with secs: %d ", sec); | 623 | //qDebug("Alarm timer started with secs: %d ", sec); |
624 | mAlarmTimer->start( sec *1000 , true ); | 624 | mAlarmTimer->start( sec *1000 , true ); |
625 | 625 | ||
626 | } | 626 | } |
627 | // called by mRecheckAlarmTimer to get next alarm | 627 | // called by mRecheckAlarmTimer to get next alarm |
628 | // we need this, because a QTimer has only a max range of 25 days | 628 | // we need this, because a QTimer has only a max range of 25 days |
629 | void CalendarView::recheckTimerAlarm() | 629 | void CalendarView::recheckTimerAlarm() |
630 | { | 630 | { |
631 | mAlarmTimer->stop(); | 631 | mAlarmTimer->stop(); |
632 | mRecheckAlarmTimer->stop(); | 632 | mRecheckAlarmTimer->stop(); |
633 | mCalendar->checkAlarmForIncidence( 0, true ); | 633 | mCalendar->checkAlarmForIncidence( 0, true ); |
634 | } | 634 | } |
635 | void CalendarView::removeAlarm(const QDateTime &qdt, const QString ¬i ) | 635 | void CalendarView::removeAlarm(const QDateTime &qdt, const QString ¬i ) |
636 | { | 636 | { |
637 | //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 637 | //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
638 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { | 638 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { |
639 | #ifndef DESKTOP_VERSION | 639 | #ifndef DESKTOP_VERSION |
640 | AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); | 640 | AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); |
641 | #endif | 641 | #endif |
642 | return; | 642 | return; |
643 | } | 643 | } |
644 | mAlarmTimer->stop(); | 644 | mAlarmTimer->stop(); |
645 | } | 645 | } |
646 | void CalendarView::selectWeekNum ( int num ) | 646 | void CalendarView::selectWeekNum ( int num ) |
647 | { | 647 | { |
648 | dateNavigator()->selectWeek( num ); | 648 | dateNavigator()->selectWeek( num ); |
649 | mViewManager->showWeekView(); | 649 | mViewManager->showWeekView(); |
650 | } | 650 | } |
651 | KOViewManager *CalendarView::viewManager() | 651 | KOViewManager *CalendarView::viewManager() |
652 | { | 652 | { |
653 | return mViewManager; | 653 | return mViewManager; |
654 | } | 654 | } |
655 | 655 | ||
656 | KODialogManager *CalendarView::dialogManager() | 656 | KODialogManager *CalendarView::dialogManager() |
657 | { | 657 | { |
658 | return mDialogManager; | 658 | return mDialogManager; |
659 | } | 659 | } |
660 | 660 | ||
661 | QDate CalendarView::startDate() | 661 | QDate CalendarView::startDate() |
662 | { | 662 | { |
663 | DateList dates = mNavigator->selectedDates(); | 663 | DateList dates = mNavigator->selectedDates(); |
664 | 664 | ||
665 | return dates.first(); | 665 | return dates.first(); |
666 | } | 666 | } |
667 | 667 | ||
668 | QDate CalendarView::endDate() | 668 | QDate CalendarView::endDate() |
669 | { | 669 | { |
670 | DateList dates = mNavigator->selectedDates(); | 670 | DateList dates = mNavigator->selectedDates(); |
671 | 671 | ||
672 | return dates.last(); | 672 | return dates.last(); |
673 | } | 673 | } |
674 | 674 | ||
675 | 675 | ||
676 | void CalendarView::createPrinter() | 676 | void CalendarView::createPrinter() |
677 | { | 677 | { |
678 | #ifndef KORG_NOPRINTER | 678 | #ifndef KORG_NOPRINTER |
679 | if (!mCalPrinter) { | 679 | if (!mCalPrinter) { |
680 | mCalPrinter = new CalPrinter(this, mCalendar); | 680 | mCalPrinter = new CalPrinter(this, mCalendar); |
681 | connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig())); | 681 | connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig())); |
682 | } | 682 | } |
683 | #endif | 683 | #endif |
684 | } | 684 | } |
685 | 685 | ||
686 | void CalendarView::confSync() | 686 | void CalendarView::confSync() |
687 | { | 687 | { |
688 | static KOSyncPrefsDialog* sp = 0; | 688 | static KSyncPrefsDialog* sp = 0; |
689 | if ( ! sp ) { | 689 | if ( ! sp ) { |
690 | sp = new KOSyncPrefsDialog( this, "syncprefs", true ); | 690 | sp = new KSyncPrefsDialog( this, "syncprefs", true ); |
691 | } | 691 | } |
692 | sp->setLocalMachineName ( KOPrefs::instance()->mLocalMachineName ); | 692 | sp->setLocalMachineName ( KOPrefs::instance()->mLocalMachineName ); |
693 | sp->usrReadConfig(); | 693 | sp->usrReadConfig(); |
694 | #ifndef DESKTOP_VERSION | 694 | #ifndef DESKTOP_VERSION |
695 | sp->showMaximized(); | 695 | sp->showMaximized(); |
696 | #else | 696 | #else |
697 | sp->show(); | 697 | sp->show(); |
698 | #endif | 698 | #endif |
699 | sp->exec(); | 699 | sp->exec(); |
700 | KOPrefs::instance()->mSyncProfileNames = sp->getSyncProfileNames(); | 700 | KOPrefs::instance()->mSyncProfileNames = sp->getSyncProfileNames(); |
701 | KOPrefs::instance()->mLocalMachineName = sp->getLocalMachineName (); | 701 | KOPrefs::instance()->mLocalMachineName = sp->getLocalMachineName (); |
702 | } | 702 | } |
703 | 703 | ||
704 | 704 | ||
705 | //KOPrefs::instance()->mWriteBackFile | 705 | //KOPrefs::instance()->mWriteBackFile |
706 | //KOPrefs::instance()->mWriteBackExistingOnly | 706 | //KOPrefs::instance()->mWriteBackExistingOnly |
707 | 707 | ||
708 | // 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); | 708 | // 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); |
709 | // 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); | 709 | // 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); |
710 | // 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); | 710 | // 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); |
711 | // 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); | 711 | // 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); |
712 | // 4 syncPrefsGroup->addRadio(i18n("Force take local entry always")); | 712 | // 4 syncPrefsGroup->addRadio(i18n("Force take local entry always")); |
713 | // 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); | 713 | // 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); |
714 | 714 | ||
715 | int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full ) | 715 | int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full ) |
716 | { | 716 | { |
717 | 717 | ||
718 | //void setZaurusId(int id); | 718 | //void setZaurusId(int id); |
719 | // int zaurusId() const; | 719 | // int zaurusId() const; |
720 | // void setZaurusUid(int id); | 720 | // void setZaurusUid(int id); |
721 | // int zaurusUid() const; | 721 | // int zaurusUid() const; |
722 | // void setZaurusStat(int id); | 722 | // void setZaurusStat(int id); |
723 | // int zaurusStat() const; | 723 | // int zaurusStat() const; |
724 | // 0 equal | 724 | // 0 equal |
725 | // 1 take local | 725 | // 1 take local |
726 | // 2 take remote | 726 | // 2 take remote |
727 | // 3 cancel | 727 | // 3 cancel |
728 | QDateTime lastSync = mLastCalendarSync; | 728 | QDateTime lastSync = mLastCalendarSync; |
729 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 729 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
730 | bool remCh, locCh; | 730 | bool remCh, locCh; |
731 | remCh = ( remote->zaurusUid() != local->zaurusUid() ); | 731 | remCh = ( remote->zaurusUid() != local->zaurusUid() ); |
732 | locCh = ( local->lastModified() > mLastCalendarSync ); | 732 | locCh = ( local->lastModified() > mLastCalendarSync ); |
733 | //qDebug("locCh %d remCh %d locuid %d remuid %d", locCh, remCh,local->zaurusUid(), remote->zaurusUid() ); | 733 | //qDebug("locCh %d remCh %d locuid %d remuid %d", locCh, remCh,local->zaurusUid(), remote->zaurusUid() ); |
734 | if ( !remCh && ! locCh ) { | 734 | if ( !remCh && ! locCh ) { |
735 | //qDebug("both not changed "); | 735 | //qDebug("both not changed "); |
736 | lastSync = local->lastModified().addDays(1); | 736 | lastSync = local->lastModified().addDays(1); |
737 | } else { | 737 | } else { |
738 | if ( locCh ) { | 738 | if ( locCh ) { |
739 | //qDebug("loc changed %d %d", local->zaurusStat(), local->revision() ); | 739 | //qDebug("loc changed %d %d", local->zaurusStat(), local->revision() ); |
740 | lastSync = local->lastModified().addDays( -1 ); | 740 | lastSync = local->lastModified().addDays( -1 ); |
741 | if ( !remCh ) | 741 | if ( !remCh ) |
742 | remote->setLastModified( lastSync.addDays( -1 ) ); | 742 | remote->setLastModified( lastSync.addDays( -1 ) ); |
743 | } else { | 743 | } else { |
744 | //qDebug(" not loc changed "); | 744 | //qDebug(" not loc changed "); |
745 | lastSync = local->lastModified().addDays( 1 ); | 745 | lastSync = local->lastModified().addDays( 1 ); |
746 | if ( remCh ) | 746 | if ( remCh ) |
747 | remote->setLastModified( lastSync.addDays( 1 ) ); | 747 | remote->setLastModified( lastSync.addDays( 1 ) ); |
748 | 748 | ||
749 | } | 749 | } |
750 | } | 750 | } |
751 | full = true; | 751 | full = true; |
752 | if ( mode < SYNC_PREF_ASK ) | 752 | if ( mode < SYNC_PREF_ASK ) |
753 | mode = SYNC_PREF_ASK; | 753 | mode = SYNC_PREF_ASK; |
754 | } else { | 754 | } else { |
755 | if ( local->lastModified() == remote->lastModified() ) | 755 | if ( local->lastModified() == remote->lastModified() ) |
756 | if ( local->revision() == remote->revision() ) | 756 | if ( local->revision() == remote->revision() ) |
757 | return 0; | 757 | return 0; |
758 | 758 | ||
759 | } | 759 | } |
760 | // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); | 760 | // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); |
761 | 761 | ||
762 | //qDebug("%s %d %s %d", local->lastModified().toString().latin1() , local->revision(), remote->lastModified().toString().latin1(), remote->revision()); | 762 | //qDebug("%s %d %s %d", local->lastModified().toString().latin1() , local->revision(), remote->lastModified().toString().latin1(), remote->revision()); |
763 | //qDebug("%d %d %d %d ", local->lastModified().time().second(), local->lastModified().time().msec(), remote->lastModified().time().second(), remote->lastModified().time().msec() ); | 763 | //qDebug("%d %d %d %d ", local->lastModified().time().second(), local->lastModified().time().msec(), remote->lastModified().time().second(), remote->lastModified().time().msec() ); |
764 | //full = true; //debug only | 764 | //full = true; //debug only |
765 | if ( full ) { | 765 | if ( full ) { |
766 | bool equ = false; | 766 | bool equ = false; |
767 | if ( local->type() == "Event" ) { | 767 | if ( local->type() == "Event" ) { |
768 | equ = (*((Event*) local) == *((Event*) remote)); | 768 | equ = (*((Event*) local) == *((Event*) remote)); |
769 | } | 769 | } |
770 | else if ( local->type() =="Todo" ) | 770 | else if ( local->type() =="Todo" ) |
771 | equ = (*((Todo*) local) == (*(Todo*) remote)); | 771 | equ = (*((Todo*) local) == (*(Todo*) remote)); |
772 | else if ( local->type() =="Journal" ) | 772 | else if ( local->type() =="Journal" ) |
773 | equ = (*((Journal*) local) == *((Journal*) remote)); | 773 | equ = (*((Journal*) local) == *((Journal*) remote)); |
774 | if ( equ ) { | 774 | if ( equ ) { |
775 | //qDebug("equal "); | 775 | //qDebug("equal "); |
776 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 776 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
777 | local->setZaurusUid( remote->zaurusUid() ); | 777 | local->setZaurusUid( remote->zaurusUid() ); |
778 | } | 778 | } |
779 | if ( mode < SYNC_PREF_FORCE_LOCAL ) | 779 | if ( mode < SYNC_PREF_FORCE_LOCAL ) |
780 | return 0; | 780 | return 0; |
781 | 781 | ||
782 | }//else //debug only | 782 | }//else //debug only |
783 | //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); | 783 | //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); |
784 | } | 784 | } |
785 | int result; | 785 | int result; |
786 | bool localIsNew; | 786 | bool localIsNew; |
diff --git a/korganizer/kosyncprefsdialog.cpp b/korganizer/kosyncprefsdialog.cpp deleted file mode 100644 index 7c838f5..0000000 --- a/korganizer/kosyncprefsdialog.cpp +++ b/dev/null | |||
@@ -1,468 +0,0 @@ | |||
1 | /* | ||
2 | This file is part of KOrganizer. | ||
3 | Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org> | ||
4 | |||
5 | This program is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published by | ||
7 | the Free Software Foundation; either version 2 of the License, or | ||
8 | (at your option) any later version. | ||
9 | |||
10 | This program is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | GNU General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with this program; if not, write to the Free Software | ||
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
18 | |||
19 | As a special exception, permission is given to link this program | ||
20 | with any edition of Qt, and distribute the resulting executable, | ||
21 | without including the source code for Qt in the source distribution. | ||
22 | */ | ||
23 | |||
24 | #include <qlayout.h> | ||
25 | #include <qlabel.h> | ||
26 | #include <qgroupbox.h> | ||
27 | #include <qbuttongroup.h> | ||
28 | #include <qlineedit.h> | ||
29 | #include <qfont.h> | ||
30 | #include <qslider.h> | ||
31 | #include <qfile.h> | ||
32 | #include <qdir.h> | ||
33 | #include <qtextstream.h> | ||
34 | #include <qcombobox.h> | ||
35 | #include <qvbox.h> | ||
36 | #include <qhbox.h> | ||
37 | #include <qspinbox.h> | ||
38 | #include <qdatetime.h> | ||
39 | #include <qcheckbox.h> | ||
40 | #include <qradiobutton.h> | ||
41 | #include <qpushbutton.h> | ||
42 | #include <qstrlist.h> | ||
43 | #include <qapplication.h> | ||
44 | |||
45 | #include <kcolorbutton.h> | ||
46 | #include <kdebug.h> | ||
47 | #include <klocale.h> | ||
48 | #include <kglobal.h> | ||
49 | #include <kfontdialog.h> | ||
50 | #include <kmessagebox.h> | ||
51 | #include <kcolordialog.h> | ||
52 | #include <kiconloader.h> | ||
53 | #include <kemailsettings.h> | ||
54 | #include <kstandarddirs.h> | ||
55 | #include <kfiledialog.h> | ||
56 | #include <kmessagebox.h> | ||
57 | |||
58 | #include <kurlrequester.h> | ||
59 | #include <klineedit.h> | ||
60 | #include <libkdepim/ksyncprofile.h> | ||
61 | |||
62 | |||
63 | //#include "koprefs.h" | ||
64 | |||
65 | #include "kosyncprefsdialog.h" | ||
66 | //#include "koglobals.h" | ||
67 | |||
68 | |||
69 | KOSyncPrefsDialog::KOSyncPrefsDialog(QWidget *parent, char *name, bool modal) : | ||
70 | KDialog(parent,name,true) | ||
71 | { | ||
72 | |||
73 | setCaption( i18n("Synchronization Preferences")); | ||
74 | |||
75 | mSyncProfiles.setAutoDelete( true ); | ||
76 | setupSyncAlgTab(); | ||
77 | } | ||
78 | |||
79 | |||
80 | KOSyncPrefsDialog::~KOSyncPrefsDialog() | ||
81 | { | ||
82 | } | ||
83 | |||
84 | #include <qlayout.h> | ||
85 | #include <qscrollview.h> | ||
86 | void KOSyncPrefsDialog::setupSyncAlgTab() | ||
87 | { | ||
88 | QLabel * lab; | ||
89 | //QFrame *page = addPage(i18n("Sync Prefs"),0,0); | ||
90 | QVBox * mainbox = new QVBox( this ); | ||
91 | QScrollView* sv = new QScrollView( mainbox ); | ||
92 | QHBoxLayout * lay = new QHBoxLayout( this ); | ||
93 | lay->addWidget( mainbox ); | ||
94 | QHBox * b_box = new QHBox( mainbox ); | ||
95 | |||
96 | QPushButton* button = new QPushButton( i18n("Ok"), b_box ); | ||
97 | connect ( button, SIGNAL( clicked()), this, SLOT (slotOK() ) ); | ||
98 | button = new QPushButton( i18n("Cancel"), b_box ); | ||
99 | connect ( button, SIGNAL( clicked()), this, SLOT (reject() ) ); | ||
100 | //QBoxLayout * sl = new QVBoxLayout(this ); | ||
101 | //sl->addWidget ( sv ); | ||
102 | sv->setResizePolicy ( QScrollView::AutoOneFit ); | ||
103 | QFrame *topFrame = new QFrame ( sv ); | ||
104 | sv->addChild( topFrame ); | ||
105 | mSetupSyncAlgTab = topFrame; | ||
106 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); | ||
107 | topLayout->setSpacing(spacingHint()); | ||
108 | topLayout->setMargin(marginHint()); | ||
109 | |||
110 | //lab = new QLabel(i18n("Sync settings not yet implemented. DO NOT USE!"), topFrame); | ||
111 | int iii = 0; | ||
112 | //topLayout->addMultiCellWidget(lab , iii,iii,0,1); | ||
113 | //++iii; | ||
114 | |||
115 | mMyMachineName = new QLineEdit(topFrame); | ||
116 | lab = new QLabel(mMyMachineName, i18n("Local device name:"), topFrame); | ||
117 | topLayout->addWidget(lab ,iii,0); | ||
118 | topLayout->addWidget(mMyMachineName,iii,1); | ||
119 | ++iii; | ||
120 | |||
121 | QHBox* buttonbox = new QHBox( topFrame); | ||
122 | topLayout->addMultiCellWidget(buttonbox, iii,iii,0,1); | ||
123 | ++iii; | ||
124 | button = new QPushButton( i18n("New profile"), buttonbox ); | ||
125 | connect ( button, SIGNAL( clicked()), this, SLOT (newProfile() ) ); | ||
126 | |||
127 | button = new QPushButton( i18n("Clone profile"), buttonbox ); | ||
128 | connect ( button, SIGNAL( clicked()), this, SLOT ( cloneProfile() ) ); | ||
129 | |||
130 | button = new QPushButton( i18n("Delete profile"), buttonbox ); | ||
131 | connect ( button, SIGNAL( clicked()), this, SLOT (deleteProfile() ) ); | ||
132 | |||
133 | mProfileBox = new QComboBox(topFrame); | ||
134 | mProfileBox->setEditable ( true ); | ||
135 | connect ( mProfileBox, SIGNAL(activated ( int ) ), this, SLOT (profileChanged( int ) ) ); | ||
136 | connect ( mProfileBox, SIGNAL( textChanged ( const QString & ) ), this, SLOT (textChanged( const QString & ) ) ); | ||
137 | |||
138 | lab = new QLabel(mProfileBox, i18n("Profile:"), topFrame); | ||
139 | topLayout->addWidget(lab ,iii,0); | ||
140 | topLayout->addWidget(mProfileBox, iii,1); | ||
141 | ++iii; | ||
142 | |||
143 | mIncludeInRing = new QCheckBox( i18n("Include in multiple sync"), topFrame ); | ||
144 | topLayout->addMultiCellWidget(mIncludeInRing, iii,iii,0,1); | ||
145 | ++iii; | ||
146 | |||
147 | mAskForPreferences = new QCheckBox( i18n("Ask for preferences before sync"), topFrame ); | ||
148 | topLayout->addMultiCellWidget(mAskForPreferences, iii,iii,0,1); | ||
149 | ++iii; | ||
150 | QButtonGroup* gr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Sync preferences"), topFrame); | ||
151 | topLayout->addMultiCellWidget(gr, iii,iii,0,1); | ||
152 | ++iii; | ||
153 | loc = new QRadioButton ( i18n("Take local entry on conflict"), gr ); | ||
154 | rem = new QRadioButton ( i18n("Take remote entry on conflict"), gr ); | ||
155 | newest = new QRadioButton ( i18n("Take newest entry on conflict"), gr ); | ||
156 | ask = new QRadioButton ( i18n("Ask for every entry on conflict"), gr ); | ||
157 | f_loc= new QRadioButton ( i18n("Force: Take local entry always"), gr ); | ||
158 | f_rem = new QRadioButton ( i18n("Force: Take remote entry always"), gr ); | ||
159 | // both = new QRadioButton ( i18n("Take both on conflict"), gr ); | ||
160 | |||
161 | mShowSummaryAfterSync = new QCheckBox( i18n("Show summary after sync"), topFrame ); | ||
162 | topLayout->addMultiCellWidget(mShowSummaryAfterSync, iii,iii,0,1); | ||
163 | ++iii; | ||
164 | |||
165 | mWriteBackExisting= new QCheckBox( i18n("Write back existing entries only"), topFrame ); | ||
166 | topLayout->addMultiCellWidget(mWriteBackExisting, iii,iii,0,1); | ||
167 | ++iii; | ||
168 | |||
169 | mWriteBackFile = new QCheckBox( i18n("Write back file"), topFrame ); | ||
170 | topLayout->addMultiCellWidget(mWriteBackFile, iii,iii,0,1); | ||
171 | ++iii; | ||
172 | |||
173 | proGr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Profile kind"), topFrame); | ||
174 | gr = proGr; | ||
175 | topLayout->addMultiCellWidget(gr, iii,iii,0,1); | ||
176 | ++iii; | ||
177 | mIsLocal = new QRadioButton ( i18n("Local file"), gr ); | ||
178 | mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr ); | ||
179 | connect (mIsLocal, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); | ||
180 | |||
181 | localFileWidget = new QVBox( topFrame); | ||
182 | topLayout->addMultiCellWidget(localFileWidget, iii,iii,0,1); | ||
183 | ++iii; | ||
184 | QHBox* temphb = new QHBox( localFileWidget ); | ||
185 | lab = new QLabel( i18n("Local file:"), temphb); | ||
186 | mRemoteFile = new QLineEdit(localFileWidget); | ||
187 | |||
188 | button = new QPushButton( i18n("Choose..."), temphb ); | ||
189 | connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFile() ) ); | ||
190 | |||
191 | |||
192 | remoteFileWidget = new QVBox( topFrame); | ||
193 | topLayout->addMultiCellWidget(remoteFileWidget, iii,iii,0,1); | ||
194 | ++iii; | ||
195 | lab = new QLabel( i18n("Pre sync (download) command:"), remoteFileWidget); | ||
196 | mRemotePrecommand = new QLineEdit(remoteFileWidget); | ||
197 | |||
198 | lab = new QLabel( i18n("Local temp file:"), remoteFileWidget); | ||
199 | mLocalTempFile = new QLineEdit(remoteFileWidget); | ||
200 | |||
201 | |||
202 | lab = new QLabel( i18n("Post sync (upload) command:"), remoteFileWidget); | ||
203 | mRemotePostcommand = new QLineEdit(remoteFileWidget); | ||
204 | |||
205 | lab = new QLabel( i18n("Fill in default values for:"), remoteFileWidget); | ||
206 | temphb = new QHBox( remoteFileWidget ); | ||
207 | button = new QPushButton( i18n("ssh/scp"), temphb ); | ||
208 | connect ( button, SIGNAL( clicked()), this, SLOT (fillSSH() ) ); | ||
209 | button = new QPushButton( i18n("ftp"), temphb ); | ||
210 | connect ( button, SIGNAL( clicked()), this, SLOT (fillFTP() ) ); | ||
211 | lab = new QLabel( i18n("Hint: Use $PWD$ for placeholder of password!"), remoteFileWidget); | ||
212 | |||
213 | |||
214 | } | ||
215 | void KOSyncPrefsDialog::slotOK() | ||
216 | { | ||
217 | if ( mMyMachineName->text() == "undefined" ) { | ||
218 | KMessageBox::error(this,i18n("Local device name undefined!\nPlease define device name!"),i18n("KO/Pi config error")); | ||
219 | return; | ||
220 | } | ||
221 | int i; | ||
222 | for (i = 0; i < mSyncProfileNames.count(); ++ i) { | ||
223 | if ( mSyncProfileNames.contains( mSyncProfileNames[i]) > 1 ) { | ||
224 | KMessageBox::error(this,i18n("Multiple profiles with same name!\nPlease use unique profile names!"),i18n("KO/Pi config error")); | ||
225 | return; | ||
226 | } | ||
227 | } | ||
228 | usrWriteConfig(); | ||
229 | QDialog::accept(); | ||
230 | } | ||
231 | void KOSyncPrefsDialog::accept() | ||
232 | { | ||
233 | slotOK(); | ||
234 | } | ||
235 | void KOSyncPrefsDialog::chooseFile() | ||
236 | { | ||
237 | QString fn = QDir::homeDirPath(); | ||
238 | |||
239 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this ); | ||
240 | if ( fn == "" ) | ||
241 | return; | ||
242 | mRemoteFile->setText( fn ); | ||
243 | } | ||
244 | |||
245 | void KOSyncPrefsDialog::textChanged( const QString & s ) | ||
246 | { | ||
247 | if ( mProfileBox->count() == 0 ) | ||
248 | return; | ||
249 | if ( currentSelection < 3 ) { | ||
250 | //KMessageBox::error(this,i18n("This profil name\ncannot be edited!\n"),i18n("KO/Pi config error")); | ||
251 | mProfileBox->blockSignals( true ); | ||
252 | mProfileBox->setCurrentItem(mProfileBox-> currentItem ()); | ||
253 | mProfileBox->blockSignals( false ); | ||
254 | return; | ||
255 | } | ||
256 | //qDebug("cur i %d ",mProfileBox-> currentItem () ); | ||
257 | mProfileBox->changeItem ( s, mProfileBox-> currentItem () ) ; | ||
258 | KSyncProfile* prof = mSyncProfiles.at(mProfileBox-> currentItem ()) ; | ||
259 | prof->setName( s ); | ||
260 | mSyncProfileNames[mProfileBox-> currentItem ()] = s; | ||
261 | } | ||
262 | void KOSyncPrefsDialog::profileChanged( int item ) | ||
263 | { | ||
264 | //qDebug("KOSyncPrefsDialog::profileChanged %d ", item ); | ||
265 | KSyncProfile* prof; | ||
266 | saveProfile(); | ||
267 | currentSelection = item; | ||
268 | prof = mSyncProfiles.at(item) ; | ||
269 | mRemotePrecommand->setText(prof->getPreSyncCommand()); | ||
270 | mRemotePostcommand->setText(prof->getPostSyncCommand()); | ||
271 | mLocalTempFile->setText(prof->getLocalTempFile()); | ||
272 | mRemoteFile->setText(prof->getRemoteFileName()) ; | ||
273 | mShowSummaryAfterSync->setChecked( prof->getShowSummaryAfterSync()); | ||
274 | mAskForPreferences->setChecked( prof->getAskForPreferences()); | ||
275 | mWriteBackExisting->setChecked( prof->getWriteBackExisting() ); | ||
276 | mWriteBackFile->setChecked( prof->getWriteBackFile()); | ||
277 | mIncludeInRing->setChecked( prof->getIncludeInRingSync() ); | ||
278 | |||
279 | switch ( prof->getSyncPrefs() ) { | ||
280 | case 0: | ||
281 | loc->setChecked( true); | ||
282 | break; | ||
283 | case 1: | ||
284 | rem->setChecked( true ); | ||
285 | break; | ||
286 | case 2: | ||
287 | newest->setChecked( true); | ||
288 | break; | ||
289 | case 3: | ||
290 | ask->setChecked( true); | ||
291 | break; | ||
292 | case 4: | ||
293 | f_loc->setChecked( true); | ||
294 | break; | ||
295 | case 5: | ||
296 | f_rem->setChecked( true); | ||
297 | break; | ||
298 | case 6: | ||
299 | //both->setChecked( true); | ||
300 | break; | ||
301 | default: | ||
302 | break; | ||
303 | } | ||
304 | mIsLocal->setChecked(prof->getIsLocalFileSync()) ; | ||
305 | mIsNotLocal->setChecked(!prof->getIsLocalFileSync()); | ||
306 | proGr->setEnabled( item > 2 ); | ||
307 | if ( item < 3 ) { | ||
308 | localFileWidget->setEnabled(false); | ||
309 | remoteFileWidget->setEnabled(false); | ||
310 | |||
311 | } else | ||
312 | kindChanged( prof->getIsLocalFileSync() ); | ||
313 | } | ||
314 | |||
315 | void KOSyncPrefsDialog::fillSSH() | ||
316 | { | ||
317 | mRemotePrecommand->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" ); | ||
318 | mLocalTempFile->setText("/tmp/mycalendar.ics" ); | ||
319 | mRemotePostcommand->setText("scp /tmp/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics" ); | ||
320 | } | ||
321 | void KOSyncPrefsDialog::fillFTP() | ||
322 | { | ||
323 | mRemotePrecommand->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics" ); | ||
324 | mLocalTempFile->setText("/tmp/mycalendar.ics" ); | ||
325 | mRemotePostcommand->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" ); | ||
326 | |||
327 | } | ||
328 | void KOSyncPrefsDialog::kindChanged( bool b ) | ||
329 | { | ||
330 | |||
331 | localFileWidget->setEnabled(b); | ||
332 | remoteFileWidget->setEnabled(!b); | ||
333 | |||
334 | } | ||
335 | void KOSyncPrefsDialog::deleteProfile() | ||
336 | { | ||
337 | //qDebug("KOSyncPrefsDialog::deleteProfile() "); | ||
338 | if ( currentSelection >= 0 ) { | ||
339 | if ( currentSelection < 3 ) { | ||
340 | KMessageBox::error(this,i18n("This profil cannot be deleted!\n"),i18n("KO/Pi config error")); | ||
341 | return; | ||
342 | } | ||
343 | KSyncProfile* temp = mSyncProfiles.at(currentSelection); | ||
344 | mSyncProfiles.remove( temp ); | ||
345 | mSyncProfileNames.remove( mSyncProfileNames.at( currentSelection )); | ||
346 | insertProfiles(); | ||
347 | } | ||
348 | } | ||
349 | |||
350 | void KOSyncPrefsDialog::saveProfile() | ||
351 | { | ||
352 | KSyncProfile* prof; | ||
353 | if ( currentSelection >= 0 ) { | ||
354 | prof = mSyncProfiles.at(currentSelection) ; | ||
355 | prof->setPreSyncCommand( mRemotePrecommand->text()); | ||
356 | prof->setPostSyncCommand( mRemotePostcommand->text() ); | ||
357 | prof->setLocalTempFile( mLocalTempFile->text()); | ||
358 | prof->setRemoteFileName( mRemoteFile->text() ); | ||
359 | prof->setShowSummaryAfterSync( mShowSummaryAfterSync->isChecked() ); | ||
360 | prof->setAskForPreferences( mAskForPreferences->isChecked()); | ||
361 | prof->setWriteBackExisting(mWriteBackExisting->isChecked() ); | ||
362 | prof->setWriteBackFile( mWriteBackFile->isChecked()); | ||
363 | prof->setIncludeInRingSync( mIncludeInRing->isChecked() ); | ||
364 | int syncprefs = rem->isChecked()*1+newest->isChecked()*2+ ask->isChecked()*3+ f_loc->isChecked()*4+ f_rem->isChecked()*5 ;//+ both->isChecked()*6 ; | ||
365 | prof->setSyncPrefs( syncprefs); | ||
366 | prof->setIsLocalFileSync( mIsLocal->isChecked() ); | ||
367 | } | ||
368 | |||
369 | } | ||
370 | |||
371 | void KOSyncPrefsDialog::insertProfiles() | ||
372 | { | ||
373 | int curItem = mProfileBox->currentItem(); | ||
374 | mProfileBox->blockSignals( true ); | ||
375 | mProfileBox->clear(); | ||
376 | mProfileBox->insertStringList (mSyncProfileNames ); | ||
377 | int item = mSyncProfileNames.count() -1; | ||
378 | if ( curItem >= 0 && mSyncProfileNames.count() > 0 && curItem < mSyncProfileNames.count() ) | ||
379 | mProfileBox->setCurrentItem( curItem ); | ||
380 | else if ( item >= 0 ) { | ||
381 | mProfileBox->setCurrentItem( item ); | ||
382 | } | ||
383 | currentSelection = -1; | ||
384 | if ( mSyncProfileNames.count() > 0 ) { | ||
385 | //qDebug(" profileChanged( mProfileBox->currentItem() "); | ||
386 | profileChanged( mProfileBox->currentItem() ); | ||
387 | currentSelection = mProfileBox->currentItem(); | ||
388 | } | ||
389 | mProfileBox->blockSignals( false ); | ||
390 | } | ||
391 | |||
392 | void KOSyncPrefsDialog::addProfile ( KSyncProfile* temp ) | ||
393 | { | ||
394 | saveProfile(); | ||
395 | mSyncProfiles.append( temp ); | ||
396 | mSyncProfileNames << temp->getName(); | ||
397 | insertProfiles(); | ||
398 | int last = mProfileBox->count() -1; | ||
399 | mProfileBox->blockSignals( true ); | ||
400 | mProfileBox->setCurrentItem( last ); | ||
401 | mProfileBox->blockSignals( false ); | ||
402 | profileChanged(last); | ||
403 | } | ||
404 | void KOSyncPrefsDialog::newProfile() | ||
405 | { | ||
406 | addProfile ( new KSyncProfile () ); | ||
407 | } | ||
408 | |||
409 | void KOSyncPrefsDialog::cloneProfile() | ||
410 | { | ||
411 | if ( currentSelection >= 0 ) | ||
412 | addProfile (mSyncProfiles.at(currentSelection)->clone()) ; | ||
413 | else | ||
414 | newProfile(); | ||
415 | } | ||
416 | |||
417 | void KOSyncPrefsDialog::setLocalMachineName ( const QString& name ) | ||
418 | { | ||
419 | mMyMachineName->setText( name ); | ||
420 | |||
421 | } | ||
422 | QString KOSyncPrefsDialog::getLocalMachineName ( ) | ||
423 | { | ||
424 | return mMyMachineName->text(); | ||
425 | } | ||
426 | |||
427 | QStringList KOSyncPrefsDialog::getSyncProfileNames() | ||
428 | { | ||
429 | return mSyncProfileNames; | ||
430 | } | ||
431 | void KOSyncPrefsDialog::usrReadConfig() | ||
432 | { | ||
433 | //KConfig *config = KOGlobals::config(); | ||
434 | KConfig config ( locateLocal( "config","syncprofilesrc" ) ); | ||
435 | config.setGroup("SyncProfiles"); | ||
436 | mSyncProfileNames =config.readListEntry("SyncProfileNames"); | ||
437 | int i; | ||
438 | KSyncProfile* temp ; | ||
439 | mSyncProfiles.clear(); | ||
440 | for ( i = 0; i < mSyncProfileNames.count();++i ) { | ||
441 | temp = new KSyncProfile (); | ||
442 | temp->setName( mSyncProfileNames[i] ); | ||
443 | temp->readConfig( &config ); | ||
444 | mSyncProfiles.append( temp ); | ||
445 | } | ||
446 | insertProfiles(); | ||
447 | //mMyMachineName->setText(KOPrefs::instance()->mLocalMachineName ); | ||
448 | } | ||
449 | |||
450 | |||
451 | void KOSyncPrefsDialog::usrWriteConfig() | ||
452 | { | ||
453 | saveProfile(); | ||
454 | if ( currentSelection >= 0 ) | ||
455 | profileChanged(currentSelection); | ||
456 | //KConfig *config = KOGlobals::config(); | ||
457 | KConfig config ( locateLocal( "config","syncprofilesrc" ) ); | ||
458 | config.setGroup("SyncProfiles"); | ||
459 | KSyncProfile* prof = mSyncProfiles.first(); | ||
460 | while ( prof ) { | ||
461 | prof->writeConfig(&config); | ||
462 | prof = mSyncProfiles.next(); | ||
463 | } | ||
464 | //KOPrefs::instance()->mSyncProfileNames = mSyncProfileNames; | ||
465 | //KOPrefs::instance()->mLocalMachineName = mMyMachineName->text(); | ||
466 | config.writeEntry("SyncProfileNames",&mSyncProfileNames); | ||
467 | } | ||
468 | |||
diff --git a/korganizer/kosyncprefsdialog.h b/korganizer/kosyncprefsdialog.h deleted file mode 100644 index 541d18b..0000000 --- a/korganizer/kosyncprefsdialog.h +++ b/dev/null | |||
@@ -1,113 +0,0 @@ | |||
1 | /* | ||
2 | This file is part of KOrganizer. | ||
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | ||
4 | |||
5 | This program is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published by | ||
7 | the Free Software Foundation; either version 2 of the License, or | ||
8 | (at your option) any later version. | ||
9 | |||
10 | This program is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | GNU General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with this program; if not, write to the Free Software | ||
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
18 | |||
19 | As a special exception, permission is given to link this program | ||
20 | with any edition of Qt, and distribute the resulting executable, | ||
21 | without including the source code for Qt in the source distribution. | ||
22 | */ | ||
23 | #ifndef _KOPREFSDIALOG_H | ||
24 | #define _KOPREFSDIALOG_H | ||
25 | |||
26 | //#include <qframe.h> | ||
27 | //#include <qdict.h> | ||
28 | #include <qvbox.h> | ||
29 | #include <qhbox.h> | ||
30 | //#include <qcolor.h> | ||
31 | //#include <qlistview.h> | ||
32 | |||
33 | #include <kdialogbase.h> | ||
34 | |||
35 | #include <libkdepim/kprefsdialog.h> | ||
36 | |||
37 | class KColorButton; | ||
38 | class QSpinBox;; | ||
39 | class QRadioButton; | ||
40 | class QCheckBox; | ||
41 | class QSlider; | ||
42 | class KURLRequester; | ||
43 | class QComboBox; | ||
44 | class QLineEdit; | ||
45 | class QStringList; | ||
46 | class KSyncProfile; | ||
47 | |||
48 | /** Dialog to change the korganizer configuration. | ||
49 | */ | ||
50 | class KOSyncPrefsDialog : public KDialog | ||
51 | { | ||
52 | Q_OBJECT | ||
53 | public: | ||
54 | /** Initialize dialog and pages */ | ||
55 | KOSyncPrefsDialog(QWidget *parent=0,char *name=0,bool modal=false); | ||
56 | ~KOSyncPrefsDialog(); | ||
57 | void usrReadConfig(); | ||
58 | void setLocalMachineName ( const QString& name ); | ||
59 | QString getLocalMachineName ( ); | ||
60 | |||
61 | QStringList getSyncProfileNames(); | ||
62 | |||
63 | public slots: | ||
64 | protected slots: | ||
65 | void accept(); | ||
66 | void deleteProfile(); | ||
67 | void newProfile(); | ||
68 | void cloneProfile(); | ||
69 | void kindChanged(bool); | ||
70 | void fillSSH(); | ||
71 | void fillFTP(); | ||
72 | void textChanged( const QString & ); | ||
73 | void profileChanged( int ); | ||
74 | void chooseFile(); | ||
75 | void slotOK(); | ||
76 | |||
77 | protected: | ||
78 | void usrWriteConfig(); | ||
79 | |||
80 | void setupSyncAlgTab(); | ||
81 | |||
82 | private: | ||
83 | int currentSelection; | ||
84 | QPtrList<KSyncProfile> mSyncProfiles; | ||
85 | QStringList mSyncProfileNames; | ||
86 | QLineEdit * mMyMachineName; | ||
87 | QComboBox * mProfileBox; | ||
88 | QRadioButton* mIsLocal; | ||
89 | QRadioButton* mIsNotLocal; | ||
90 | QCheckBox* mIncludeInRing; | ||
91 | void addProfile ( KSyncProfile* ); | ||
92 | void insertProfiles(); | ||
93 | void saveProfile(); | ||
94 | QButtonGroup* proGr; | ||
95 | |||
96 | QRadioButton* loc, *rem, *newest, *ask, *f_loc,* f_rem, *both; | ||
97 | |||
98 | |||
99 | QLineEdit * mRemotePostcommand; | ||
100 | QLineEdit * mRemotePrecommand; | ||
101 | QLineEdit * mRemoteFile; | ||
102 | QLineEdit * mLocalTempFile; | ||
103 | QWidget* mSetupSyncAlgTab; | ||
104 | |||
105 | QVBox* localFileWidget; | ||
106 | QVBox* remoteFileWidget; | ||
107 | QCheckBox* mWriteBackFile; | ||
108 | QCheckBox* mWriteBackExisting; | ||
109 | QCheckBox* mAskForPreferences; | ||
110 | QCheckBox* mShowSummaryAfterSync; | ||
111 | }; | ||
112 | |||
113 | #endif | ||