summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-10-18 09:08:13 (UTC)
committer zautrix <zautrix>2004-10-18 09:08:13 (UTC)
commit56990d318b15eacf7d3cc7425ab62f68da099ddf (patch) (side-by-side diff)
treeb2f021bd75bc6a08fa8fc51a07ce1755b8e4a95e
parent1712d92ea25b220273859d985bc7211fa7a97a39 (diff)
downloadkdepimpi-56990d318b15eacf7d3cc7425ab62f68da099ddf.zip
kdepimpi-56990d318b15eacf7d3cc7425ab62f68da099ddf.tar.gz
kdepimpi-56990d318b15eacf7d3cc7425ab62f68da099ddf.tar.bz2
fix of tmp file path for desktop version
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp57
-rw-r--r--kmicromail/viewmail.cpp4
-rw-r--r--korganizer/calendarview.cpp5
-rw-r--r--korganizer/koprefs.cpp6
-rw-r--r--korganizer/mainwindow.cpp4
-rw-r--r--libkcal/phoneformat.cpp4
-rw-r--r--version2
7 files changed, 22 insertions, 60 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 2e408b7..11eeabc 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -687,121 +687,82 @@ void KABCore::export2phone()
}
KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
KPimGlobalPrefs::instance()->mEx2PhoneConnection,
KPimGlobalPrefs::instance()->mEx2PhoneModel );
QStringList uids = mViewManager->selectedUids();
if ( uids.isEmpty() )
return;
QString fileName = getPhoneFile();
if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) )
return;
message(i18n("Exporting to phone..."));
QTimer::singleShot( 1, this , SLOT ( writeToPhone()));
}
QString KABCore::getPhoneFile()
{
-#ifdef _WIN32_
+#ifdef DESKTOP_VERSION
return locateLocal("tmp", "phonefile.vcf");
#else
return "/tmp/phonefile.vcf";
#endif
}
void KABCore::writeToPhone( )
{
if ( PhoneAccess::writeToPhone( getPhoneFile() ) )
message(i18n("Export to phone finished!"));
else
qDebug(i18n("Error exporting to phone"));
}
void KABCore::beamVCard()
{
QStringList uids = mViewManager->selectedUids();
if ( !uids.isEmpty() )
beamVCard( uids );
}
void KABCore::beamVCard(const QStringList& uids)
{
-/*US
- QString beamFilename;
- Opie::OPimContact c;
- if ( actionPersonal->isOn() ) {
- beamFilename = addressbookPersonalVCardName();
- if ( !QFile::exists( beamFilename ) )
- return; // can't beam a non-existent file
- Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null,
- beamFilename );
- Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true );
- Opie::OPimContactAccess::List allList = access->allRecords();
- Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first
- c = *it;
-
- delete access;
- } else {
- unlink( beamfile ); // delete if exists
- mkdir("/tmp/obex/", 0755);
- c = m_abView -> currentEntry();
- Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null,
- beamfile );
- Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true );
- access->add( c );
- access->save();
- delete access;
-
- beamFilename = beamfile;
- }
-
- owarn << "Beaming: " << beamFilename << oendl;
-*/
-
-#if 0
- QString tmpdir = locateLocal("tmp", KGlobal::getAppName());
-
- QString dirName = tmpdir + "/" + KApplication::randomString( 8 );
-
- QString name = "contact.vcf";
- QString fileName = dirName + "/" + name;
-#endif
- // LR: we should use the /tmp dir, because: /tmp = RAM, (HOME)/kdepim = flash memory
- //
+ // LR: we should use the /tmp dir on the Zaurus,
+ // because: /tmp = RAM, (HOME)/kdepim = flash memory
+
+#ifdef DESKTOP_VERSION
+ QString fileName = locateLocal("tmp", "kapibeamfile.vcf");
+#else
QString fileName = "/tmp/kapibeamfile.vcf";
+#endif
-
- //QDir().mkdir( dirName, true );
-
-
KABC::VCardConverter converter;
QString description;
QString datastream;
for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
KABC::Addressee a = mAddressBook->findByUid( *it );
if ( a.isEmpty() )
continue;
if (description.isEmpty())
description = a.formattedName();
QString vcard;
converter.addresseeToVCard( a, vcard );
int start = 0;
int next;
while ( (next = vcard.find("TYPE=", start) )>= 0 ) {
int semi = vcard.find(";", next);
int dopp = vcard.find(":", next);
int sep;
if ( semi < dopp && semi >= 0 )
sep = semi ;
else
sep = dopp;
@@ -2841,36 +2802,36 @@ bool KABCore::syncPhone()
}
}
setModified();
}
if ( syncOK )
mViewManager->refreshView();
return syncOK;
}
void KABCore::getFile( bool success )
{
if ( ! success ) {
message( i18n("Error receiving file. Nothing changed!") );
return;
}
mAddressBook->importFromFile( sentSyncFile() , false, true );
message( i18n("Pi-Sync successful!") );
mViewManager->refreshView();
}
void KABCore::syncFileRequest()
{
mAddressBook->export2File( sentSyncFile() );
}
QString KABCore::sentSyncFile()
{
-#ifdef _WIN32_
+#ifdef DESKTOP_VERSION
return locateLocal( "tmp", "copysyncab.vcf" );
#else
return QString( "/tmp/copysyncab.vcf" );
#endif
}
void KABCore::setCaptionBack()
{
mMessageTimer->stop();
topLevelWidget()->setCaption( i18n("KAddressbook/Pi") );
}
diff --git a/kmicromail/viewmail.cpp b/kmicromail/viewmail.cpp
index 6e560d7..32a3b7c 100644
--- a/kmicromail/viewmail.cpp
+++ b/kmicromail/viewmail.cpp
@@ -232,49 +232,53 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int
{
case 0:
{
//MimeTypes types;
//types.insert( "all", "*" );
QString str = KFileDialog::getSaveFileName( "/", item->text( 2 ), this );
if( !str.isEmpty() )
{
encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] );
if (content)
{
QFile output(str);
output.open(IO_WriteOnly);
output.writeBlock(content->Content(),content->Length());
output.close();
delete content;
}
}
}
break ;
case 2:
{
+#ifdef DESKTOP_VERSION
+ QString tmpfile = locateLocal( "tmp", "opiemail-image");
+#else
QString tmpfile = "/tmp/opiemail-image";
+#endif
encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] );
if (content) {
QFile output(tmpfile);
output.open(IO_WriteOnly);
output.writeBlock(content->Content(),content->Length());
output.close();
delete content;
MailImageDlg iview("");
iview.setName(tmpfile);
KApplication::execDialog(&iview);
output.remove();
}
}
break;
case 1:
if ( ( ( AttachItem* )item )->Partnumber() == -1 )
{
setText();
}
else
{
if ( m_recMail->Wrapper() != 0l )
{ // make sure that there is a wrapper , even after delete or simular actions
browser->setText( m_recMail->Wrapper()->fetchTextPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) );
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 290c0b9..884c61a 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -2282,50 +2282,53 @@ void CalendarView::manageCategories()
}
void CalendarView::beamIncidence(Incidence * Inc)
{
QPtrList<Incidence> delSel ;
delSel.append(Inc);
beamIncidenceList( delSel );
}
void CalendarView::beamCalendar()
{
QPtrList<Incidence> delSel = mCalendar->rawIncidences();
//qDebug("beamCalendar() ");
beamIncidenceList( delSel );
}
void CalendarView::beamFilteredCalendar()
{
QPtrList<Incidence> delSel = mCalendar->incidences();
//qDebug("beamFilteredCalendar() ");
beamIncidenceList( delSel );
}
void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel )
{
if ( beamDialog->exec () == QDialog::Rejected )
return;
-
+#ifdef DESKTOP_VERSION
+ QString fn = locateLocal( "tmp", "kopibeamfile" );
+#else
QString fn = "/tmp/kopibeamfile";
+#endif
QString mes;
bool createbup = true;
if ( createbup ) {
QString description = "\n";
CalendarLocal* cal = new CalendarLocal();
if ( beamDialog->beamLocal() )
cal->setLocalTime();
else
cal->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
Incidence *incidence = delSel.first();
bool addText = false;
if ( delSel.count() < 10 )
addText = true;
else {
description.sprintf(i18n(" %d items?"),delSel.count() );
}
while ( incidence ) {
Incidence *in = incidence->clone();
if ( ! in->summary().isEmpty() ) {
in->setDescription("");
} else {
in->setSummary( in->description().left(20));
in->setDescription("");
}
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index 651442b..258f738 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -181,54 +181,48 @@ KOPrefs::KOPrefs() :
addItemFont("WhatsNextView Font",&mWhatsNextFont);
addItemFont("EventView Font",&mEventViewFont);
// KPrefs::setCurrentGroup("SyncProfiles");
// addItemString("LocalMachineName",&mLocalMachineName, "undefined");
// addItemStringList("SyncProfileNames",&mSyncProfileNames);
// addItemStringList("ExternSyncProfiles",&mExternSyncProfileNames);
KPrefs::setCurrentGroup("RemoteSyncing");
// addItemBool("UsePasswd",&mUsePassWd,false);
// addItemBool("WriteBackFile",&mWriteBackFile,true);
// addItemBool("WriteBackExistingOnly",&mWriteBackExistingOnly,false);
// addItemBool("AskForPreferences",&mAskForPreferences,true);
// addItemBool("ShowSyncSummary",&mShowSyncSummary,true);
addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" );
addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" );
addItemBool("ShowSyncEvents",&mShowSyncEvents,false);
addItemInt("LastSyncTime",&mLastSyncTime,0);
#ifdef _WIN32_
QString hdp= locateLocal("data","korganizer")+"\\\\";
#else
QString hdp= locateLocal("data","korganizer")+"/";
#endif
-// addItemString("RemoteIP",&mRemoteIP, "192.168.0.65");
-// addItemString("RemoteUser",&mRemoteUser, "zaurus");
-// addItemString("RemotePassWd",&mRemotePassWd, "");
-// addItemString("RemoteFile", &mRemoteFile, hdp+"mycalendar.ics");
-// addItemString("LocalTempFile",&mLocalTempFile, "/tmp/tempsyncfile.ics" );
-
KPrefs::setCurrentGroup("LoadSaveFileNames");
addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" );
addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" );
addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" );
addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" );
KPrefs::setCurrentGroup("Locale");
addItemInt("PreferredLanguage",&mPreferredLanguage,0);
addItemInt("PreferredTime",&mPreferredTime,0);
addItemInt("PreferredDate",&mPreferredDate,0);
addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false);
addItemBool("ShortDateInViewer",&mShortDateInViewer,false);
addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y");
addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y");
KPrefs::setCurrentGroup("Colors");
addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor);
addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor);
addItemColor("Event Color",&mEventColor,mDefaultCategoryColor);
addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor);
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 06470b8..c3e9f75 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1193,52 +1193,52 @@ void MainWindow::aboutAutoSaving()
void MainWindow::aboutKnownBugs()
{
QMessageBox* msg;
msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"),
i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+
i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+
i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") +
i18n("\nor report them in the bugtracker on\n") +
i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"),
QMessageBox::NoIcon,
QMessageBox::Ok,
QMessageBox::NoButton,
QMessageBox::NoButton);
msg->exec();
delete msg;
}
QString MainWindow::defaultFileName()
{
return locateLocal( "data", "korganizer/mycalendar.ics" );
}
QString MainWindow::syncFileName()
{
-#ifdef _WIN32_
+#ifdef DESKTOP_VERSION
return locateLocal( "tmp", "synccalendar.ics" );
#else
- return QString( "/tmp/kopitempfile.ics" );
+ return QString( "/tmp/synccalendar.ics" );
#endif
}
void MainWindow::processIncidenceSelection( Incidence *incidence )
{
if ( !incidence ) {
enableIncidenceActions( false );
mNewSubTodoAction->setEnabled( false );
setCaptionToDates();
return;
}
//KGlobal::locale()->formatDateTime(nextA, true);
QString startString = "";
if ( incidence->type() != "Todo" ) {
if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
if ( incidence->doesFloat() ) {
startString += ": "+incidence->dtStartDateStr( true );
startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
} else {
startString = ": "+incidence->dtStartStr(true);
diff --git a/libkcal/phoneformat.cpp b/libkcal/phoneformat.cpp
index 101db57..900fc04 100644
--- a/libkcal/phoneformat.cpp
+++ b/libkcal/phoneformat.cpp
@@ -269,49 +269,49 @@ ulong PhoneFormat::getCsum( const QStringList & attList)
int mul = k +1;
add = s[k].unicode ();
if ( k < 16 )
mul = mul * mul;
int ii = i+1;
add = add * mul *ii*ii*ii;
cSum += add;
}
}
}
//QString dump = attList.join(",");
//qDebug("csum: %d %s", cSum,dump.latin1());
return cSum;
}
//extern "C" GSM_Error GSM_InitConnection(GSM_StateMachine *s, int ReplyNum);
#include <stdlib.h>
#define DEBUGMODE false
bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal)
{
QString fileName;
-#ifdef _WIN32_
+#ifdef DESKTOP_VERSION
fileName = locateLocal("tmp", "phonefile.vcs");
#else
fileName = "/tmp/phonefile.vcs";
#endif
QString command;
if ( ! PhoneAccess::readFromPhone( fileName )) {
return false;
}
VCalFormat vfload;
vfload.setLocalTime ( true );
qDebug("loading file ...");
if ( ! vfload.load( calendar, fileName ) )
return false;
QPtrList<Event> er = calendar->rawEvents();
Event* ev = er.first();
qDebug("reading events... ");
while ( ev ) {
QStringList cat = ev->categories();
if ( cat.contains( "MeetingDEF" )) {
ev->setCategories( QStringList() );
} else
if ( cat.contains( "Birthday" )) {
ev->setFloats( true );
@@ -456,49 +456,49 @@ void PhoneFormat::copyTodo( Todo* to, Todo* from )
// set percentcomplete only, if to->isCompleted()
if ( to->isCompleted() )
to->setPercentComplete(from->percentComplete());
}
if( to->priority() == 2 && from->priority() == 1 )
; //skip
else if (to->priority() == 4 && from->priority() == 5 )
;
else
to->setPriority(from->priority());
}
#include <qcstring.h>
void PhoneFormat::afterSave( Incidence* inc,const QString& id ,const QString& csum)
{
inc->setID( mProfileName, id );
inc->setCsum( mProfileName, csum);
inc->setTempSyncStat( SYNC_TEMPSTATE_NEW_ID );
}
bool PhoneFormat::writeToPhone( Calendar * calendar)
{
-#ifdef _WIN32_
+#ifdef DESKTOP_VERSION
QString fileName = locateLocal("tmp", "phonefile.vcs");
#else
QString fileName = "/tmp/phonefile.vcs";
#endif
VCalFormat vfsave;
vfsave.setLocalTime ( true );
QString id = calendar->timeZoneId();
calendar->setLocalTime();
if ( ! vfsave.save( calendar, fileName ) )
return false;
calendar->setTimeZoneId( id );
return PhoneAccess::writeToPhone( fileName );
}
bool PhoneFormat::save( Calendar *calendar)
{
// 1 remove events which should be deleted
QPtrList<Event> er = calendar->rawEvents();
Event* ev = er.first();
while ( ev ) {
if ( ev->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) {
calendar->deleteEvent( ev );
diff --git a/version b/version
index de8a794..0c43deb 100644
--- a/version
+++ b/version
@@ -1 +1 @@
-version = "1.9.8";
+version = "1.9.9";