summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/kaddressbookE.pro5
-rw-r--r--kmicromail/kmicromailE.pro4
-rw-r--r--korganizer/calendarview.cpp2
-rw-r--r--korganizer/korganizerE.pro7
-rw-r--r--libkcal/phoneformat.cpp79
-rw-r--r--libkcal/phoneformat.h14
6 files changed, 66 insertions, 45 deletions
diff --git a/kaddressbook/kaddressbookE.pro b/kaddressbook/kaddressbookE.pro
index 41f293d..86166d8 100644
--- a/kaddressbook/kaddressbookE.pro
+++ b/kaddressbook/kaddressbookE.pro
@@ -2,48 +2,53 @@ TEMPLATE = app
CONFIG += qt warn_on
TARGET = kapi
OBJECTS_DIR = obj/$(PLATFORM)
MOC_DIR = moc/$(PLATFORM)
DESTDIR=$(QPEDIR)/bin
#LFLAGS += -Wl,-export-dynamic
INCLUDEPATH += . ./details ./features ./xxport ../libkdepim ../microkde ../microkde/kdecore ../microkde/kutils ../microkde/kio/kfile ../microkde/kio/kio ../microkde/kdeui ../microkde/kresources ../kabc ../qtcompat ../ interfaces $(QPEDIR)/include
DEFINES += KAB_EMBEDDED KAB_NOSPLITTER
#DEFINES += KORG_NODND KORG_NOPLUGINS KORG_NOKABC KORG_NOARCHIVE KORG_NOMAIL
#DEFINES += KORG_NOPRINTER KORG_NODCOP KORG_NOKALARMD KORG_NORESOURCEVIEW KORG_NOSPLITTER
#DEFINES += KORG_NOLVALTERNATION
LIBS += -lmicrokdepim
#LIBS += -lmicrokcal
LIBS += -lmicrokde
LIBS += -lmicrokcal
LIBS += -lmicroqtcompat
LIBS += -lmicrokabc
LIBS += -lqpe
LIBS += -ljpeg
+
+LIBS += -lmicrogammu
+LIBS += -lbluetooth
+LIBS += -lsdp
+
LIBS += $(QTOPIALIB)
LIBS += -L$(QPEDIR)/lib
LIBS += -Wl,-export-dynamic
INTERFACES = \
# filteredit_base.ui \
# kofilterview_base.ui \
HEADERS = \
features/mergewidget.h \
features/distributionlistwidget.h \
kcmconfigs/addresseewidget.h \
kcmconfigs/extensionconfigdialog.h \
kcmconfigs/kcmkabconfig.h \
kcmconfigs/kabconfigwidget.h \
addresseeeditordialog.h \
addresseeeditorwidget.h \
addresseditwidget.h \
addresseeconfig.h \
addresseeutil.h \
emaileditwidget.h \
filtereditdialog.h \
kaddressbookmain.h \
kabprefs.h \
diff --git a/kmicromail/kmicromailE.pro b/kmicromail/kmicromailE.pro
index 8d13796..9cedb21 100644
--- a/kmicromail/kmicromailE.pro
+++ b/kmicromail/kmicromailE.pro
@@ -35,31 +35,35 @@ SOURCES = main.cpp \
selectsmtp.cpp \
nntpgroups.cpp \
nntpgroupsdlg.cpp
INTERFACES = editaccountsui.ui \
selectmailtypeui.ui \
imapconfigui.ui \
pop3configui.ui \
nntpconfigui.ui \
smtpconfigui.ui \
composemailui.ui \
settingsdialogui.ui \
statuswidgetui.ui \
newmaildirui.ui \
selectstoreui.ui \
nntpgroupsui.ui
INCLUDEPATH += ../microkde ../microkde/kdecore ./libetpan/include $(QPEDIR)/include . .. ../microkde/kdeui ../qtcompat
LIBS += -L$(QPEDIR)/lib -lkmicromailwrapper -lqpe -lkmicrolibetpan -lmicrokde -lmicroqtcompat -lssl -lcrypto -ljpeg -lmicrokde -lmicroqtcompat -lmicrokabc -lmicrokcal
LIBS += $(QTOPIALIB)
#LIBS += -lqtopia
#next line for Zaurus only
#LIBS += -luuid
+
+LIBS += -lmicrogammu
+LIBS += -lbluetooth
+LIBS += -lsdp
#
OBJECTS_DIR = obj/$(PLATFORM)
MOC_DIR = moc/$(PLATFORM)
DESTDIR=$(QPEDIR)/bin
TARGET = ompi
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index a7f7010..b307649 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1167,49 +1167,49 @@ bool CalendarView::syncCalendar(QString filename, int mode)
}
}
setModified( true );
}
delete storage;
delete calendar;
if ( syncOK )
updateView();
return syncOK;
}
void CalendarView::syncPhone()
{
syncExternal( 1 );
}
void CalendarView::syncExternal( int mode )
{
mGlobalSyncMode = SYNC_MODE_EXTERNAL;
//mCurrentSyncDevice = "sharp-DTM";
if ( KOPrefs::instance()->mAskForPreferences )
edit_sync_options();
qApp->processEvents();
CalendarLocal* calendar = new CalendarLocal();
calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
bool syncOK = false;
- boo loadSuccess = false;
+ bool loadSuccess = false;
PhoneFormat* phoneFormat = 0;
#ifndef DESKTOP_VERSION
SharpFormat* sharpFormat = 0;
if ( mode == 0 ) { // sharp
sharpFormat = new SharpFormat () ;
loadSuccess = sharpFormat->load( calendar, mCalendar );
} else
#endif
if ( mode == 1 ) { // phone
phoneFormat = new PhoneFormat ();
loadSuccess = phoneFormat->load( calendar, mCalendar );
} else
return;
if ( loadSuccess ) {
getEventViewerDialog()->setSyncMode( true );
syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs );
getEventViewerDialog()->setSyncMode( false );
qApp->processEvents();
if ( syncOK ) {
if ( KOPrefs::instance()->mWriteBackFile )
{
QPtrList<Incidence> iL = mCalendar->rawIncidences();
diff --git a/korganizer/korganizerE.pro b/korganizer/korganizerE.pro
index 727764a..b39de35 100644
--- a/korganizer/korganizerE.pro
+++ b/korganizer/korganizerE.pro
@@ -1,43 +1,50 @@
TEMPLATE = app
CONFIG += qt warn_on
TARGET = kopi
OBJECTS_DIR = obj/$(PLATFORM)
MOC_DIR = moc/$(PLATFORM)
DESTDIR=$(QPEDIR)/bin
INCLUDEPATH += ../microkde ../microkde/kdecore ../microkde/kio/kfile ../microkde/kio/kio ../microkde/kdeui ../qtcompat ../ interfaces ../kabc $(QPEDIR)/include
#../libkabcwrap
DEFINES += KORG_NODND KORG_NOPLUGINS KORG_NOARCHIVE KORG_NOMAIL
DEFINES += KORG_NOPRINTER KORG_NODCOP KORG_NOKALARMD KORG_NORESOURCEVIEW KORG_NOSPLITTER
DEFINES += KORG_NOLVALTERNATION
#KORG_NOKABC
LIBS += -lmicrokdepim
LIBS += -lmicrokcal
LIBS += -lmicrokde
LIBS += -lmicroqtcompat
LIBS += -lmicrokabc
#LIBS += -lmicrokabcwrap
+
+#LIBS += $(QPEDIR)/lib/gammu
+LIBS += -lmicrogammu
+LIBS += -lbluetooth
+LIBS += -lsdp
+
+
LIBS += -lqpe
LIBS += -ljpeg
LIBS += $(QTOPIALIB)
LIBS += -L$(QPEDIR)/lib
INTERFACES = kofilterview_base.ui
#filteredit_base.ui
HEADERS = \
wordsgerman.h \
filteredit_base.h \
alarmclient.h \
calendarview.h \
customlistviewitem.h \
datenavigator.h \
docprefs.h \
filtereditdialog.h \
incomingdialog.h \
incomingdialog_base.h \
interfaces/korganizer/baseview.h \
interfaces/korganizer/calendarviewbase.h \
journalentry.h \
kdateedit.h \
kdatenavigator.h \
diff --git a/libkcal/phoneformat.cpp b/libkcal/phoneformat.cpp
index f78730d..fa18683 100644
--- a/libkcal/phoneformat.cpp
+++ b/libkcal/phoneformat.cpp
@@ -38,81 +38,81 @@
#include "calendar.h"
#include "alarm.h"
#include "recurrence.h"
#include "calendarlocal.h"
#include "phoneformat.h"
using namespace KCal;
//CARDID,CATEGORY,DSRP,PLCE,MEM1,TIM1,TIM2,ADAY,ARON,ARMN,ARSD,RTYP,RFRQ,RPOS,RDYS,REND,REDT,ALSD,ALED,MDAY
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
//ARSD silentalarm = 0
// 11 RTYP 225 no /0 dialy/ 1 weekly/ 3 month by date/ 2 month by day(pos)/ yearly
// 12 RFRQ
// 13 RPOS pos = 4. monday in month
// 14 RDYS days: 1 mon/ 2 tue .. 64 sun
// 15 REND 0 = no end/ 1 = end
// 16 REDT rec end dt
//ALSD
//ALED
//MDAY
-class SharpParser : public QObject
+class PhoneParser : public QObject
{
public:
- SharpParser( Calendar *calendar ) : mCalendar( calendar ) {
+ PhoneParser( Calendar *calendar ) : mCalendar( calendar ) {
oldCategories = 0;
}
bool startElement( Calendar *existingCalendar, const QStringList & attList, QString qName )
{
int i = 1;
bool skip = true;
int max = attList.count() -2;
while ( i < max ) {
if ( !attList[i].isEmpty() ) {
skip = false;
break;
}
++i ;
}
if ( skip )
return false;
- ulong cSum = SharpFormat::getCsum(attList );
+ ulong cSum = PhoneFormat::getCsum(attList );
if ( qName == "Event" ) {
Event *event;
- event = existingCalendar->event( attList[0].toInt() );
+ event = existingCalendar->event( attList[0] );
if ( event )
event = (Event*)event->clone();
else
event = new Event;
- event->setZaurusId( attList[0].toInt() );
- event->setZaurusUid( cSum );
- event->setZaurusStat( -2 );
+ // event->setZaurusId( attList[0].toInt() );
+ //event->setZaurusUid( cSum );
+ //event->setZaurusStat( -2 );
event->setSummary( attList[2] );
event->setLocation( attList[3] );
event->setDescription( attList[4] );
if ( attList[7] == "1" ) {
event->setDtStart( QDateTime(fromString( attList[17]+"T000000", false ).date(),QTime(0,0,0 ) ));
event->setDtEnd( QDateTime(fromString( attList[18]+"T000000", false ).date(),QTime(0,0,0 )));
event->setFloats( true );
} else {
event->setFloats( false );
event->setDtStart( fromString( attList[5] ) );
event->setDtEnd( fromString( attList[6] ));
}
QString rtype = attList[11];
if ( rtype != "255" ) {
// qDebug("recurs ");
QDate startDate = event->dtStart().date();
QString freqStr = attList[12];
int freq = freqStr.toInt();
QString hasEndDateStr = attList[15] ;
bool hasEndDate = hasEndDateStr == "1";
@@ -167,63 +167,63 @@ class SharpParser : public QObject
}
QString categoryList = attList[1] ;
event->setCategories( lookupCategories( categoryList ) );
// strange 0 semms to mean: alarm enabled
if ( attList[8] == "0" ) {
Alarm *alarm;
if ( event->alarms().count() > 0 )
alarm = event->alarms().first();
else {
alarm = new Alarm( event );
event->addAlarm( alarm );
}
alarm->setType( Alarm::Audio );
alarm->setEnabled( true );
int alarmOffset = attList[9].toInt();
alarm->setStartOffset( alarmOffset * -60 );
}
mCalendar->addEvent( event);
} else if ( qName == "Todo" ) {
Todo *todo;
- todo = existingCalendar->todo( attList[0].toInt() );
+ todo = existingCalendar->todo( attList[0] );
if (todo )
todo = (Todo*)todo->clone();
else
todo = new Todo;
//CARDID,CATEGORY,ETDY,LTDY,FNDY,MARK,PRTY,TITL,MEM1
// 0 1 2 3 4 5 6 7 8
//1,,,,,1,4,Loch zumachen,""
//3,Privat,20040317T000000,20040318T000000,20040319T000000,0,5,Call bbb,"notes123 bbb gggg ""bb "" "
//2,"Familie,Freunde,Holiday",20040318T000000,20040324T000000,20040317T000000,1,2,tod2,notes
- todo->setZaurusId( attList[0].toInt() );
- todo->setZaurusUid( cSum );
- todo->setZaurusStat( -2 );
+ //todo->setZaurusId( attList[0] );
+ //todo->setZaurusUid( cSum );
+ //todo->setZaurusStat( -2 );
todo->setSummary( attList[7] );
todo->setDescription( attList[8]);
int priority = attList[6].toInt();
if ( priority == 0 ) priority = 3;
todo->setPriority( priority );
QString categoryList = attList[1];
todo->setCategories( lookupCategories( categoryList ) );
QString hasDateStr = attList[3]; // due
if ( !hasDateStr.isEmpty() ) {
if ( hasDateStr.right(6) == "000000" ) {
todo->setDtDue( QDateTime(fromString( hasDateStr, false ).date(), QTime(0,0,0 )) );
todo->setFloats( true );
}
else {
todo->setDtDue( fromString( hasDateStr ) );
todo->setFloats( false );
}
@@ -302,85 +302,85 @@ class SharpParser : public QObject
}
categories.append(cate );
}
return categories;
}
private:
Calendar *mCalendar;
QStringList * oldCategories;
static QString category( const QString &id )
{
QMap<QString,QString>::ConstIterator it = mCategoriesMap.find( id );
if ( it == mCategoriesMap.end() ) return id;
else return *it;
}
static void setCategory( const QString &id, const QString &name )
{
mCategoriesMap.insert( id, name );
}
static QMap<QString,QString> mCategoriesMap;
};
-QMap<QString,QString> SharpParser::mCategoriesMap;
+QMap<QString,QString> PhoneParser::mCategoriesMap;
-SharpFormat::SharpFormat()
+PhoneFormat::PhoneFormat()
{
mCategories = 0;
}
-SharpFormat::~SharpFormat()
+PhoneFormat::~PhoneFormat()
{
}
-ulong SharpFormat::getCsum( const QStringList & attList)
+ulong PhoneFormat::getCsum( const QStringList & attList)
{
int max = attList.count() -1;
ulong cSum = 0;
int j,k,i;
int add;
for ( i = 1; i < max ; ++i ) {
QString s = attList[i];
if ( ! s.isEmpty() ){
j = s.length();
for ( k = 0; k < j; ++k ) {
int mul = k +1;
add = s[k].unicode ();
if ( k < 16 )
mul = mul * mul;
add = add * mul *i*i*i;
cSum += add;
}
}
}
return cSum;
}
//extern "C" GSM_Error GSM_InitConnection(GSM_StateMachine *s, int ReplyNum);
#include <stdlib.h>
#define DEBUGMODE false
-bool SharpFormat::load( Calendar *calendar, Calendar *existngCal )
+bool PhoneFormat::load( Calendar *calendar, Calendar *existngCal )
{
GSM_StateMachine s;
qDebug(" load ");
s.opened = false;
s.msg = NULL;
s.ConfigNum = 0;
static char *cp;
static INI_Section *cfg = NULL;
cfg=GSM_FindGammuRC();
int i;
for (i = 0; i <= MAX_CONFIG_NUM; i++) {
if (cfg!=NULL) {
cp = (char *)INI_GetValue(cfg, (unsigned char*) "gammu", (unsigned char*)"gammucoding", false);
if (cp) di.coding = cp;
s.Config[i].Localize = (char *)INI_GetValue(cfg, (unsigned char*) "gammu", (unsigned char*) "gammuloc", false);
if (s.Config[i].Localize) {
s.msg=INI_ReadFile(s.Config[i].Localize, true);
} else {
#if !defined(WIN32) && defined(LOCALE_PATH)
locale = setlocale(LC_MESSAGES, NULL);
if (locale != NULL) {
snprintf(locale_file, 200, "%s/gammu_%c%c.txt",
@@ -467,144 +467,144 @@ static char *cp;
qApp->processEvents();
if ( ! debug ) {
fileName = "/tmp/kopitempout";
QString command = "db2file todo -r -c " + codec+ " > " + fileName;
system ( command.latin1() );
} else {
fileName = "/tmp/todo.txt";
}
file.setName( fileName );
if (!file.open( IO_ReadOnly ) ) {
return false;
}
ts.setDevice( &file );
text = ts.read();
file.close();
status.setText( i18n("Processing todos ...") );
status.raise();
qApp->processEvents();
fromString2Cal( calendar, existngCal, text, "Todo" );
#endif
return true;
}
-int SharpFormat::getNumFromRecord( QString answer, Incidence* inc )
+int PhoneFormat::getNumFromRecord( QString answer, Incidence* inc )
{
int retval = -1;
QStringList templist;
QString tempString;
int start = 0;
int len = answer.length();
int end = answer.find ("\n",start)+1;
bool ok = true;
start = end;
int ccc = 0;
while ( start > 0 ) {
templist.clear();
ok = true;
int loopCount = 0;
while ( ok ) {
++loopCount;
if ( loopCount > 25 ) {
qDebug("KO: Error in while loop");
ok = false;
start = 0;
break;
}
if ( ok )
tempString = getPart( answer, ok, start );
if ( start >= len || start == 0 ) {
start = 0;
ok = false;
}
if ( tempString.right(1) =="\n" )
tempString = tempString.left( tempString.length()-1);
templist.append( tempString );
}
++ccc;
if ( ccc == 2 && loopCount < 25 ) {
start = 0;
bool ok;
int newnum = templist[0].toInt( &ok );
if ( ok && newnum > 0) {
retval = newnum;
- inc->setZaurusId( newnum );
- inc->setZaurusUid( getCsum( templist ) );
- inc->setZaurusStat( -4 );
+ //inc->setZaurusId( newnum );
+ //inc->setZaurusUid( getCsum( templist ) );
+ //inc->setZaurusStat( -4 );
}
}
}
//qDebug("getNumFromRecord returning : %d ", retval);
return retval;
}
-bool SharpFormat::save( Calendar *calendar)
+bool PhoneFormat::save( Calendar *calendar)
{
QLabel status ( i18n("Processing/adding events ..."), 0 );
int w = status.sizeHint().width()+20 ;
if ( w < 200 ) w = 200;
int h = status.sizeHint().height()+20 ;
int dw = QApplication::desktop()->width();
int dh = QApplication::desktop()->height();
status.setCaption(i18n("Writing DTM Data") );
status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
status.show();
status.raise();
qApp->processEvents();
bool debug = DEBUGMODE;
QString codec = "utf8";
QString answer;
QString ePrefix = "CARDID,CATEGORY,DSRP,PLCE,MEM1,TIM1,TIM2,ADAY,ARON,ARMN,ARSD,RTYP,RFRQ,RPOS,RDYS,REND,REDT,ALSD,ALED,MDAY\n";
QString tPrefix = "CARDID,CATEGORY,ETDY,LTDY,FNDY,MARK,PRTY,TITL,MEM1\n";
QString command;
QPtrList<Event> er = calendar->rawEvents();
Event* ev = er.first();
QString fileName = "/tmp/kopitempout";
int i = 0;
QString changeString = ePrefix;
QString deleteString = ePrefix;
bool deleteEnt = false;
bool changeEnt = false;
QString message = i18n("Processing event # ");
int procCount = 0;
while ( ev ) {
//qDebug("i %d ", ++i);
- if ( ev->zaurusStat() != -2 ) {
+ if ( true /*ev->zaurusStat() != -2*/ ) {
status.setText ( message + QString::number ( ++procCount ) );
qApp->processEvents();
QString eString = getEventString( ev );
- if ( ev->zaurusStat() == -3 ) { // delete
+ if (/* ev->zaurusStat() == -3 */ true) { // delete
// deleting empty strings does not work.
// we write first and x and then delete the record with the x
eString = eString.replace( QRegExp(",\"\""),",\"x\"" );
changeString += eString + "\n";
deleteString += eString + "\n";
deleteEnt = true;
changeEnt = true;
}
- else if ( ev->zaurusId() == -1 ) { // add new
+ else if ( /*ev->zaurusId() == -1*/true ) { // add new
command = "(echo \"" + ePrefix + eString + "\" ) | db2file datebook -w -g -c " + codec+ " > "+ fileName;
system ( command.utf8() );
QFile file( fileName );
if (!file.open( IO_ReadOnly ) ) {
return false;
}
QTextStream ts( &file );
ts.setCodec( QTextCodec::codecForName("utf8") );
answer = ts.read();
file.close();
//qDebug("answer \n%s ", answer.latin1());
getNumFromRecord( answer, ev ) ;
}
else { // change existing
//qDebug("canging %d %d",ev->zaurusStat() ,ev->zaurusId() );
//command = "(echo \"" + ePrefix + eString + "\" ) | db2file datebook -w -g -c " + codec+ " > "+ fileName;
changeString += eString + "\n";
changeEnt = true;
}
}
ev = er.next();
@@ -635,62 +635,62 @@ bool SharpFormat::save( Calendar *calendar)
if (!file.open( IO_WriteOnly ) ) {
return false;
}
QTextStream ts( &file );
ts.setCodec( QTextCodec::codecForName("utf8") );
ts << deleteString;
file.close();
command = "db2file datebook -d -c " + codec+ " < "+ fileName;
system ( command.latin1() );
// qDebug("command %s file :\n%s ", command.latin1(), deleteString.latin1());
}
changeString = tPrefix;
deleteString = tPrefix;
status.setText ( i18n("Processing todos ...") );
qApp->processEvents();
QPtrList<Todo> tl = calendar->rawTodos();
Todo* to = tl.first();
i = 0;
message = i18n("Processing todo # ");
procCount = 0;
while ( to ) {
- if ( to->zaurusStat() != -2 ) {
+ if ( true /*to->zaurusStat() != -2 */) {
status.setText ( message + QString::number ( ++procCount ) );
qApp->processEvents();
QString eString = getTodoString( to );
- if ( to->zaurusStat() == -3 ) { // delete
+ if ( /*to->zaurusStat() == -3*/true ) { // delete
// deleting empty strings does not work.
// we write first and x and then delete the record with the x
eString = eString.replace( QRegExp(",\"\""),",\"x\"" );
changeString += eString + "\n";
deleteString += eString + "\n";
deleteEnt = true;
changeEnt = true;
}
- else if ( to->zaurusId() == -1 ) { // add new
+ else if ( true /*to->zaurusId() == -1*/ ) { // add new
command = "(echo \"" + tPrefix + eString + "\" ) | db2file todo -w -g -c " + codec+ " > "+ fileName;
system ( command.utf8() );
QFile file( fileName );
if (!file.open( IO_ReadOnly ) ) {
return false;
}
QTextStream ts( &file );
ts.setCodec( QTextCodec::codecForName("utf8") );
answer = ts.read();
file.close();
//qDebug("answer \n%s ", answer.latin1());
getNumFromRecord( answer, to ) ;
}
else { // change existing
//qDebug("canging %d %d",to->zaurusStat() ,to->zaurusId() );
//command = "(echo \"" + ePrefix + eString + "\" ) | db2file datebook -w -g -c " + codec+ " > "+ fileName;
changeString += eString + "\n";
changeEnt = true;
}
}
@@ -713,72 +713,73 @@ bool SharpFormat::save( Calendar *calendar)
system ( command.latin1() );
//qDebug("command %s file :\n%s ", command.latin1(), changeString.latin1());
}
status.setText ( i18n("Deleting todos ...") );
qApp->processEvents();
//qDebug("deleting... ");
if ( deleteEnt ) {
QFile file( fileName );
if (!file.open( IO_WriteOnly ) ) {
return false;
}
QTextStream ts( &file );
ts.setCodec( QTextCodec::codecForName("utf8") );
ts << deleteString;
file.close();
command = "db2file todo -d -c " + codec+ " < "+ fileName;
system ( command.latin1() );
// qDebug("command %s file :\n%s ", command.latin1(), deleteString.latin1());
}
return true;
}
-QString SharpFormat::dtToString( const QDateTime& dti, bool useTZ )
+QString PhoneFormat::dtToString( const QDateTime& dti, bool useTZ )
{
QString datestr;
QString timestr;
int offset = KGlobal::locale()->localTimeOffset( dti );
QDateTime dt;
if (useTZ)
dt = dti.addSecs ( -(offset*60));
else
dt = dti;
if(dt.date().isValid()){
const QDate& date = dt.date();
datestr.sprintf("%04d%02d%02d",
date.year(), date.month(), date.day());
}
if(dt.time().isValid()){
const QTime& time = dt.time();
timestr.sprintf("T%02d%02d%02d",
time.hour(), time.minute(), time.second());
}
return datestr + timestr;
}
-QString SharpFormat::getEventString( Event* event )
+QString PhoneFormat::getEventString( Event* event )
{
+#if 0
QStringList list;
list.append( QString::number(event->zaurusId() ) );
list.append( event->categories().join(",") );
if ( !event->summary().isEmpty() )
list.append( event->summary() );
else
list.append("" );
if ( !event->location().isEmpty() )
list.append( event->location() );
else
list.append("" );
if ( !event->description().isEmpty() )
list.append( event->description() );
else
list.append( "" );
if ( event->doesFloat () ) {
list.append( dtToString( QDateTime(event->dtStart().date(), QTime(0,0,0)), false ));
list.append( dtToString( QDateTime(event->dtEnd().date(),QTime(23,59,59)), false )); //6
list.append( "1" );
}
else {
list.append( dtToString( event->dtStart()) );
list.append( dtToString( event->dtEnd()) ); //6
@@ -896,102 +897,106 @@ QString SharpFormat::getEventString( Event* event )
}
else {
list.append( QString() );
list.append( QString() );
}
if (event->dtStart().date() == event->dtEnd().date() )
list.append( "0" );
else
list.append( "1" );
for(QStringList::Iterator it=list.begin();
it!=list.end(); ++it){
QString& s = (*it);
s.replace(QRegExp("\""), "\"\"");
if(s.contains(QRegExp("[,\"\r\n]")) || s.stripWhiteSpace() != s){
s.prepend('\"');
s.append('\"');
} else if(s.isEmpty() && !s.isNull()){
s = "\"\"";
}
}
return list.join(",");
-
+#endif
+ return QString();
}
-QString SharpFormat::getTodoString( Todo* todo )
+QString PhoneFormat::getTodoString( Todo* todo )
{
+#if 0
QStringList list;
list.append( QString::number( todo->zaurusId() ) );
list.append( todo->categories().join(",") );
if ( todo->hasStartDate() ) {
list.append( dtToString( todo->dtStart()) );
} else
list.append( QString() );
if ( todo->hasDueDate() ) {
QTime tim;
if ( todo->doesFloat()) {
list.append( dtToString( QDateTime(todo->dtDue().date(),QTime( 0,0,0 )), false)) ;
} else {
list.append( dtToString(todo->dtDue() ) );
}
} else
list.append( QString() );
if ( todo->isCompleted() ) {
list.append( dtToString( todo->completed()) );
list.append( "0" ); // yes 0 == completed
} else {
list.append( dtToString( todo->completed()) );
list.append( "1" );
}
list.append( QString::number( todo->priority() ));
if( ! todo->summary().isEmpty() )
list.append( todo->summary() );
else
list.append( "" );
if (! todo->description().isEmpty() )
list.append( todo->description() );
else
list.append( "" );
for(QStringList::Iterator it=list.begin();
it!=list.end(); ++it){
QString& s = (*it);
s.replace(QRegExp("\""), "\"\"");
if(s.contains(QRegExp("[,\"\r\n]")) || s.stripWhiteSpace() != s){
s.prepend('\"');
s.append('\"');
} else if(s.isEmpty() && !s.isNull()){
s = "\"\"";
}
}
return list.join(",");
+#endif
+ return QString();
}
-QString SharpFormat::getPart( const QString & text, bool &ok, int &start )
+QString PhoneFormat::getPart( const QString & text, bool &ok, int &start )
{
//qDebug("start %d ", start);
QString retval ="";
if ( text.at(start) == '"' ) {
if ( text.mid( start,2) == "\"\"" && !( text.mid( start+2,1) == "\"")) {
start = start +2;
if ( text.mid( start,1) == "," ) {
start += 1;
}
retval = "";
if ( text.mid( start,1) == "\n" ) {
start += 1;
ok = false;
}
return retval;
}
int hk = start+1;
hk = text.find ('"',hk);
while ( text.at(hk+1) == '"' )
hk = text.find ('"',hk+2);
retval = text.mid( start+1, hk-start-1);
start = hk+1;
retval.replace( QRegExp("\"\""), "\"");
@@ -1007,63 +1012,63 @@ QString SharpFormat::getPart( const QString & text, bool &ok, int &start )
} else {
int nl = text.find ("\n",start);
int kom = text.find (',',start);
if ( kom < nl ) {
// qDebug("kom < nl %d ", kom);
retval = text.mid(start, kom-start);
start = kom+1;
return retval;
} else {
if ( nl == kom ) {
// qDebug(" nl == kom ");
start = 0;
ok = false;
return "0";
}
// qDebug(" nl < kom ", nl);
retval = text.mid( start, nl-start);
ok = false;
start = nl+1;
return retval;
}
}
}
-bool SharpFormat::fromString( Calendar *calendar, const QString & text)
+bool PhoneFormat::fromString( Calendar *calendar, const QString & text)
{
return false;
}
-bool SharpFormat::fromString2Cal( Calendar *calendar,Calendar *existingCalendar, GSM_StateMachine* s, const QString & type)
+bool PhoneFormat::fromString2Cal( Calendar *calendar,Calendar *existingCalendar, GSM_StateMachine* s, const QString & type)
{
GSM_Phone_Functions *Phone;
GSM_CalendarEntry note;
GSM_CalendarEntry* Note;
bool refresh = true;
Phone=s->Phone.Functions;
bool gshutdown = false;
- SharpParser handler( calendar );
+ PhoneParser handler( calendar );
//handler.setCategoriesList( mCategories );
QStringList templist;
QString tempString;
int start = 0;
int error;
int ccc = 0;
while (!gshutdown && ccc++ < 10 ) {
QString CARDID,CATEGORY,DSRP,PLCE,MEM1,TIM1,TIM2,ADAY,ARON,ARMN,ARSD,RTYP,RFRQ,RPOS,RDYS,REND,REDT,ALSD,ALED,MDAY;
templist.clear();
qDebug("count %d ", ccc);
error=Phone->GetNextCalendar(s,&note,refresh);
if (error == ERR_EMPTY) break;
Note = &note;
//CARDID,CATEGORY,DSRP,PLCE,MEM1,TIM1,TIM2,ADAY,ARON,ARMN,ARSD,RTYP,RFRQ,RPOS,RDYS,REND,REDT,ALSD,ALED,MDAY
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
//ARSD silentalarm = 0
// 11 RTYP 225 no /0 dialy/ 1 weekly/ 3 month by date/ 2 month by day(pos)/ yearly
// 12 RFRQ
// 13 RPOS pos = 4. monday in month
// 14 RDYS days: 1 mon/ 2 tue .. 64 sun
// 15 REND 0 = no end/ 1 = end
// 16 REDT rec end dt
@@ -1309,51 +1314,51 @@ typedef struct {
if ( ARON == "0" ) {
QDateTime start,alarm;
start = handler.fromString( TIM1 );
alarm = handler.fromString( ARMN );
int min = alarm.secsTo ( start )/60;
ARMN = QString::number ( min );
}
templist.clear();
templist << CARDID << CATEGORY << DSRP << PLCE << MEM1 << TIM1 << TIM2 << ADAY << ARON << ARMN << ARSD << RTYP << RFRQ << RPOS << RDYS << REND << REDT << ALSD << ALED << MDAY;
handler.startElement( existingCalendar, templist, type );
}
#if 0
// qDebug("test %s ", text.latin1());
QStringList templist;
QString tempString;
int start = 0;
int len = text.length();
int end = text.find ("\n",start)+1;
bool ok = true;
start = end;
- SharpParser handler( calendar );
+ PhoneParser handler( calendar );
handler.setCategoriesList( mCategories );
while ( start > 0 ) {
templist.clear();
ok = true;
while ( ok ) {
tempString = getPart( text, ok, start );
if ( start >= len || start == 0 ) {
start = 0;
ok = false;
}
if ( tempString.right(1) =="\n" )
tempString = tempString.left( tempString.length()-1);
//if ( ok )
templist.append( tempString );
//qDebug("%d ---%s---", templist.count(),tempString.latin1() );
}
handler.startElement( existingCalendar, templist, type );
}
#endif
return false;
}
-QString SharpFormat::toString( Calendar * )
+QString PhoneFormat::toString( Calendar * )
{
return QString::null;
}
diff --git a/libkcal/phoneformat.h b/libkcal/phoneformat.h
index f4cb52c..4ddf6f0 100644
--- a/libkcal/phoneformat.h
+++ b/libkcal/phoneformat.h
@@ -1,65 +1,65 @@
/*
This file is part of libkcal.
Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
-#ifndef SHARPFORMAT_H
-#define SHARPAFORMAT_H
+#ifndef PHONEFORMAT_H
+#define PHONEFORMAT_H
#include <qstring.h>
#include "scheduler.h"
#include "calformat.h"
extern "C" {
-#include "gammu.h"
+#include "../gammu/emb/common/gammu.h"
}
namespace KCal {
/**
- This class implements the calendar format used by Sharp.
+ This class implements the calendar format used by Phone.
*/
-class SharpFormat : public QObject {
+class PhoneFormat : public QObject {
public:
/** Create new iCalendar format. */
- SharpFormat();
- virtual ~SharpFormat();
+ PhoneFormat();
+ virtual ~PhoneFormat();
bool load( Calendar * ,Calendar *);
bool save( Calendar * );
void setCategoriesList ( QStringList * cat ){ mCategories = cat; }
bool fromString2Cal( Calendar *, Calendar *, GSM_StateMachine* s , const QString & );
bool fromString( Calendar *, const QString & );
QString toString( Calendar * );
static ulong getCsum( const QStringList & );
private:
QString getEventString( Event* );
QString getTodoString( Todo* );
QString dtToString( const QDateTime& dt, bool useTZ = true );
QStringList *mCategories;
int getNumFromRecord( QString answer,Incidence* inc ) ;
QString getPart( const QString & text, bool &ok, int &start );
};
}
#endif