summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-10-06 16:02:56 (UTC)
committer zautrix <zautrix>2004-10-06 16:02:56 (UTC)
commita22de800110d8350a5200a994b041e47d51bf4c6 (patch) (side-by-side diff)
treea4de195003d1ceabc3fd9ca4e5cd0510570bcb97
parentef71411c2f248d1dc908aa2f119c9b281e0e8bb9 (diff)
downloadkdepimpi-a22de800110d8350a5200a994b041e47d51bf4c6.zip
kdepimpi-a22de800110d8350a5200a994b041e47d51bf4c6.tar.gz
kdepimpi-a22de800110d8350a5200a994b041e47d51bf4c6.tar.bz2
added phone export
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp143
-rw-r--r--kaddressbook/kabcore.h2
-rw-r--r--korganizer/koprefs.cpp4
-rw-r--r--korganizer/koprefs.h3
-rw-r--r--korganizer/mainwindow.cpp19
-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
11 files changed, 368 insertions, 20 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index f8359de..185cf46 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1,84 +1,88 @@
/*
This file is part of KAddressbook.
Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#include "kabcore.h"
#include <stdaddressbook.h>
#include <klocale.h>
#include <kfiledialog.h>
#include <qtimer.h>
+#include <qlabel.h>
+#include <qlineedit.h>
+#include <qcheckbox.h>
+#include <qpushbutton.h>
#include <qprogressbar.h>
#ifndef KAB_EMBEDDED
#include <qclipboard.h>
#include <qdir.h>
#include <qfile.h>
#include <qapplicaton.h>
#include <qprogressbar.h>
#include <qlayout.h>
#include <qregexp.h>
#include <qvbox.h>
#include <kabc/addresseelist.h>
#include <kabc/errorhandler.h>
#include <kabc/resource.h>
#include <kabc/vcardconverter.h>
#include <kapplication.h>
#include <kactionclasses.h>
#include <kcmultidialog.h>
#include <kdebug.h>
#include <kdeversion.h>
#include <kkeydialog.h>
#include <kmessagebox.h>
#include <kprinter.h>
#include <kprotocolinfo.h>
#include <kresources/selectdialog.h>
#include <kstandarddirs.h>
#include <ktempfile.h>
#include <kxmlguiclient.h>
#include <kaboutdata.h>
#include <libkdepim/categoryselectdialog.h>
#include "addresseeutil.h"
#include "addresseeeditordialog.h"
#include "extensionmanager.h"
#include "kstdaction.h"
#include "kaddressbookservice.h"
#include "ldapsearchdialog.h"
#include "printing/printingwizard.h"
#else // KAB_EMBEDDED
#include <kapplication.h>
#include "KDGanttMinimizeSplitter.h"
#include "kaddressbookmain.h"
#include "kactioncollection.h"
#include "addresseedialog.h"
//US
#include <addresseeview.h>
@@ -108,96 +112,140 @@ $Id$
#include "kcmconfigs/kcmkabconfig.h"
#include "kcmconfigs/kcmkdepimconfig.h"
#include "kpimglobalprefs.h"
#include "externalapphandler.h"
#include <kresources/selectdialog.h>
#include <kmessagebox.h>
#include <picture.h>
#include <resource.h>
//US#include <qsplitter.h>
#include <qmap.h>
#include <qdir.h>
#include <qfile.h>
#include <qvbox.h>
#include <qlayout.h>
#include <qclipboard.h>
#include <qtextstream.h>
#include <libkdepim/categoryselectdialog.h>
#include <kabc/vcardconverter.h>
#include "addresseeutil.h"
#include "undocmds.h"
#include "addresseeeditordialog.h"
#include "viewmanager.h"
#include "details/detailsviewcontainer.h"
#include "kabprefs.h"
#include "xxportmanager.h"
#include "incsearchwidget.h"
#include "jumpbuttonbar.h"
#include "extensionmanager.h"
#include "addresseeconfig.h"
#include <kcmultidialog.h>
#ifdef _WIN32_
#include "kaimportoldialog.h"
#else
#include <unistd.h>
#endif
// sync includes
#include <libkdepim/ksyncprofile.h>
#include <libkdepim/ksyncprefsdialog.h>
+class KAex2phonePrefs : public QDialog
+{
+ public:
+ KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
+ QDialog( parent, name, true )
+ {
+ setCaption( i18n("Export to phone options") );
+ QVBoxLayout* lay = new QVBoxLayout( this );
+ lay->setSpacing( 3 );
+ lay->setMargin( 3 );
+ QLabel *lab;
+ lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
+ lab->setAlignment (AlignHCenter );
+ QHBox* temphb;
+ temphb = new QHBox( this );
+ new QLabel( i18n("I/O device: "), temphb );
+ mPhoneDevice = new QLineEdit( temphb);
+ lay->addWidget( temphb );
+ temphb = new QHBox( this );
+ new QLabel( i18n("Connection: "), temphb );
+ mPhoneConnection = new QLineEdit( temphb);
+ lay->addWidget( temphb );
+ temphb = new QHBox( this );
+ new QLabel( i18n("Model(opt.): "), temphb );
+ mPhoneModel = new QLineEdit( temphb);
+ lay->addWidget( temphb );
+ mWriteToSim= new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this );
+ lay->addWidget( mWriteToSim );
+ lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) );
+ lab->setAlignment (AlignHCenter );
+ QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
+ lay->addWidget( ok );
+ QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
+ lay->addWidget( cancel );
+ connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
+ connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
+ resize( 220, 240 );
+
+ }
+
+public:
+ QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
+ QCheckBox* mWriteToSim;
+};
bool pasteWithNewUid = true;
#ifdef KAB_EMBEDDED
KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name )
: QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/
mReadWrite( readWrite ), mModified( false ), mMainWindow(client)
#else //KAB_EMBEDDED
KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name )
: QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ),
mReadWrite( readWrite ), mModified( false )
#endif //KAB_EMBEDDED
{
// syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu);
// syncManager->setBlockSave(false);
mExtensionBarSplitter = 0;
mIsPart = !parent->inherits( "KAddressBookMain" );
mAddressBook = KABC::StdAddressBook::self();
KABC::StdAddressBook::setAutomaticSave( false );
#ifndef KAB_EMBEDDED
mAddressBook->setErrorHandler( new KABC::GUIErrorHandler );
#endif //KAB_EMBEDDED
connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ),
SLOT( addressBookChanged() ) );
#if 0
// LP moved to addressbook init method
mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization,
"X-Department", "KADDRESSBOOK" );
mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization,
"X-Profession", "KADDRESSBOOK" );
mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization,
"X-AssistantsName", "KADDRESSBOOK" );
mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization,
"X-ManagersName", "KADDRESSBOOK" );
mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal,
"X-SpousesName", "KADDRESSBOOK" );
mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal,
"X-Office", "KADDRESSBOOK" );
mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal,
"X-IMAddress", "KADDRESSBOOK" );
mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal,
"X-Anniversary", "KADDRESSBOOK" );
@@ -465,96 +513,97 @@ void KABCore::createAboutData()
#endif
);
}
void KABCore::setContactSelected( const QString &uid )
{
KABC::Addressee addr = mAddressBook->findByUid( uid );
if ( !mDetails->isHidden() )
mDetails->setAddressee( addr );
if ( !addr.isEmpty() ) {
emit contactSelected( addr.formattedName() );
KABC::Picture pic = addr.photo();
if ( pic.isIntern() ) {
//US emit contactSelected( pic.data() );
//US instead use:
QPixmap px;
if (pic.data().isNull() != true)
{
px.convertFromImage(pic.data());
}
emit contactSelected( px );
}
}
mExtensionManager->setSelectionChanged();
// update the actions
bool selected = !uid.isEmpty();
if ( mReadWrite ) {
mActionCut->setEnabled( selected );
mActionPaste->setEnabled( selected );
}
mActionCopy->setEnabled( selected );
mActionDelete->setEnabled( selected );
mActionEditAddressee->setEnabled( selected );
mActionMail->setEnabled( selected );
mActionMailVCard->setEnabled( selected );
//if (mActionBeam)
//mActionBeam->setEnabled( selected );
if (mActionBeamVCard)
mActionBeamVCard->setEnabled( selected );
+ mActionExport2phone->setEnabled( selected );
mActionWhoAmI->setEnabled( selected );
mActionCategories->setEnabled( selected );
}
void KABCore::sendMail()
{
sendMail( mViewManager->selectedEmails().join( ", " ) );
}
void KABCore::sendMail( const QString& emaillist )
{
// the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... "
if (emaillist.contains(",") > 0)
ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null );
else
ExternalAppHandler::instance()->mailToOneContact( emaillist );
}
void KABCore::mailVCard()
{
QStringList uids = mViewManager->selectedUids();
if ( !uids.isEmpty() )
mailVCard( uids );
}
void KABCore::mailVCard( const QStringList& uids )
{
QStringList urls;
// QString tmpdir = locateLocal("tmp", KGlobal::getAppName());
QString dirName = "/tmp/" + KApplication::randomString( 8 );
QDir().mkdir( dirName, true );
for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
KABC::Addressee a = mAddressBook->findByUid( *it );
if ( a.isEmpty() )
continue;
QString name = a.givenName() + "_" + a.familyName() + ".vcf";
QString fileName = dirName + "/" + name;
@@ -564,96 +613,185 @@ void KABCore::mailVCard( const QStringList& uids )
if ( outFile.open(IO_WriteOnly) ) { // file opened successfully
KABC::VCardConverter converter;
QString vcard;
converter.addresseeToVCard( a, vcard );
QTextStream t( &outFile ); // use a text stream
t.setEncoding( QTextStream::UnicodeUTF8 );
t << vcard;
outFile.close();
urls.append( fileName );
}
}
bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") );
/*US
kapp->invokeMailer( QString::null, QString::null, QString::null,
QString::null, // subject
QString::null, // body
QString::null,
urls ); // attachments
*/
}
/**
Beams the "WhoAmI contact.
*/
void KABCore::beamMySelf()
{
KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI();
if (!a.isEmpty())
{
QStringList uids;
uids << a.uid();
beamVCard(uids);
} else {
KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) );
}
}
+void KABCore::export2phone()
+{
+
+ KAex2phonePrefs ex2phone;
+ ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
+ ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
+ ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
+
+ if ( !ex2phone.exec() ) {
+ return;
+ }
+ KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
+ KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
+ KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
+
+#if 0
+ PhoneFormat::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
+ KPimGlobalPrefs::instance()->mEx2PhoneConnection,
+ KPimGlobalPrefs::instance()->mEx2PhoneModel );
+
+
+
+
+
+ QString fileName = "/tmp/kapibeamfile.vcf";
+
+
+ //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;
+ datastream +=vcard.mid( start, next - start);
+ datastream +=vcard.mid( next+5,sep -next -5 ).upper();
+ start = sep;
+ }
+ datastream += vcard.mid( start,vcard.length() );
+ }
+#ifndef DESKTOP_VERSION
+ QFile outFile(fileName);
+ if ( outFile.open(IO_WriteOnly) ) {
+ datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" );
+ QTextStream t( &outFile ); // use a text stream
+ t.setEncoding( QTextStream::UnicodeUTF8 );
+ t <<datastream;
+ outFile.close();
+ Ir *ir = new Ir( this );
+ connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) );
+ ir->send( fileName, description, "text/x-vCard" );
+ } else {
+ qDebug("Error open temp beam file ");
+ return;
+ }
+#endif
+
+
+
+
+ setCaption( i18n("Writing to phone..."));
+ if ( PhoneFormat::writeToPhone( cal ) )
+ setCaption( i18n("Export to phone successful!"));
+ else
+ setCaption( i18n("Error exporting to phone!"));
+#endif
+
+
+}
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";
@@ -1559,96 +1697,100 @@ void KABCore::initGUI()
// mIncSearchWidget->hide();
connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
SLOT( incrementalSearch( const QString& ) ) );
mJumpButtonBar = new JumpButtonBar( this, this );
topLayout->addWidget( mJumpButtonBar );
//US topLayout->setStretchFactor( mJumpButtonBar, 10 );
// mMainWindow->getIconToolBar()->raise();
#endif //KAB_EMBEDDED
}
void KABCore::initActions()
{
//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
#ifndef KAB_EMBEDDED
connect( QApplication::clipboard(), SIGNAL( dataChanged() ),
SLOT( clipboardDataChanged() ) );
#endif //KAB_EMBEDDED
// file menu
if ( mIsPart ) {
mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this,
SLOT( sendMail() ), actionCollection(),
"kaddressbook_mail" );
mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this,
SLOT( print() ), actionCollection(), "kaddressbook_print" );
} else {
mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() );
mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() );
}
mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this,
SLOT( save() ), actionCollection(), "file_sync" );
mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this,
SLOT( newContact() ), actionCollection(), "file_new_contact" );
mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0,
this, SLOT( mailVCard() ),
actionCollection(), "file_mail_vcard");
+ mActionExport2phone = new KAction( i18n( "Selected to phone" ), "ex2phone", 0, this,
+ SLOT( export2phone() ), actionCollection(),
+ "kaddressbook_ex2phone" );
+
mActionBeamVCard = 0;
mActionBeam = 0;
#ifndef DESKTOP_VERSION
if ( Ir::supported() ) {
mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this,
SLOT( beamVCard() ), actionCollection(),
"kaddressbook_beam_vcard" );
mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this,
SLOT( beamMySelf() ), actionCollection(),
"kaddressbook_beam_myself" );
}
#endif
mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0,
this, SLOT( editContact2() ),
actionCollection(), "file_properties" );
#ifdef KAB_EMBEDDED
// mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() );
mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0,
mMainWindow, SLOT( exit() ),
actionCollection(), "quit" );
#endif //KAB_EMBEDDED
// edit menu
if ( mIsPart ) {
mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this,
SLOT( copyContacts() ), actionCollection(),
"kaddressbook_copy" );
mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this,
SLOT( cutContacts() ), actionCollection(),
"kaddressbook_cut" );
mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this,
SLOT( pasteContacts() ), actionCollection(),
"kaddressbook_paste" );
mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this,
SLOT( selectAllContacts() ), actionCollection(),
"kaddressbook_select_all" );
mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this,
SLOT( undo() ), actionCollection(),
"kaddressbook_undo" );
mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z,
this, SLOT( redo() ), actionCollection(),
"kaddressbook_redo" );
} else {
mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() );
@@ -1859,96 +2001,97 @@ void KABCore::addActionsManually()
mActionKeyBindings->plug( settingsMenu );
}
settingsMenu->insertSeparator();
mActionJumpBar->plug( settingsMenu );
mActionDetails->plug( settingsMenu );
if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop )
mActionDetails->plug( tb );
settingsMenu->insertSeparator();
mActionWhoAmI->plug( settingsMenu );
mActionCategories->plug( settingsMenu );
mActionLicence->plug( helpMenu );
mActionFaq->plug( helpMenu );
mActionAboutKAddressbook->plug( helpMenu );
if (KGlobal::getDesktopSize() > KGlobal::Small ) {
mActionSave->plug( tb );
mViewManager->getFilterAction()->plug ( tb);
if (KGlobal::getDesktopSize() == KGlobal::Desktop ) {
mActionUndo->plug( tb );
mActionDelete->plug( tb );
mActionRedo->plug( tb );
}
}
//mActionQuit->plug ( tb );
// tb->insertWidget(-1, 0, mIncSearchWidget, 6);
//US link the searchwidget first to this.
// The real linkage to the toolbar happens later.
//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE);
//US tb->insertItem( mIncSearchWidget );
/*US
mIncSearchWidget = new IncSearchWidget( tb );
connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
SLOT( incrementalSearch( const QString& ) ) );
mJumpButtonBar = new JumpButtonBar( this, this );
//US topLayout->addWidget( mJumpButtonBar );
this->layout()->add( mJumpButtonBar );
*/
#endif //KAB_EMBEDDED
+ mActionExport2phone->plug( ExportMenu );
connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) );
syncManager->fillSyncMenu();
}
void KABCore::showLicence()
{
KApplication::showLicence();
}
void KABCore::removeVoice()
{
if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No )
return;
KABC::Addressee::List list = mViewManager->selectedAddressees();
KABC::Addressee::List::Iterator it;
for ( it = list.begin(); it != list.end(); ++it ) {
PhoneNumber::List phoneNumbers = (*it).phoneNumbers();
PhoneNumber::List::Iterator phoneIt;
bool found = false;
for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) {
if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found
if ((*phoneIt).type() - PhoneNumber::Voice ) {
(*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice );
(*it).insertPhoneNumber( (*phoneIt) );
found = true;
}
}
}
if ( found )
contactModified((*it) );
}
}
void KABCore::clipboardDataChanged()
{
if ( mReadWrite )
mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() );
}
void KABCore::updateActionMenu()
{
UndoStack *undo = UndoStack::instance();
RedoStack *redo = RedoStack::instance();
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index 941458d..e6f286b 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -129,96 +129,97 @@ class KABCore : public QWidget, public KSyncInterface
*/
KABC::Resource *requestResource( QWidget *parent );
#ifndef KAB_EMBEDDED
static KAboutData *createAboutData();
#endif //KAB_EMBEDDED
#ifdef KAB_EMBEDDED
inline QPopupMenu* getImportMenu() { return ImportMenu;}
inline QPopupMenu* getExportMenu() { return ExportMenu;}
#endif //KAB_EMBEDDED
public slots:
#ifdef KAB_EMBEDDED
void createAboutData();
#endif //KAB_EMBEDDED
void statusMessage(QString, int time = 0 );
void showLicence();
void faq();
/**
Is called whenever a contact is selected in the view.
*/
void setContactSelected( const QString &uid );
/**
Opens the preferred mail composer with all selected contacts as
arguments.
*/
void sendMail();
/**
Opens the preferred mail composer with the given contacts as
arguments.
*/
void sendMail( const QString& email );
void mailVCard();
void mailVCard(const QStringList& uids);
/**
Beams the "WhoAmI contact.
*/
void beamMySelf();
void beamVCard();
+ void export2phone();
void beamVCard(const QStringList& uids);
void beamDone( Ir *ir );
/**
Starts the preferred web browser with the given URL as argument.
*/
void browse( const QString& url );
/**
Select all contacts in the view.
*/
void selectAllContacts();
/**
Deletes all selected contacts from the address book.
*/
void deleteContacts();
/**
Deletes given contacts from the address book.
@param uids The uids of the contacts, which shall be deleted.
*/
void deleteContacts( const QStringList &uids );
/**
Copys the selected contacts into clipboard for later pasting.
*/
void copyContacts();
/**
Cuts the selected contacts and stores them for later pasting.
*/
void cutContacts();
/**
Paste contacts from clipboard into the address book.
*/
void pasteContacts();
/**
Paste given contacts into the address book.
@param list The list of addressee, which shall be pasted.
*/
void pasteContacts( KABC::Addressee::List &list );
@@ -352,96 +353,97 @@ class KABCore : public QWidget, public KSyncInterface
void updateActionMenu();
void configureKeyBindings();
void removeVoice();
#ifdef KAB_EMBEDDED
void configureResources();
#endif //KAB_EMBEDDED
void slotEditorDestroyed( const QString &uid );
void configurationChanged();
void addressBookChanged();
private:
void initGUI();
void initActions();
AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent,
const char *name = 0 );
KXMLGUIClient *mGUIClient;
KABC::AddressBook *mAddressBook;
ViewManager *mViewManager;
// QSplitter *mDetailsSplitter;
KDGanttMinimizeSplitter *mExtensionBarSplitter;
ViewContainer *mDetails;
KDGanttMinimizeSplitter* mMiniSplitter;
XXPortManager *mXXPortManager;
JumpButtonBar *mJumpButtonBar;
IncSearchWidget *mIncSearchWidget;
ExtensionManager *mExtensionManager;
KCMultiDialog *mConfigureDialog;
#ifndef KAB_EMBEDDED
LDAPSearchDialog *mLdapSearchDialog;
#endif //KAB_EMBEDDED
// QDict<AddresseeEditorDialog> mEditorDict;
AddresseeEditorDialog *mEditorDialog;
bool mReadWrite;
bool mModified;
bool mIsPart;
bool mMultipleViewsAtOnce;
//US file menu
KAction *mActionMail;
KAction *mActionBeam;
+ KAction *mActionExport2phone;
KAction* mActionPrint;
KAction* mActionNewContact;
KAction *mActionSave;
KAction *mActionEditAddressee;
KAction *mActionMailVCard;
KAction *mActionBeamVCard;
KAction *mActionQuit;
//US edit menu
KAction *mActionCopy;
KAction *mActionCut;
KAction *mActionPaste;
KAction *mActionSelectAll;
KAction *mActionUndo;
KAction *mActionRedo;
KAction *mActionDelete;
//US settings menu
KAction *mActionConfigResources;
KAction *mActionConfigKAddressbook;
KAction *mActionConfigShortcuts;
KAction *mActionConfigureToolbars;
KAction *mActionKeyBindings;
KToggleAction *mActionJumpBar;
KToggleAction *mActionDetails;
KAction *mActionWhoAmI;
KAction *mActionCategories;
KAction *mActionAboutKAddressbook;
KAction *mActionLicence;
KAction *mActionFaq;
KAction *mActionDeleteView;
QPopupMenu *viewMenu;
QPopupMenu *filterMenu;
QPopupMenu *settingsMenu;
QPopupMenu *changeMenu;
//US QAction *mActionSave;
QPopupMenu *ImportMenu;
QPopupMenu *ExportMenu;
//LR additional methods
KAction *mActionRemoveVoice;
KAction * mActionImportOL;
#ifndef KAB_EMBEDDED
KAddressBookService *mAddressBookService;
#endif //KAB_EMBEDDED
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index 716a125..84e3d00 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -34,100 +34,96 @@
#include <qcolor.h>
#include <qstringlist.h>
#include <stdlib.h>
#include <kglobal.h>
#include <kconfig.h>
#include <klocale.h>
#include <kdebug.h>
#include <kemailsettings.h>
#include <kstaticdeleter.h>
#include <libkdepim/kpimglobalprefs.h>
#include "koprefs.h"
#include "mainwindow.h"
const char *germanwords[][2] = {
#include "wordsgerman.h"
"", ""
};
KOPrefs *KOPrefs::mInstance = 0;
static KStaticDeleter<KOPrefs> insd;
KOPrefs::KOPrefs() :
KPimPrefs("korganizerrc")
{
mCategoryColors.setAutoDelete(true);
mLocaleDict = 0;
fillMailDefaults();
mDefaultCategoryColor = QColor(175,210,255);//196,196,196);
QColor defaultHolidayColor = QColor(255,0,0);
QColor defaultHighlightColor = QColor(129,112,255);//64,64,255);
QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128);
QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160);
QColor defaultTodoDueTodayColor = QColor(255,220,100);
QColor defaultTodoOverdueColor = QColor(255,153,125);
mTimeBarFont = QFont("helvetica",10);//,QFont::Bold);
mDefaultViewFont = QFont("helvetica",10);
mDefaultMonthViewFont = QFont("helvetica",8);
mMarcusBainsFont= QFont("helvetica",10);
mDateNavigatorFont= QFont("helvetica",10, QFont::Bold);
mEditBoxFont = QFont("helvetica",12);
mJornalViewFont = QFont("helvetica",12);
KPrefs::setCurrentGroup("General");
- addItemString("Ex2PhoneDevice",&mEx2PhoneDevice,"/dev/ircomm");
- addItemString("Ex2PhoneConnection",&mEx2PhoneConnection,"irda");
- addItemString("Ex2PhoneModel",&mEx2PhoneModel,"6310i");
-
addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false);
addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true);
addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true);
addItemBool("ShowIconSearch",&mShowIconSearch,true);
addItemBool("ShowIconList",&mShowIconList,true);
addItemBool("ShowIconDay1",&mShowIconDay1,true);
addItemBool("ShowIconDay5",&mShowIconDay5,true);
addItemBool("ShowIconDay7",&mShowIconDay7,true);
addItemBool("ShowIconMonth",&mShowIconMonth,true);
addItemBool("ShowIconTodoview",&mShowIconTodoview,true);
addItemBool("ShowIconBackFast",&mShowIconBackFast,true);
addItemBool("ShowIconBack",&mShowIconBack,true);
addItemBool("ShowIconToday",&mShowIconToday,true);
addItemBool("ShowIconForward",&mShowIconForward,true);
addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true);
addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,false);
addItemBool("ShowIconNextDays",&mShowIconNextDays,true);
addItemBool("ShowIconNext",&mShowIconNext,true);
addItemBool("ShowIconJournal",&mShowIconJournal,true);
addItemBool("ShowIconStretch",&mShowIconStretch,true);
addItemBool("LanguageChanged",&mLanguageChanged,false);
addItemBool("AskForQuit",&mAskForQuit,false);
#ifndef DESKTOP_VERSION
addItemBool("ShowFullMenu",&mShowFullMenu,false);
#else
addItemBool("ShowFullMenu",&mShowFullMenu,true);
#endif
addItemBool("ToolBarHor",&mToolBarHor, true );
addItemBool("ToolBarUp",&mToolBarUp, false );
addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false );
addItemInt("Whats Next Days",&mWhatsNextDays,3);
addItemInt("Whats Next Prios",&mWhatsNextPrios,1);
addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true);
addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true);
addItemInt("AllDay Size",&mAllDaySize,28);
QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav";
addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm );
addItemStringList("LocationDefaults",&mLocationDefaults );
addItemStringList("EventSummary User",&mEventSummaryUser);
addItemStringList("TodoSummary User",&mTodoSummaryUser);
addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false);
addItemBool("Enable Project View",&mEnableProjectView,false);
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index a1ba8b3..d9ac851 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -165,99 +165,96 @@ class KOPrefs : public KPimPrefs
bool mLanguageChanged;
bool mCompactDialogs;
bool mVerticalScreen;
bool mShowIconNewTodo;
bool mShowIconNewEvent;
bool mShowIconSearch;
bool mShowIconList;
bool mShowIconDay1;
bool mShowIconDay5;
bool mShowIconDay7;
bool mShowIconMonth;
bool mShowIconTodoview;
bool mShowIconBackFast;
bool mShowIconBack;
bool mShowIconToday;
bool mShowIconForward;
bool mShowIconForwardFast;
bool mShowIconWhatsThis;
bool mShowIconNextDays;
bool mShowIconNext;
bool mShowIconJournal;
bool mShowIconStretch;
bool mToolBarHor;
bool mToolBarUp;
bool mToolBarMiniIcons;
bool mAskForQuit;
bool mUsePassWd;
bool mWriteBackFile;
int mWriteBackInFuture;
bool mAskForPreferences;
bool mShowSyncSummary;
bool mShowSyncEvents;
bool mShowTodoInAgenda;
bool mWriteBackExistingOnly;
QString mRemoteIP;
QString mRemoteUser;
QString mRemotePassWd;
QString mRemoteFile;
QString mLocalTempFile;
QString mPhoneDevice;
QString mPhoneConnection;
QString mPhoneModel;
- QString mEx2PhoneDevice;
- QString mEx2PhoneConnection;
- QString mEx2PhoneModel;
int mLastSyncTime;
int mSyncAlgoPrefs;
int mRingSyncAlgoPrefs;
QStringList mSyncProfileNames;
QStringList mExternSyncProfiles;
QString mLocalMachineName;
void setCategoryColor(QString cat,const QColor & color);
QColor *categoryColor(QString cat);
QString mArchiveFile;
QString mHtmlExportFile;
bool mHtmlWithSave;
QStringList mSelectedPlugins;
QString mLastImportFile;
QString mLastVcalFile;
QString mLastSaveFile;
QString mLastLoadFile;
QString mLastSyncedLocalFile;
QString mDefaultAlarmFile;
int mIMIPScheduler;
int mIMIPSend;
QStringList mAdditionalMails;
int mIMIPAutoRefresh;
int mIMIPAutoInsertReply;
int mIMIPAutoInsertRequest;
int mIMIPAutoFreeBusy;
int mIMIPAutoFreeBusyReply;
QStringList mTodoTemplates;
QStringList mEventTemplates;
int mDestination;
bool mEditOnDoubleClick;
bool mViewChangeHoldFullscreen;
bool mViewChangeHoldNonFullscreen;
bool mCenterOnCurrentTime;
bool mSetTimeToDayStartAt;
bool mHighlightCurrentDay;
bool mUseHighlightLightColor;
bool mListViewMonthTimespan;
bool mWNViewShowsParents;
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index bd14fbf..2f286e0 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1130,156 +1130,157 @@ void MainWindow::slotSyncMenu( int action )
temp->setName(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]);
temp->readConfig(&config);
KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences();
KOPrefs::instance()->mSyncAlgoPrefs = temp->getSyncPrefs();
KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile();
KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting();
KOPrefs::instance()->mWriteBackInFuture = 0;
if ( temp->getWriteBackFuture() )
KOPrefs::instance()->mWriteBackInFuture = temp->getWriteBackFutureWeeks( );
KOPrefs::instance()->mShowSyncSummary = temp->getShowSummaryAfterSync();
if ( action == 1000 ) {
syncSharp();
} else if ( action == 1001 ) {
syncLocalFile();
} else if ( action == 1002 ) {
quickSyncLocalFile();
} else if ( action >= 1003 ) {
if ( temp->getIsLocalFileSync() ) {
if ( syncWithFile( temp->getRemoteFileName( ), false ) )
KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName();
} else {
if ( temp->getIsPhoneSync() ) {
KOPrefs::instance()->mPhoneDevice = temp->getPhoneDevice( ) ;
KOPrefs::instance()->mPhoneConnection = temp->getPhoneConnection( );
KOPrefs::instance()->mPhoneModel = temp->getPhoneModel( );
syncPhone();
} else if ( temp->getIsPiSync() ) {
mPassWordPiSync = temp->getRemotePw();
KOPrefs::instance()->mActiveSyncPort = temp->getRemotePort();
KOPrefs::instance()->mActiveSyncIP = temp->getRemoteIP();
syncPi();
} else
syncRemote( temp );
}
}
delete temp;
mBlockSaveFlag = false;
}
void MainWindow::exportToPhone( int mode )
{
//ex2phone->insertItem(i18n("Complete calendar..."), 1 );
//ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
KOex2phonePrefs ex2phone;
- ex2phone.mPhoneConnection->setText( KOPrefs::instance()->mEx2PhoneConnection );
- ex2phone.mPhoneDevice->setText( KOPrefs::instance()->mEx2PhoneDevice );
- ex2phone.mPhoneModel->setText( KOPrefs::instance()->mEx2PhoneModel );
+
+ ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
+ ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
+ ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
if ( mode == 1 )
ex2phone.setCaption(i18n("Export complete calendar"));
if ( mode == 2 )
ex2phone.setCaption(i18n("Export filtered calendar"));
if ( !ex2phone.exec() ) {
return;
}
- KOPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
- KOPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
- KOPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
+ KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
+ KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
+ KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
int inFuture = 0;
if ( ex2phone.mWriteBackFuture->isChecked() )
inFuture = ex2phone.mWriteBackFutureWeeks->value();
QPtrList<Incidence> delSel;
if ( mode == 1 )
delSel = mCalendar->rawIncidences();
if ( mode == 2 )
delSel = mCalendar->incidences();
CalendarLocal* cal = new CalendarLocal();
cal->setLocalTime();
Incidence *incidence = delSel.first();
QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
QDateTime end = cur.addDays( ( inFuture +1 ) *7 );
while ( incidence ) {
if ( incidence->type() != "Journal" ) {
bool add = true;
if ( inFuture ) {
QDateTime dt;
if ( incidence->type() == "Todo" ) {
Todo * t = (Todo*)incidence;
if ( t->hasDueDate() )
dt = t->dtDue();
else
dt = cur.addSecs( 62 );
}
else {
bool ok;
dt = incidence->getNextOccurence( cur, &ok );
if ( !ok )
dt = cur.addSecs( -62 );
}
if ( dt < cur || dt > end ) {
add = false;
}
}
if ( add ) {
Incidence *in = incidence->clone();
cal->addIncidence( in );
}
}
incidence = delSel.next();
}
- PhoneFormat::writeConfig( KOPrefs::instance()->mEx2PhoneDevice,
- KOPrefs::instance()->mEx2PhoneConnection,
- KOPrefs::instance()->mEx2PhoneModel );
+ PhoneFormat::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
+ KPimGlobalPrefs::instance()->mEx2PhoneConnection,
+ KPimGlobalPrefs::instance()->mEx2PhoneModel );
setCaption( i18n("Writing to phone..."));
if ( PhoneFormat::writeToPhone( cal ) )
setCaption( i18n("Export to phone successful!"));
else
setCaption( i18n("Error exporting to phone!"));
delete cal;
}
void MainWindow::setDefaultPreferences()
{
KOPrefs *p = KOPrefs::instance();
p->mCompactDialogs = true;
p->mConfirm = true;
// p->mEnableQuickTodo = false;
}
QString MainWindow::resourcePath()
{
return KGlobal::iconLoader()->iconPath();
}
void MainWindow::displayText( QString text ,QString cap )
{
QDialog dia( this, "name", true ); ;
dia.setCaption( cap );
QVBoxLayout* lay = new QVBoxLayout( &dia );
lay->setSpacing( 3 );
lay->setMargin( 3 );
QTextBrowser tb ( &dia );
lay->addWidget( &tb );
tb.setText( text );
#ifdef DESKTOP_VERSION
dia.resize( 640, 480);
#else
dia.showMaximized();
#endif
dia.exec();
}
void MainWindow::displayFile( QString fn, QString cap )
{
QString fileName = resourcePath() + fn;
QString text;
QFile file( fileName );
if (!file.open( IO_ReadOnly ) ) {
diff --git a/libkdepim/kpimglobalprefs.cpp b/libkdepim/kpimglobalprefs.cpp
index b2b7663..b71e18d 100644
--- a/libkdepim/kpimglobalprefs.cpp
+++ b/libkdepim/kpimglobalprefs.cpp
@@ -54,80 +54,87 @@ KPimGlobalPrefs::KPimGlobalPrefs( const QString &name )
// addItemBool("ShortDateInViewer",&mShortDateInViewer,false);
addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y");
addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y");
KPrefs::setCurrentGroup("Time & Date");
addItemString("TimeZoneName",&mTimeZoneId,i18n ("+01:00 Europe/Oslo(CET)") );
addItemBool("UseDaylightsaving",&mUseDaylightsaving,true);
addItemInt("DaylightsavingStart",&mDaylightsavingStart,90);
addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304);
KPrefs::setCurrentGroup( "ExternalApplications" );
addItemInt( "EmailChannelType", &mEmailClient, OMPI_EMC );
addItemString( "EmailChannel", &mEmailOtherChannel, "" );
addItemString( "EmailChannelMessage", &mEmailOtherMessage, "" );
addItemString( "EmailChannelParameters", &mEmailOtherMessageParameters, "" );
addItemString( "EmailChannelMessage2", &mEmailOtherMessage2, "" );
addItemString( "EmailChannelParameters2", &mEmailOtherMessageParameters2, "" );
addItemInt( "PhoneChannelType", &mPhoneClient, KPPI_PHC );
addItemString( "PhoneChannel", &mPhoneOtherChannel, "" );
addItemString( "PhoneChannelMessage", &mPhoneOtherMessage, "" );
addItemString( "PhoneChannelParameters", &mPhoneOtherMessageParameters, "" );
addItemInt( "FaxChannelType", &mFaxClient, NONE_FAC );
addItemString( "FaxChannel", &mFaxOtherChannel, "" );
addItemString( "FaxChannelMessage", &mFaxOtherMessage, "" );
addItemString( "FaxChannelParameters", &mFaxOtherMessageParameters, "" );
addItemInt( "SMSChannelType", &mSMSClient, NONE_SMC );
addItemString( "SMSChannel", &mSMSOtherChannel, "" );
addItemString( "SMSChannelMessage", &mSMSOtherMessage, "" );
addItemString( "SMSChannelParameters", &mSMSOtherMessageParameters, "" );
addItemInt( "PagerChannelType", &mPagerClient, NONE_PAC );
addItemString( "PagerChannel", &mPagerOtherChannel, "" );
addItemString( "PagerChannelMessage", &mPagerOtherMessage, "" );
addItemString( "PagerChannelParameters", &mPagerOtherMessageParameters, "" );
addItemInt( "SIPChannelType", &mSipClient, NONE_SIC );
addItemString( "SIPChannel", &mSipOtherChannel, "" );
addItemString( "SIPChannelMessage", &mSipOtherMessage, "" );
addItemString( "SIPChannelParameters", &mSipOtherMessageParameters, "" );
+
+ KPrefs::setCurrentGroup( "PhoneAccess" );
+ addItemString("Ex2PhoneDevice",&mEx2PhoneDevice,"/dev/ircomm");
+ addItemString("Ex2PhoneConnection",&mEx2PhoneConnection,"irda");
+ addItemString("Ex2PhoneModel",&mEx2PhoneModel,"6310i");
+
+
}
void KPimGlobalPrefs::setGlobalConfig()
{
KGlobal::locale()->setHore24Format( !mPreferredTime );
KGlobal::locale()->setWeekStartMonday( !mWeekStartsOnSunday );
KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)mPreferredDate );
KGlobal::locale()->setLanguage( mPreferredLanguage );
QString dummy = mUserDateFormatLong;
KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") ));
dummy = mUserDateFormatShort;
KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") ));
KGlobal::locale()->setDaylightSaving( mUseDaylightsaving,
mDaylightsavingStart,
mDaylightsavingEnd );
KGlobal::locale()->setTimezone( mTimeZoneId );
}
KPimGlobalPrefs::~KPimGlobalPrefs()
{
}
KPimGlobalPrefs *KPimGlobalPrefs::instance()
{
if ( !sInstance ) {
sInstance = staticDeleter.setObject( new KPimGlobalPrefs() );
sInstance->readConfig();
}
return sInstance;
}
diff --git a/libkdepim/kpimglobalprefs.h b/libkdepim/kpimglobalprefs.h
index 84ba689..f6b6628 100644
--- a/libkdepim/kpimglobalprefs.h
+++ b/libkdepim/kpimglobalprefs.h
@@ -84,52 +84,55 @@ class KPimGlobalPrefs : public KPrefs
static KPimGlobalPrefs *sInstance;
public:
//US I copied the following "locale" settings from KOPrefs
int mPreferredDate;
QString mUserDateFormatLong;
QString mUserDateFormatShort;
int mPreferredLanguage;
int mPreferredTime;
bool mWeekStartsOnSunday;
QString mTimeZoneId;
bool mUseDaylightsaving;
int mDaylightsavingStart;
int mDaylightsavingEnd;
int mEmailClient;
QString mEmailOtherChannel;
QString mEmailOtherMessage;
QString mEmailOtherMessageParameters;
QString mEmailOtherMessage2;
QString mEmailOtherMessageParameters2;
int mPhoneClient;
QString mPhoneOtherChannel;
QString mPhoneOtherMessage;
QString mPhoneOtherMessageParameters;
int mFaxClient;
QString mFaxOtherChannel;
QString mFaxOtherMessage;
QString mFaxOtherMessageParameters;
int mSMSClient;
QString mSMSOtherChannel;
QString mSMSOtherMessage;
QString mSMSOtherMessageParameters;
int mPagerClient;
QString mPagerOtherChannel;
QString mPagerOtherMessage;
QString mPagerOtherMessageParameters;
int mSipClient;
QString mSipOtherChannel;
QString mSipOtherMessage;
QString mSipOtherMessageParameters;
+ QString mEx2PhoneDevice;
+ QString mEx2PhoneConnection;
+ QString mEx2PhoneModel;
};
#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 @@
TEMPLATE = lib
CONFIG = qt warn_on
DEFINES +=KORG_NOKABC
TARGET = microkdepim
INCLUDEPATH += ../microkde ../microkde/kdecore ../microkde/kdeui . ..
DESTDIR=../bin
DEFINES += DESKTOP_VERSION
include( ../variables.pri )
unix : {
OBJECTS_DIR = obj/unix
MOC_DIR = moc/unix
}
win32: {
DEFINES += _WIN32_
OBJECTS_DIR = obj/win
MOC_DIR = moc/win
}
INTERFACES = \
HEADERS = \
categoryeditdialog.h \
categoryeditdialog_base.h \
categoryselectdialog.h \
categoryselectdialog_base.h \
externalapphandler.h \
kdateedit.h \
kdatepicker.h \
kinputdialog.h \
kpimprefs.h \
kpimglobalprefs.h \
kprefsdialog.h \
kprefswidget.h \
ksyncmanager.h \
ksyncprofile.h \
ksyncprefsdialog.h \
kcmconfigs/kcmkdepimconfig.h \
- kcmconfigs/kdepimconfigwidget.h
+ kcmconfigs/kdepimconfigwidget.h \
+ phoneaccess.h
SOURCES = \
categoryeditdialog.cpp \
categoryeditdialog_base.cpp \
categoryselectdialog.cpp \
categoryselectdialog_base.cpp \
externalapphandler.cpp \
kdateedit.cpp \
kdatepicker.cpp \
kinputdialog.cpp \
kpimprefs.cpp \
kpimglobalprefs.cpp \
kprefsdialog.cpp \
kprefswidget.cpp \
ksyncmanager.cpp \
ksyncprofile.cpp \
ksyncprefsdialog.cpp \
kcmconfigs/kcmkdepimconfig.cpp \
- kcmconfigs/kdepimconfigwidget.cpp
+ kcmconfigs/kdepimconfigwidget.cpp \
+ phoneaccess.cpp
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 @@
TEMPLATE = lib
CONFIG += qt warn_on
TARGET = microkdepim
INCLUDEPATH += . $(KDEPIMDIR) $(KDEPIMDIR)/microkde $(KDEPIMDIR)/qtcompat $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kdeui $(QPEDIR)/include
LIBS += -lmicrokde
#LIBS += -lmicrokcal
LIBS += -L$(QPEDIR)/lib
OBJECTS_DIR = obj/$(PLATFORM)
MOC_DIR = moc/$(PLATFORM)
DESTDIR=$(QPEDIR)/lib
INTERFACES = \
HEADERS = \
categoryeditdialog.h \
categoryeditdialog_base.h \
categoryselectdialog.h \
categoryselectdialog_base.h \
externalapphandler.h \
kdateedit.h \
kdatepicker.h \
kinputdialog.h \
kpimprefs.h \
kpimglobalprefs.h \
kprefsdialog.h \
kprefswidget.h \
ksyncmanager.h \
ksyncprofile.h \
ksyncprefsdialog.h \
kcmconfigs/kcmkdepimconfig.h \
- kcmconfigs/kdepimconfigwidget.h
+ kcmconfigs/kdepimconfigwidget.h \
+ phoneaccess.h
SOURCES = \
categoryeditdialog.cpp \
categoryeditdialog_base.cpp \
categoryselectdialog.cpp \
categoryselectdialog_base.cpp \
externalapphandler.cpp \
kdateedit.cpp \
kinputdialog.cpp \
kdatepicker.cpp \
kpimprefs.cpp \
kpimglobalprefs.cpp \
kprefsdialog.cpp \
kprefswidget.cpp \
ksyncmanager.cpp \
ksyncprofile.cpp \
ksyncprefsdialog.cpp \
kcmconfigs/kcmkdepimconfig.cpp \
- kcmconfigs/kdepimconfigwidget.cpp
+ kcmconfigs/kdepimconfigwidget.cpp \
+ phoneaccess.cpp
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 @@
+/*
+ This file is part of libkdepim.
+
+ Copyright (c) 2004 Lutz Rogowski <rogowski@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.
+*/
+
+
+#include <qstring.h>
+#include <qapplication.h>
+#include <qptrlist.h>
+#include <qregexp.h>
+#include <qfile.h>
+#include <qtextstream.h>
+#include <qtextcodec.h>
+#include <qdir.h>
+#include <kmessagebox.h>
+#include <stdlib.h>
+#include "phoneaccess.h"
+
+void PhoneAccess::writeConfig( QString device, QString connection, QString model )
+{
+#ifdef _WIN32_
+ QString fileName = qApp->applicationDirPath () +"\\gammurc";
+#else
+ QString fileName = QDir::homeDirPath() +"/.gammurc";
+#endif
+ //qDebug("save %d ", load );
+ QString content;
+ bool write = false;
+ bool addPort = true, addConnection = true, addModel = true;
+ QFile file( fileName );
+ if ( QFile::exists( fileName) ) {
+ if (!file.open( IO_ReadOnly ) ) {
+ qDebug("Error: cannot open %s ", fileName.latin1() );
+ return;
+ }
+ QString line;
+ while ( file.readLine( line, 1024 ) > 0 ) {
+ //qDebug("*%s* ", line.latin1() );
+ if ( line.left(7 ) == "[gammu]" ) {
+ ;
+ } else
+ if ( line.left(4 ) == "port" ) {
+ if ( line == "port = " + device+"\n" ) {
+ content += line ;
+ addPort = false;
+ //qDebug("port found" );
+ }
+
+ } else if ( line.left(5 ) == "model" ) {
+ if ( line == "model = " + model +"\n") {
+ content += line ;
+ addModel = false;
+ //qDebug("model found" );
+ }
+
+ } else if ( line.left( 10 ) == "connection" ) {
+ if ( line == "connection = " + connection +"\n") {
+ addConnection = false;
+ content += line ;
+ //qDebug("con found" );
+ }
+
+ } else {
+ content += line ;
+ }
+ }
+ file.close();
+ } else {
+ if ( ! connection.isEmpty() ) {
+ addConnection = true;
+ }
+ if ( ! device.isEmpty() ) {
+ addPort = true;
+
+ }
+ if ( ! model.isEmpty() ) {
+ addModel = true;
+ }
+ }
+
+ if ( addConnection ) {
+ if ( ! write )
+ content += "[gammu]\n";
+ write = true;
+ content += "connection = ";
+ content += connection;
+ content += "\n";
+ }
+ if ( addPort ) {
+ if ( ! write )
+ content += "[gammu]\n";
+ write = true;
+ content += "port = ";
+ content += device;
+ content += "\n";
+
+ }
+ if ( addModel ) {
+ if ( ! write )
+ content += "[gammu]\n";
+ write = true;
+ content += "model = ";
+ content += model;
+ content += "\n";
+ }
+ if ( write ) {
+ if (!file.open( IO_WriteOnly ) ) {
+ qDebug("Error: cannot write file %s ", fileName.latin1() );
+ return;
+ }
+ qDebug("Writing file %s ", fileName.latin1() );
+ QTextStream ts( &file );
+ ts << content ;
+ file.close();
+ }
+
+}
+
+
+bool PhoneAccess::writeToPhone( QString fileName)
+{
+
+#ifdef DESKTOP_VERSION
+ QString command ="./kammu --restore " + fileName ;
+#else
+ QString command ="kammu --restore " + fileName ;
+#endif
+ int ret;
+ while ( (ret = system ( command.latin1())) != 0 ) {
+ qDebug("Error S::command returned %d. asking users", ret);
+ int retval = KMessageBox::warningContinueCancel(0,
+ i18n("Error accessing device!\nPlease turn on connection\nand retry!"),i18n("KO/Pi phone access"),i18n("Retry"),i18n("Cancel"));
+ if ( retval != KMessageBox::Continue )
+ return false;
+ }
+ return true;
+}
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 @@
+/*
+ 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 PHONEACCESS_H
+#define PHONEACCESS_H
+
+#include <qstring.h>
+
+
+
+/**
+ This class implements the calendar format used by Phone.
+*/
+
+class PhoneAccess : public QObject {
+ public:
+
+ static void writeConfig( QString device,QString connection, QString model );
+ static bool writeToPhone( QString fileName );
+
+};
+
+
+
+#endif