summaryrefslogtreecommitdiffabout
path: root/libkdepim
authorzautrix <zautrix>2004-10-06 16:02:56 (UTC)
committer zautrix <zautrix>2004-10-06 16:02:56 (UTC)
commita22de800110d8350a5200a994b041e47d51bf4c6 (patch) (unidiff)
treea4de195003d1ceabc3fd9ca4e5cd0510570bcb97 /libkdepim
parentef71411c2f248d1dc908aa2f119c9b281e0e8bb9 (diff)
downloadkdepimpi-a22de800110d8350a5200a994b041e47d51bf4c6.zip
kdepimpi-a22de800110d8350a5200a994b041e47d51bf4c6.tar.gz
kdepimpi-a22de800110d8350a5200a994b041e47d51bf4c6.tar.bz2
added phone export
Diffstat (limited to 'libkdepim') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/kpimglobalprefs.cpp7
-rw-r--r--libkdepim/kpimglobalprefs.h3
-rw-r--r--libkdepim/libkdepim.pro6
-rw-r--r--libkdepim/libkdepimE.pro6
-rw-r--r--libkdepim/phoneaccess.cpp153
-rw-r--r--libkdepim/phoneaccess.h42
6 files changed, 213 insertions, 4 deletions
diff --git a/libkdepim/kpimglobalprefs.cpp b/libkdepim/kpimglobalprefs.cpp
index b2b7663..b71e18d 100644
--- a/libkdepim/kpimglobalprefs.cpp
+++ b/libkdepim/kpimglobalprefs.cpp
@@ -1,133 +1,140 @@
1/* 1/*
2 This file is part of libkdepim. 2 This file is part of libkdepim.
3 Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 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 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 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program 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 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 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 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. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24/* 24/*
25Enhanced Version of the file for platform independent KDE tools. 25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk 26Copyright (c) 2004 Ulf Schenk
27 27
28$Id$ 28$Id$
29*/ 29*/
30 30
31#include <kglobal.h> 31#include <kglobal.h>
32#include <kconfig.h> 32#include <kconfig.h>
33#include <klocale.h> 33#include <klocale.h>
34#include <kdebug.h> 34#include <kdebug.h>
35#include <kstaticdeleter.h> 35#include <kstaticdeleter.h>
36 36
37#include <qregexp.h> 37#include <qregexp.h>
38#include "kpimglobalprefs.h" 38#include "kpimglobalprefs.h"
39 39
40KPimGlobalPrefs *KPimGlobalPrefs::sInstance = 0; 40KPimGlobalPrefs *KPimGlobalPrefs::sInstance = 0;
41static KStaticDeleter<KPimGlobalPrefs> staticDeleter; 41static KStaticDeleter<KPimGlobalPrefs> staticDeleter;
42 42
43 43
44KPimGlobalPrefs::KPimGlobalPrefs( const QString &name ) 44KPimGlobalPrefs::KPimGlobalPrefs( const QString &name )
45 : KPrefs("microkdeglobalrc") 45 : KPrefs("microkdeglobalrc")
46{ 46{
47 47
48 KPrefs::setCurrentGroup("Locale"); 48 KPrefs::setCurrentGroup("Locale");
49 addItemInt("PreferredLanguage",&mPreferredLanguage,0); 49 addItemInt("PreferredLanguage",&mPreferredLanguage,0);
50 addItemInt("PreferredTime",&mPreferredTime,0); 50 addItemInt("PreferredTime",&mPreferredTime,0);
51 addItemInt("PreferredDate",&mPreferredDate,0); 51 addItemInt("PreferredDate",&mPreferredDate,0);
52 addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false); 52 addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false);
53 //addItemBool("QuickSavingWOUnicode",&mUseQuicksave,false); 53 //addItemBool("QuickSavingWOUnicode",&mUseQuicksave,false);
54 // addItemBool("ShortDateInViewer",&mShortDateInViewer,false); 54 // addItemBool("ShortDateInViewer",&mShortDateInViewer,false);
55 addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y"); 55 addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y");
56 addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y"); 56 addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y");
57 57
58 KPrefs::setCurrentGroup("Time & Date"); 58 KPrefs::setCurrentGroup("Time & Date");
59 59
60 addItemString("TimeZoneName",&mTimeZoneId,i18n ("+01:00 Europe/Oslo(CET)") ); 60 addItemString("TimeZoneName",&mTimeZoneId,i18n ("+01:00 Europe/Oslo(CET)") );
61 addItemBool("UseDaylightsaving",&mUseDaylightsaving,true); 61 addItemBool("UseDaylightsaving",&mUseDaylightsaving,true);
62 addItemInt("DaylightsavingStart",&mDaylightsavingStart,90); 62 addItemInt("DaylightsavingStart",&mDaylightsavingStart,90);
63 addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304); 63 addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304);
64 64
65 65
66 66
67 67
68 KPrefs::setCurrentGroup( "ExternalApplications" ); 68 KPrefs::setCurrentGroup( "ExternalApplications" );
69 69
70 addItemInt( "EmailChannelType", &mEmailClient, OMPI_EMC ); 70 addItemInt( "EmailChannelType", &mEmailClient, OMPI_EMC );
71 addItemString( "EmailChannel", &mEmailOtherChannel, "" ); 71 addItemString( "EmailChannel", &mEmailOtherChannel, "" );
72 addItemString( "EmailChannelMessage", &mEmailOtherMessage, "" ); 72 addItemString( "EmailChannelMessage", &mEmailOtherMessage, "" );
73 addItemString( "EmailChannelParameters", &mEmailOtherMessageParameters, "" ); 73 addItemString( "EmailChannelParameters", &mEmailOtherMessageParameters, "" );
74 addItemString( "EmailChannelMessage2", &mEmailOtherMessage2, "" ); 74 addItemString( "EmailChannelMessage2", &mEmailOtherMessage2, "" );
75 addItemString( "EmailChannelParameters2", &mEmailOtherMessageParameters2, "" ); 75 addItemString( "EmailChannelParameters2", &mEmailOtherMessageParameters2, "" );
76 76
77 addItemInt( "PhoneChannelType", &mPhoneClient, KPPI_PHC ); 77 addItemInt( "PhoneChannelType", &mPhoneClient, KPPI_PHC );
78 addItemString( "PhoneChannel", &mPhoneOtherChannel, "" ); 78 addItemString( "PhoneChannel", &mPhoneOtherChannel, "" );
79 addItemString( "PhoneChannelMessage", &mPhoneOtherMessage, "" ); 79 addItemString( "PhoneChannelMessage", &mPhoneOtherMessage, "" );
80 addItemString( "PhoneChannelParameters", &mPhoneOtherMessageParameters, "" ); 80 addItemString( "PhoneChannelParameters", &mPhoneOtherMessageParameters, "" );
81 81
82 addItemInt( "FaxChannelType", &mFaxClient, NONE_FAC ); 82 addItemInt( "FaxChannelType", &mFaxClient, NONE_FAC );
83 addItemString( "FaxChannel", &mFaxOtherChannel, "" ); 83 addItemString( "FaxChannel", &mFaxOtherChannel, "" );
84 addItemString( "FaxChannelMessage", &mFaxOtherMessage, "" ); 84 addItemString( "FaxChannelMessage", &mFaxOtherMessage, "" );
85 addItemString( "FaxChannelParameters", &mFaxOtherMessageParameters, "" ); 85 addItemString( "FaxChannelParameters", &mFaxOtherMessageParameters, "" );
86 86
87 addItemInt( "SMSChannelType", &mSMSClient, NONE_SMC ); 87 addItemInt( "SMSChannelType", &mSMSClient, NONE_SMC );
88 addItemString( "SMSChannel", &mSMSOtherChannel, "" ); 88 addItemString( "SMSChannel", &mSMSOtherChannel, "" );
89 addItemString( "SMSChannelMessage", &mSMSOtherMessage, "" ); 89 addItemString( "SMSChannelMessage", &mSMSOtherMessage, "" );
90 addItemString( "SMSChannelParameters", &mSMSOtherMessageParameters, "" ); 90 addItemString( "SMSChannelParameters", &mSMSOtherMessageParameters, "" );
91 91
92 addItemInt( "PagerChannelType", &mPagerClient, NONE_PAC ); 92 addItemInt( "PagerChannelType", &mPagerClient, NONE_PAC );
93 addItemString( "PagerChannel", &mPagerOtherChannel, "" ); 93 addItemString( "PagerChannel", &mPagerOtherChannel, "" );
94 addItemString( "PagerChannelMessage", &mPagerOtherMessage, "" ); 94 addItemString( "PagerChannelMessage", &mPagerOtherMessage, "" );
95 addItemString( "PagerChannelParameters", &mPagerOtherMessageParameters, "" ); 95 addItemString( "PagerChannelParameters", &mPagerOtherMessageParameters, "" );
96 96
97 addItemInt( "SIPChannelType", &mSipClient, NONE_SIC ); 97 addItemInt( "SIPChannelType", &mSipClient, NONE_SIC );
98 addItemString( "SIPChannel", &mSipOtherChannel, "" ); 98 addItemString( "SIPChannel", &mSipOtherChannel, "" );
99 addItemString( "SIPChannelMessage", &mSipOtherMessage, "" ); 99 addItemString( "SIPChannelMessage", &mSipOtherMessage, "" );
100 addItemString( "SIPChannelParameters", &mSipOtherMessageParameters, "" ); 100 addItemString( "SIPChannelParameters", &mSipOtherMessageParameters, "" );
101 101
102
103 KPrefs::setCurrentGroup( "PhoneAccess" );
104 addItemString("Ex2PhoneDevice",&mEx2PhoneDevice,"/dev/ircomm");
105 addItemString("Ex2PhoneConnection",&mEx2PhoneConnection,"irda");
106 addItemString("Ex2PhoneModel",&mEx2PhoneModel,"6310i");
107
108
102} 109}
103 110
104void KPimGlobalPrefs::setGlobalConfig() 111void KPimGlobalPrefs::setGlobalConfig()
105{ 112{
106 113
107 KGlobal::locale()->setHore24Format( !mPreferredTime ); 114 KGlobal::locale()->setHore24Format( !mPreferredTime );
108 KGlobal::locale()->setWeekStartMonday( !mWeekStartsOnSunday ); 115 KGlobal::locale()->setWeekStartMonday( !mWeekStartsOnSunday );
109 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)mPreferredDate ); 116 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)mPreferredDate );
110 KGlobal::locale()->setLanguage( mPreferredLanguage ); 117 KGlobal::locale()->setLanguage( mPreferredLanguage );
111 QString dummy = mUserDateFormatLong; 118 QString dummy = mUserDateFormatLong;
112 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); 119 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") ));
113 dummy = mUserDateFormatShort; 120 dummy = mUserDateFormatShort;
114 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); 121 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") ));
115 KGlobal::locale()->setDaylightSaving( mUseDaylightsaving, 122 KGlobal::locale()->setDaylightSaving( mUseDaylightsaving,
116 mDaylightsavingStart, 123 mDaylightsavingStart,
117 mDaylightsavingEnd ); 124 mDaylightsavingEnd );
118 KGlobal::locale()->setTimezone( mTimeZoneId ); 125 KGlobal::locale()->setTimezone( mTimeZoneId );
119 126
120} 127}
121KPimGlobalPrefs::~KPimGlobalPrefs() 128KPimGlobalPrefs::~KPimGlobalPrefs()
122{ 129{
123} 130}
124 131
125KPimGlobalPrefs *KPimGlobalPrefs::instance() 132KPimGlobalPrefs *KPimGlobalPrefs::instance()
126{ 133{
127 if ( !sInstance ) { 134 if ( !sInstance ) {
128 sInstance = staticDeleter.setObject( new KPimGlobalPrefs() ); 135 sInstance = staticDeleter.setObject( new KPimGlobalPrefs() );
129 sInstance->readConfig(); 136 sInstance->readConfig();
130 } 137 }
131 138
132 return sInstance; 139 return sInstance;
133} 140}
diff --git a/libkdepim/kpimglobalprefs.h b/libkdepim/kpimglobalprefs.h
index 84ba689..f6b6628 100644
--- a/libkdepim/kpimglobalprefs.h
+++ b/libkdepim/kpimglobalprefs.h
@@ -1,135 +1,138 @@
1/* 1/*
2 This file is part of libkdepim. 2 This file is part of libkdepim.
3 Copyright (c) 2004 Ulf Schenk 3 Copyright (c) 2004 Ulf Schenk
4 4
5 This program is free software; you can redistribute it and/or modify 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 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 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program 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 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 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 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. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24/* 24/*
25Enhanced Version of the file for platform independent KDE tools. 25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk 26Copyright (c) 2004 Ulf Schenk
27 27
28$Id$ 28$Id$
29*/ 29*/
30 30
31#ifndef KPIMGLOBALPREFS_H 31#ifndef KPIMGLOBALPREFS_H
32#define KPIMGLOBALPREFS_H 32#define KPIMGLOBALPREFS_H
33 33
34#include "kprefs.h" 34#include "kprefs.h"
35 35
36class KPimGlobalPrefs : public KPrefs 36class KPimGlobalPrefs : public KPrefs
37{ 37{
38 public: 38 public:
39 39
40 void setGlobalConfig(); 40 void setGlobalConfig();
41 static KPimGlobalPrefs *instance(); 41 static KPimGlobalPrefs *instance();
42 42
43 43
44 virtual ~KPimGlobalPrefs(); 44 virtual ~KPimGlobalPrefs();
45 45
46 46
47 enum EMailClients { 47 enum EMailClients {
48 NONE_EMC = 0, 48 NONE_EMC = 0,
49 OTHER_EMC = 1, 49 OTHER_EMC = 1,
50 OMPI_EMC = 2, 50 OMPI_EMC = 2,
51 QTOPIA_EMC = 3, 51 QTOPIA_EMC = 3,
52 OPIE_EMC = 4 52 OPIE_EMC = 4
53 }; 53 };
54 54
55 enum PhoneClients { 55 enum PhoneClients {
56 NONE_PHC = 0, 56 NONE_PHC = 0,
57 OTHER_PHC = 1, 57 OTHER_PHC = 1,
58 KPPI_PHC = 2 58 KPPI_PHC = 2
59 }; 59 };
60 60
61 enum FaxClients { 61 enum FaxClients {
62 NONE_FAC = 0, 62 NONE_FAC = 0,
63 OTHER_FAC = 1 63 OTHER_FAC = 1
64 }; 64 };
65 65
66 enum SMSClients { 66 enum SMSClients {
67 NONE_SMC = 0, 67 NONE_SMC = 0,
68 OTHER_SMC = 1 68 OTHER_SMC = 1
69 }; 69 };
70 70
71 enum PagerClients { 71 enum PagerClients {
72 NONE_PAC = 0, 72 NONE_PAC = 0,
73 OTHER_PAC = 1 73 OTHER_PAC = 1
74 }; 74 };
75 75
76 enum SIPClients { 76 enum SIPClients {
77 NONE_SIC = 0, 77 NONE_SIC = 0,
78 OTHER_SIC = 1 78 OTHER_SIC = 1
79 }; 79 };
80 80
81 private: 81 private:
82 KPimGlobalPrefs( const QString &name = QString::null ); 82 KPimGlobalPrefs( const QString &name = QString::null );
83 83
84 static KPimGlobalPrefs *sInstance; 84 static KPimGlobalPrefs *sInstance;
85 85
86 86
87 public: 87 public:
88 //US I copied the following "locale" settings from KOPrefs 88 //US I copied the following "locale" settings from KOPrefs
89 int mPreferredDate; 89 int mPreferredDate;
90 QString mUserDateFormatLong; 90 QString mUserDateFormatLong;
91 QString mUserDateFormatShort; 91 QString mUserDateFormatShort;
92 int mPreferredLanguage; 92 int mPreferredLanguage;
93 int mPreferredTime; 93 int mPreferredTime;
94 bool mWeekStartsOnSunday; 94 bool mWeekStartsOnSunday;
95 QString mTimeZoneId; 95 QString mTimeZoneId;
96 bool mUseDaylightsaving; 96 bool mUseDaylightsaving;
97 int mDaylightsavingStart; 97 int mDaylightsavingStart;
98 int mDaylightsavingEnd; 98 int mDaylightsavingEnd;
99 99
100 int mEmailClient; 100 int mEmailClient;
101 QString mEmailOtherChannel; 101 QString mEmailOtherChannel;
102 QString mEmailOtherMessage; 102 QString mEmailOtherMessage;
103 QString mEmailOtherMessageParameters; 103 QString mEmailOtherMessageParameters;
104 QString mEmailOtherMessage2; 104 QString mEmailOtherMessage2;
105 QString mEmailOtherMessageParameters2; 105 QString mEmailOtherMessageParameters2;
106 106
107 int mPhoneClient; 107 int mPhoneClient;
108 QString mPhoneOtherChannel; 108 QString mPhoneOtherChannel;
109 QString mPhoneOtherMessage; 109 QString mPhoneOtherMessage;
110 QString mPhoneOtherMessageParameters; 110 QString mPhoneOtherMessageParameters;
111 111
112 int mFaxClient; 112 int mFaxClient;
113 QString mFaxOtherChannel; 113 QString mFaxOtherChannel;
114 QString mFaxOtherMessage; 114 QString mFaxOtherMessage;
115 QString mFaxOtherMessageParameters; 115 QString mFaxOtherMessageParameters;
116 116
117 int mSMSClient; 117 int mSMSClient;
118 QString mSMSOtherChannel; 118 QString mSMSOtherChannel;
119 QString mSMSOtherMessage; 119 QString mSMSOtherMessage;
120 QString mSMSOtherMessageParameters; 120 QString mSMSOtherMessageParameters;
121 121
122 int mPagerClient; 122 int mPagerClient;
123 QString mPagerOtherChannel; 123 QString mPagerOtherChannel;
124 QString mPagerOtherMessage; 124 QString mPagerOtherMessage;
125 QString mPagerOtherMessageParameters; 125 QString mPagerOtherMessageParameters;
126 126
127 int mSipClient; 127 int mSipClient;
128 QString mSipOtherChannel; 128 QString mSipOtherChannel;
129 QString mSipOtherMessage; 129 QString mSipOtherMessage;
130 QString mSipOtherMessageParameters; 130 QString mSipOtherMessageParameters;
131 131
132 QString mEx2PhoneDevice;
133 QString mEx2PhoneConnection;
134 QString mEx2PhoneModel;
132 135
133}; 136};
134 137
135#endif 138#endif
diff --git a/libkdepim/libkdepim.pro b/libkdepim/libkdepim.pro
index eac19ea..84af7ad 100644
--- a/libkdepim/libkdepim.pro
+++ b/libkdepim/libkdepim.pro
@@ -1,59 +1,61 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2 CONFIG = qt warn_on 2 CONFIG = qt warn_on
3DEFINES +=KORG_NOKABC 3DEFINES +=KORG_NOKABC
4TARGET = microkdepim 4TARGET = microkdepim
5INCLUDEPATH += ../microkde ../microkde/kdecore ../microkde/kdeui . .. 5INCLUDEPATH += ../microkde ../microkde/kdecore ../microkde/kdeui . ..
6DESTDIR=../bin 6DESTDIR=../bin
7 7
8DEFINES += DESKTOP_VERSION 8DEFINES += DESKTOP_VERSION
9include( ../variables.pri ) 9include( ../variables.pri )
10unix : { 10unix : {
11OBJECTS_DIR = obj/unix 11OBJECTS_DIR = obj/unix
12MOC_DIR = moc/unix 12MOC_DIR = moc/unix
13} 13}
14win32: { 14win32: {
15DEFINES += _WIN32_ 15DEFINES += _WIN32_
16OBJECTS_DIR = obj/win 16OBJECTS_DIR = obj/win
17MOC_DIR = moc/win 17MOC_DIR = moc/win
18} 18}
19INTERFACES = \ 19INTERFACES = \
20 20
21HEADERS = \ 21HEADERS = \
22 categoryeditdialog.h \ 22 categoryeditdialog.h \
23 categoryeditdialog_base.h \ 23 categoryeditdialog_base.h \
24 categoryselectdialog.h \ 24 categoryselectdialog.h \
25 categoryselectdialog_base.h \ 25 categoryselectdialog_base.h \
26 externalapphandler.h \ 26 externalapphandler.h \
27 kdateedit.h \ 27 kdateedit.h \
28 kdatepicker.h \ 28 kdatepicker.h \
29 kinputdialog.h \ 29 kinputdialog.h \
30 kpimprefs.h \ 30 kpimprefs.h \
31 kpimglobalprefs.h \ 31 kpimglobalprefs.h \
32 kprefsdialog.h \ 32 kprefsdialog.h \
33 kprefswidget.h \ 33 kprefswidget.h \
34 ksyncmanager.h \ 34 ksyncmanager.h \
35 ksyncprofile.h \ 35 ksyncprofile.h \
36 ksyncprefsdialog.h \ 36 ksyncprefsdialog.h \
37 kcmconfigs/kcmkdepimconfig.h \ 37 kcmconfigs/kcmkdepimconfig.h \
38 kcmconfigs/kdepimconfigwidget.h 38 kcmconfigs/kdepimconfigwidget.h \
39 phoneaccess.h
39 40
40SOURCES = \ 41SOURCES = \
41 categoryeditdialog.cpp \ 42 categoryeditdialog.cpp \
42 categoryeditdialog_base.cpp \ 43 categoryeditdialog_base.cpp \
43 categoryselectdialog.cpp \ 44 categoryselectdialog.cpp \
44 categoryselectdialog_base.cpp \ 45 categoryselectdialog_base.cpp \
45 externalapphandler.cpp \ 46 externalapphandler.cpp \
46 kdateedit.cpp \ 47 kdateedit.cpp \
47 kdatepicker.cpp \ 48 kdatepicker.cpp \
48 kinputdialog.cpp \ 49 kinputdialog.cpp \
49 kpimprefs.cpp \ 50 kpimprefs.cpp \
50 kpimglobalprefs.cpp \ 51 kpimglobalprefs.cpp \
51 kprefsdialog.cpp \ 52 kprefsdialog.cpp \
52 kprefswidget.cpp \ 53 kprefswidget.cpp \
53 ksyncmanager.cpp \ 54 ksyncmanager.cpp \
54 ksyncprofile.cpp \ 55 ksyncprofile.cpp \
55 ksyncprefsdialog.cpp \ 56 ksyncprefsdialog.cpp \
56 kcmconfigs/kcmkdepimconfig.cpp \ 57 kcmconfigs/kcmkdepimconfig.cpp \
57 kcmconfigs/kdepimconfigwidget.cpp 58 kcmconfigs/kdepimconfigwidget.cpp \
59 phoneaccess.cpp
58 60
59 61
diff --git a/libkdepim/libkdepimE.pro b/libkdepim/libkdepimE.pro
index 156e247..f3db68e 100644
--- a/libkdepim/libkdepimE.pro
+++ b/libkdepim/libkdepimE.pro
@@ -1,55 +1,57 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2 CONFIG += qt warn_on 2 CONFIG += qt warn_on
3TARGET = microkdepim 3TARGET = microkdepim
4INCLUDEPATH += . $(KDEPIMDIR) $(KDEPIMDIR)/microkde $(KDEPIMDIR)/qtcompat $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kdeui $(QPEDIR)/include 4INCLUDEPATH += . $(KDEPIMDIR) $(KDEPIMDIR)/microkde $(KDEPIMDIR)/qtcompat $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kdeui $(QPEDIR)/include
5LIBS += -lmicrokde 5LIBS += -lmicrokde
6#LIBS += -lmicrokcal 6#LIBS += -lmicrokcal
7LIBS += -L$(QPEDIR)/lib 7LIBS += -L$(QPEDIR)/lib
8OBJECTS_DIR = obj/$(PLATFORM) 8OBJECTS_DIR = obj/$(PLATFORM)
9MOC_DIR = moc/$(PLATFORM) 9MOC_DIR = moc/$(PLATFORM)
10DESTDIR=$(QPEDIR)/lib 10DESTDIR=$(QPEDIR)/lib
11 11
12 12
13INTERFACES = \ 13INTERFACES = \
14 14
15HEADERS = \ 15HEADERS = \
16 categoryeditdialog.h \ 16 categoryeditdialog.h \
17 categoryeditdialog_base.h \ 17 categoryeditdialog_base.h \
18 categoryselectdialog.h \ 18 categoryselectdialog.h \
19 categoryselectdialog_base.h \ 19 categoryselectdialog_base.h \
20 externalapphandler.h \ 20 externalapphandler.h \
21 kdateedit.h \ 21 kdateedit.h \
22 kdatepicker.h \ 22 kdatepicker.h \
23 kinputdialog.h \ 23 kinputdialog.h \
24 kpimprefs.h \ 24 kpimprefs.h \
25 kpimglobalprefs.h \ 25 kpimglobalprefs.h \
26 kprefsdialog.h \ 26 kprefsdialog.h \
27 kprefswidget.h \ 27 kprefswidget.h \
28 ksyncmanager.h \ 28 ksyncmanager.h \
29 ksyncprofile.h \ 29 ksyncprofile.h \
30 ksyncprefsdialog.h \ 30 ksyncprefsdialog.h \
31 kcmconfigs/kcmkdepimconfig.h \ 31 kcmconfigs/kcmkdepimconfig.h \
32 kcmconfigs/kdepimconfigwidget.h 32 kcmconfigs/kdepimconfigwidget.h \
33 phoneaccess.h
33 34
34 35
35 36
36SOURCES = \ 37SOURCES = \
37 categoryeditdialog.cpp \ 38 categoryeditdialog.cpp \
38 categoryeditdialog_base.cpp \ 39 categoryeditdialog_base.cpp \
39 categoryselectdialog.cpp \ 40 categoryselectdialog.cpp \
40 categoryselectdialog_base.cpp \ 41 categoryselectdialog_base.cpp \
41 externalapphandler.cpp \ 42 externalapphandler.cpp \
42 kdateedit.cpp \ 43 kdateedit.cpp \
43 kinputdialog.cpp \ 44 kinputdialog.cpp \
44 kdatepicker.cpp \ 45 kdatepicker.cpp \
45 kpimprefs.cpp \ 46 kpimprefs.cpp \
46 kpimglobalprefs.cpp \ 47 kpimglobalprefs.cpp \
47 kprefsdialog.cpp \ 48 kprefsdialog.cpp \
48 kprefswidget.cpp \ 49 kprefswidget.cpp \
49 ksyncmanager.cpp \ 50 ksyncmanager.cpp \
50 ksyncprofile.cpp \ 51 ksyncprofile.cpp \
51 ksyncprefsdialog.cpp \ 52 ksyncprefsdialog.cpp \
52 kcmconfigs/kcmkdepimconfig.cpp \ 53 kcmconfigs/kcmkdepimconfig.cpp \
53 kcmconfigs/kdepimconfigwidget.cpp 54 kcmconfigs/kdepimconfigwidget.cpp \
55 phoneaccess.cpp
54 56
55 57
diff --git a/libkdepim/phoneaccess.cpp b/libkdepim/phoneaccess.cpp
new file mode 100644
index 0000000..c0bd6cc
--- a/dev/null
+++ b/libkdepim/phoneaccess.cpp
@@ -0,0 +1,153 @@
1/*
2 This file is part of libkdepim.
3
4 Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org>
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
15
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA.
20*/
21
22
23#include <qstring.h>
24#include <qapplication.h>
25#include <qptrlist.h>
26#include <qregexp.h>
27#include <qfile.h>
28#include <qtextstream.h>
29#include <qtextcodec.h>
30#include <qdir.h>
31#include <kmessagebox.h>
32#include <stdlib.h>
33#include "phoneaccess.h"
34
35void PhoneAccess::writeConfig( QString device, QString connection, QString model )
36{
37#ifdef _WIN32_
38 QString fileName = qApp->applicationDirPath () +"\\gammurc";
39#else
40 QString fileName = QDir::homeDirPath() +"/.gammurc";
41#endif
42 //qDebug("save %d ", load );
43 QString content;
44 bool write = false;
45 bool addPort = true, addConnection = true, addModel = true;
46 QFile file( fileName );
47 if ( QFile::exists( fileName) ) {
48 if (!file.open( IO_ReadOnly ) ) {
49 qDebug("Error: cannot open %s ", fileName.latin1() );
50 return;
51 }
52 QString line;
53 while ( file.readLine( line, 1024 ) > 0 ) {
54 //qDebug("*%s* ", line.latin1() );
55 if ( line.left(7 ) == "[gammu]" ) {
56 ;
57 } else
58 if ( line.left(4 ) == "port" ) {
59 if ( line == "port = " + device+"\n" ) {
60 content += line ;
61 addPort = false;
62 //qDebug("port found" );
63 }
64
65 } else if ( line.left(5 ) == "model" ) {
66 if ( line == "model = " + model +"\n") {
67 content += line ;
68 addModel = false;
69 //qDebug("model found" );
70 }
71
72 } else if ( line.left( 10 ) == "connection" ) {
73 if ( line == "connection = " + connection +"\n") {
74 addConnection = false;
75 content += line ;
76 //qDebug("con found" );
77 }
78
79 } else {
80 content += line ;
81 }
82 }
83 file.close();
84 } else {
85 if ( ! connection.isEmpty() ) {
86 addConnection = true;
87 }
88 if ( ! device.isEmpty() ) {
89 addPort = true;
90
91 }
92 if ( ! model.isEmpty() ) {
93 addModel = true;
94 }
95 }
96
97 if ( addConnection ) {
98 if ( ! write )
99 content += "[gammu]\n";
100 write = true;
101 content += "connection = ";
102 content += connection;
103 content += "\n";
104 }
105 if ( addPort ) {
106 if ( ! write )
107 content += "[gammu]\n";
108 write = true;
109 content += "port = ";
110 content += device;
111 content += "\n";
112
113 }
114 if ( addModel ) {
115 if ( ! write )
116 content += "[gammu]\n";
117 write = true;
118 content += "model = ";
119 content += model;
120 content += "\n";
121 }
122 if ( write ) {
123 if (!file.open( IO_WriteOnly ) ) {
124 qDebug("Error: cannot write file %s ", fileName.latin1() );
125 return;
126 }
127 qDebug("Writing file %s ", fileName.latin1() );
128 QTextStream ts( &file );
129 ts << content ;
130 file.close();
131 }
132
133}
134
135
136bool PhoneAccess::writeToPhone( QString fileName)
137{
138
139#ifdef DESKTOP_VERSION
140 QString command ="./kammu --restore " + fileName ;
141#else
142 QString command ="kammu --restore " + fileName ;
143#endif
144 int ret;
145 while ( (ret = system ( command.latin1())) != 0 ) {
146 qDebug("Error S::command returned %d. asking users", ret);
147 int retval = KMessageBox::warningContinueCancel(0,
148 i18n("Error accessing device!\nPlease turn on connection\nand retry!"),i18n("KO/Pi phone access"),i18n("Retry"),i18n("Cancel"));
149 if ( retval != KMessageBox::Continue )
150 return false;
151 }
152 return true;
153}
diff --git a/libkdepim/phoneaccess.h b/libkdepim/phoneaccess.h
new file mode 100644
index 0000000..b7c4732
--- a/dev/null
+++ b/libkdepim/phoneaccess.h
@@ -0,0 +1,42 @@
1/*
2 This file is part of libkcal.
3
4 Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
15
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA.
20*/
21#ifndef PHONEACCESS_H
22#define PHONEACCESS_H
23
24#include <qstring.h>
25
26
27
28/**
29 This class implements the calendar format used by Phone.
30*/
31
32class PhoneAccess : public QObject {
33 public:
34
35 static void writeConfig( QString device,QString connection, QString model );
36 static bool writeToPhone( QString fileName );
37
38};
39
40
41
42#endif