author | zautrix <zautrix> | 2004-10-08 23:38:07 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-08 23:38:07 (UTC) |
commit | 07fdef2c2ea1153d39d7114b3d5bd4abc4f4c861 (patch) (side-by-side diff) | |
tree | 03d0e5d20e607e035e17fcdabd6bce789069f41e | |
parent | 44169895703beb3e8b1551a313d2d341bf742905 (diff) | |
download | kdepimpi-07fdef2c2ea1153d39d7114b3d5bd4abc4f4c861.zip kdepimpi-07fdef2c2ea1153d39d7114b3d5bd4abc4f4c861.tar.gz kdepimpi-07fdef2c2ea1153d39d7114b3d5bd4abc4f4c861.tar.bz2 |
some bugfixes
-rw-r--r-- | kabc/addressee.cpp | 16 | ||||
-rw-r--r-- | kabc/addressee.h | 1 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 2 | ||||
-rw-r--r-- | kaddressbook/kabprefs.cpp | 1 | ||||
-rw-r--r-- | kalarmd/simplealarmdaemonapplet.cpp | 1 | ||||
-rw-r--r-- | kmicromail/koprefs.cpp | 381 | ||||
-rw-r--r-- | korganizer/main.cpp | 6 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 6 | ||||
-rw-r--r-- | korganizer/mainwindow.h | 2 | ||||
-rw-r--r-- | libkdepim/kpimglobalprefs.cpp | 8 | ||||
-rw-r--r-- | microkde/kstaticdeleter.h | 6 |
11 files changed, 35 insertions, 395 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp index e571980..19a1845 100644 --- a/kabc/addressee.cpp +++ b/kabc/addressee.cpp @@ -222,192 +222,208 @@ void Addressee::computeCsum(const QString &dev) if ( mData->geo.isValid() ) l.append( mData->geo.asString() ); if ( !mData->title .isEmpty() ) l.append( mData->title ); if ( !mData->role.isEmpty() ) l.append( mData->role ); if ( !mData->organization.isEmpty() ) l.append( mData->organization ); if ( !mData->note.isEmpty() ) l.append( mData->note ); if ( !mData->productId.isEmpty() ) l.append(mData->productId ); if ( !mData->sortString.isEmpty() ) l.append( mData->sortString ); if ( mData->secrecy.isValid() ) l.append( mData->secrecy.asString()); // if ( !mData->logo.isEmpty() ) l.append( ); //if ( !mData->photo.isEmpty() ) l.append( ); //if ( !mData->sound.isEmpty() ) l.append( ); //if ( !mData->agent.isEmpty() ) l.append( ); //if ( mData->url.isValid() ) l.append( ); #if 0 if ( !mData->phoneNumbers.isEmpty() ) l.append( ); if ( !mData->addresses.isEmpty() ) l.append( ); //if ( !mData->keys.isEmpty() ) l.append( ); if ( !mData->emails.isEmpty() ) l.append( ); if ( !mData->categories .isEmpty() ) l.append( ); if ( !mData->custom.isEmpty() ) l.append( ); #endif KABC::PhoneNumber::List phoneNumbers; KABC::PhoneNumber::List::Iterator phoneIter; QStringList t; for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); ++phoneIter ) t.append( ( *phoneIter ).number()+QString::number( ( *phoneIter ).type() ) ); t.sort(); uint iii; for ( iii = 0; iii < t.count(); ++iii) l.append( t[iii] ); t = mData->emails; t.sort(); for ( iii = 0; iii < t.count(); ++iii) l.append( t[iii] ); t = mData->categories; t.sort(); for ( iii = 0; iii < t.count(); ++iii) l.append( t[iii] ); t = mData->custom; t.sort(); for ( iii = 0; iii < t.count(); ++iii) l.append( t[iii] ); KABC::Address::List::Iterator addressIter; for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); ++addressIter ) { t = (*addressIter).asList(); t.sort(); for ( iii = 0; iii < t.count(); ++iii) l.append( t[iii] ); } uint cs = getCsum4List(l); // qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() ); setCsum( dev, QString::number (cs )); } void Addressee::mergeContact( const Addressee& ad ) { detach(); if ( mData->name.isEmpty() ) mData->name = ad.mData->name; if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName; if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName; if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ; if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName; if ( mData->prefix.isEmpty() ) mData->prefix = ad.mData->prefix; if ( mData->suffix.isEmpty() ) mData->suffix = ad.mData->suffix; if ( mData->nickName.isEmpty() ) mData->nickName = ad.mData->nickName; if ( !mData->birthday.isValid() ) if ( ad.mData->birthday.isValid()) mData->birthday = ad.mData->birthday; if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer; if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone; if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo; if ( mData->title .isEmpty() ) mData->title = ad.mData->title ; if ( mData->role.isEmpty() ) mData->role = ad.mData->role ; if ( mData->organization.isEmpty() ) mData->organization = ad.mData->organization ; if ( mData->note.isEmpty() ) mData->note = ad.mData->note ; if ( mData->productId.isEmpty() ) mData->productId = ad.mData->productId; if ( mData->sortString.isEmpty() ) mData->sortString = ad.mData->sortString; if ( !mData->secrecy.isValid() ) mData->secrecy = ad.mData->secrecy; if ( ( !mData->url.isValid() && ad.mData->url.isValid() ) ) mData->url = ad.mData->url ; // pending: // merging phonenumbers // merging addresses // merging emails; // merging categories; // merging custom; // merging keys qDebug("merge contact %s ", ad.uid().latin1()); setUid( ad.uid() ); setRevision( ad.revision() ); } +void Addressee::simplifyAddresses() +{ + if ( mData->addresses.count() < 3 ) return ; + int count = 0; + Address::List list; + Address::List::Iterator it; + for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { + if ( count > 1 ) + list.append( *it ); + ++count; + } + for( it = list.begin(); it != list.end(); ++it ) { + removeAddress( (*it) ); + } +} + // removes all emails but the first // needed by phone sync void Addressee::simplifyEmails() { if ( mData->emails.count() == 0 ) return ; QString email = mData->emails.first(); detach(); mData->emails.clear(); mData->emails.append( email ); } void Addressee::simplifyPhoneNumbers() { KABC::PhoneNumber::List removeNumbers; KABC::PhoneNumber::List::Iterator phoneIter; for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); ++phoneIter ) { if ( ! ( *phoneIter ).simplifyNumber() ) removeNumbers.append( ( *phoneIter ) ); } for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); ++phoneIter ) { removePhoneNumber(( *phoneIter )); } } void Addressee::simplifyPhoneNumberTypes() { KABC::PhoneNumber::List::Iterator phoneIter; for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); ++phoneIter ) ( *phoneIter ).simplifyType(); } void Addressee::removeID(const QString &prof) { detach(); mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); } void Addressee::setID( const QString & prof , const QString & id ) { detach(); mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id ); //qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); } void Addressee::setTempSyncStat( int id ) { if ( mData->mTempSyncStat == id ) return; detach(); mData->mTempSyncStat = id; } int Addressee::tempSyncStat() const { return mData->mTempSyncStat; } QString Addressee::getID( const QString & prof) { return KIdManager::getId ( mData->mExternalId, prof ); } void Addressee::setCsum( const QString & prof , const QString & id ) { detach(); //qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id ); //qDebug("setcsum2 %s ",mData->mExternalId.latin1() ); } QString Addressee::getCsum( const QString & prof) { return KIdManager::getCsum ( mData->mExternalId, prof ); } void Addressee::setIDStr( const QString & s ) { detach(); mData->mExternalId = s; } QString Addressee::IDStr() const { return mData->mExternalId; } void Addressee::setExternalUID( const QString &id ) { if ( id == mData->externalUID ) return; detach(); mData->empty = false; mData->externalUID = id; } QString Addressee::externalUID() const { return mData->externalUID; } diff --git a/kabc/addressee.h b/kabc/addressee.h index 4cafa86..44f0629 100644 --- a/kabc/addressee.h +++ b/kabc/addressee.h @@ -25,192 +25,193 @@ Copyright (c) 2004 Ulf Schenk $Id$ */ #ifndef KABC_ADDRESSEE_H #define KABC_ADDRESSEE_H #include <qdatetime.h> #include <qstring.h> #include <qstringlist.h> #include <qvaluelist.h> #include <ksharedptr.h> #include <kurl.h> #include "address.h" #include "agent.h" #include "geo.h" #include "key.h" #include "phonenumber.h" #include "picture.h" #include "secrecy.h" #include "sound.h" #include "timezone.h" namespace KABC { class Resource; /** @short address book entry This class represents an entry in the address book. The data of this class is implicitly shared. You can pass this class by value. If you need the name of a field for presenting it to the user you should use the functions ending in Label(). They return a translated string which can be used as label for the corresponding field. About the name fields: givenName() is the first name and familyName() the last name. In some countries the family name comes first, that's the reason for the naming. formattedName() is the full name with the correct formatting. It is used as an override, when the correct formatting can't be generated from the other name fields automatically. realName() returns a fully formatted name(). It uses formattedName, if set, otherwise it constucts the name from the name fields. As fallback, if nothing else is set it uses name(). name() is the NAME type of RFC2426. It can be used as internal name for the data enty, but shouldn't be used for displaying the data to the user. */ class Addressee { friend QDataStream &operator<<( QDataStream &, const Addressee & ); friend QDataStream &operator>>( QDataStream &, Addressee & ); public: typedef QValueList<Addressee> List; /** Construct an empty address book entry. */ Addressee(); ~Addressee(); Addressee( const Addressee & ); Addressee &operator=( const Addressee & ); bool operator==( const Addressee & ) const; bool operator!=( const Addressee & ) const; // sync stuff void setTempSyncStat(int id); int tempSyncStat() const; void setIDStr( const QString & ); QString IDStr() const; void setID( const QString &, const QString & ); QString getID( const QString & ); void setCsum( const QString &, const QString & ); QString getCsum( const QString & ); void removeID(const QString &); void computeCsum(const QString &dev); ulong getCsum4List( const QStringList & attList); /** Return, if the address book entry is empty. */ bool isEmpty() const; void setExternalUID( const QString &id ); QString externalUID() const; void setOriginalExternalUID( const QString &id ); QString originalExternalUID() const; void mergeContact( const Addressee& ad ); void simplifyEmails(); + void simplifyAddresses(); void simplifyPhoneNumbers(); void simplifyPhoneNumberTypes(); /** Set unique identifier. */ void setUid( const QString &uid ); /** Return unique identifier. */ QString uid() const; /** Return translated label for uid field. */ static QString uidLabel(); /** Set name. */ void setName( const QString &name ); /** Return name. */ QString name() const; /** Return translated label for name field. */ static QString nameLabel(); /** Set formatted name. */ void setFormattedName( const QString &formattedName ); /** Return formatted name. */ QString formattedName() const; /** Return translated label for formattedName field. */ static QString formattedNameLabel(); /** Set family name. */ void setFamilyName( const QString &familyName ); /** Return family name. */ QString familyName() const; /** Return translated label for familyName field. */ static QString familyNameLabel(); /** Set given name. */ void setGivenName( const QString &givenName ); /** Return given name. */ QString givenName() const; /** Return translated label for givenName field. */ static QString givenNameLabel(); /** Set additional names. */ void setAdditionalName( const QString &additionalName ); /** Return additional names. */ QString additionalName() const; /** Return translated label for additionalName field. */ static QString additionalNameLabel(); /** Set honorific prefixes. */ void setPrefix( const QString &prefix ); /** Return honorific prefixes. */ QString prefix() const; /** Return translated label for prefix field. */ static QString prefixLabel(); /** Set honorific suffixes. diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 939296f..9b059d3 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp @@ -229,192 +229,193 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const #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" ); //US added this field to become compatible with Opie/qtopia addressbook // values can be "female" or "male" or "". An empty field represents undefined. mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, "X-Gender", "KADDRESSBOOK" ); mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, "X-Children", "KADDRESSBOOK" ); mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, "X-FreeBusyUrl", "KADDRESSBOOK" ); #endif initGUI(); mIncSearchWidget->setFocus(); connect( mViewManager, SIGNAL( selected( const QString& ) ), SLOT( setContactSelected( const QString& ) ) ); connect( mViewManager, SIGNAL( executed( const QString& ) ), SLOT( executeContact( const QString& ) ) ); connect( mViewManager, SIGNAL( deleteRequest( ) ), SLOT( deleteContacts( ) ) ); connect( mViewManager, SIGNAL( modified() ), SLOT( setModified() ) ); connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); connect( mXXPortManager, SIGNAL( modified() ), SLOT( setModified() ) ); connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), SLOT( incrementalSearch( const QString& ) ) ); connect( mIncSearchWidget, SIGNAL( fieldChanged() ), mJumpButtonBar, SLOT( recreateButtons() ) ); connect( mDetails, SIGNAL( sendEmail( const QString& ) ), SLOT( sendMail( const QString& ) ) ); connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); #ifndef KAB_EMBEDDED connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), mXXPortManager, SLOT( importVCard( const KURL& ) ) ); connect( mDetails, SIGNAL( browse( const QString& ) ), SLOT( browse( const QString& ) ) ); mAddressBookService = new KAddressBookService( this ); #endif //KAB_EMBEDDED mEditorDialog = 0; createAddresseeEditorDialog( this ); setModified( false ); } KABCore::~KABCore() { // save(); //saveSettings(); //KABPrefs::instance()->writeConfig(); delete AddresseeConfig::instance(); mAddressBook = 0; KABC::StdAddressBook::close(); delete syncManager; + } void KABCore::restoreSettings() { mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; bool state; if (mMultipleViewsAtOnce) state = KABPrefs::instance()->mDetailsPageVisible; else state = false; mActionDetails->setChecked( state ); setDetailsVisible( state ); state = KABPrefs::instance()->mJumpButtonBarVisible; mActionJumpBar->setChecked( state ); setJumpButtonBarVisible( state ); /*US QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; if ( splitterSize.count() == 0 ) { splitterSize.append( width() / 2 ); splitterSize.append( width() / 2 ); } mMiniSplitter->setSizes( splitterSize ); if ( mExtensionBarSplitter ) { splitterSize = KABPrefs::instance()->mExtensionsSplitter; if ( splitterSize.count() == 0 ) { splitterSize.append( width() / 2 ); splitterSize.append( width() / 2 ); } mExtensionBarSplitter->setSizes( splitterSize ); } */ mViewManager->restoreSettings(); mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); mExtensionManager->restoreSettings(); #ifdef DESKTOP_VERSION int wid = width(); if ( wid < 10 ) wid = 400; #else int wid = QApplication::desktop()->width(); if ( wid < 640 ) wid = QApplication::desktop()->height(); #endif QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; if ( true /*splitterSize.count() == 0*/ ) { splitterSize.append( wid / 2 ); splitterSize.append( wid / 2 ); } mMiniSplitter->setSizes( splitterSize ); if ( mExtensionBarSplitter ) { //splitterSize = KABPrefs::instance()->mExtensionsSplitter; if ( true /*splitterSize.count() == 0*/ ) { splitterSize.append( wid / 2 ); splitterSize.append( wid / 2 ); } mExtensionBarSplitter->setSizes( splitterSize ); } } void KABCore::saveSettings() { KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); if ( mExtensionBarSplitter ) KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); #ifndef KAB_EMBEDDED KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); #endif //KAB_EMBEDDED mExtensionManager->saveSettings(); mViewManager->saveSettings(); KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); } KABC::AddressBook *KABCore::addressBook() const { return mAddressBook; } KConfig *KABCore::config() { #ifndef KAB_EMBEDDED return KABPrefs::instance()->config(); #else //KAB_EMBEDDED @@ -609,192 +610,193 @@ void KABCore::mailVCard( const QStringList& uids ) QString name = a.givenName() + "_" + a.familyName() + ".vcf"; QString fileName = dirName + "/" + name; QFile outFile(fileName); 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(); PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, KPimGlobalPrefs::instance()->mEx2PhoneConnection, KPimGlobalPrefs::instance()->mEx2PhoneModel ); QStringList uids = mViewManager->selectedUids(); if ( uids.isEmpty() ) return; #ifdef _WIN32_ QString fileName = locateLocal("tmp", "tempfile.vcf"); #else QString fileName = "/tmp/kdepimtemp.vcf"; #endif 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; a.simplifyEmails(); a.simplifyPhoneNumbers(); a.simplifyPhoneNumberTypes(); + a.simplifyAddresses(); if (description.isEmpty()) description = a.formattedName(); QString vcard; QString vcardnew; 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; vcardnew +=vcard.mid( start, next - start); vcardnew +=vcard.mid( next+5,sep -next -5 ).upper(); start = sep; } vcardnew += vcard.mid( start,vcard.length() ); vcard = ""; start = 0; while ( (next = vcardnew.find("ADR", start) )>= 0 ) { int sep = vcardnew.find(":", next); vcard +=vcardnew.mid( start, next - start+3); start = sep; } vcard += vcardnew.mid( start,vcardnew.length() ); vcard.replace ( QRegExp(";;;") , "" ); vcard.replace ( QRegExp(";;") , "" ); datastream += vcard; } 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(); if ( PhoneAccess::writeToPhone( fileName ) ) qDebug("Export okay "); else qDebug("Error export contacts "); } else { qDebug("Error open temp file "); return; } #if 0 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 ); diff --git a/kaddressbook/kabprefs.cpp b/kaddressbook/kabprefs.cpp index 552c933..dded2bf 100644 --- a/kaddressbook/kabprefs.cpp +++ b/kaddressbook/kabprefs.cpp @@ -1,132 +1,133 @@ /* This file is part of KAddressBook. Copyright (c) 2002 Mike Pilone <mpilone@slac.com> 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. */ //US#ifdef KAB_EMBEDDED //#include <qstring.h> //#endif //KAB_EMBEDDED #include <kconfig.h> #include <klocale.h> #include <kstaticdeleter.h> //US#include <kdebug.h> // defines kdDebug() #include "kabprefs.h" KABPrefs *KABPrefs::sInstance = 0; static KStaticDeleter<KABPrefs> staticDeleter; KABPrefs::KABPrefs() : KPimPrefs("kaddressbookrc") { KPrefs::setCurrentGroup( "Views" ); addItemBool( "HonorSingleClick", &mHonorSingleClick, false ); KPrefs::setCurrentGroup( "General" ); addItemBool( "AutomaticNameParsing", &mAutomaticNameParsing, true ); addItemInt( "CurrentIncSearchField", &mCurrentIncSearchField, 0 ); #ifdef KAB_EMBEDDED addItemBool("AskForQuit",&mAskForQuit,true); addItemBool("ToolBarHor",&mToolBarHor, true ); addItemBool("ToolBarUp",&mToolBarUp, false ); addItemBool("SearchWithReturn",&mSearchWithReturn, true ); #endif //KAB_EMBEDDED KPrefs::setCurrentGroup( "MainWindow" ); addItemBool( "JumpButtonBarVisible", &mJumpButtonBarVisible, false ); addItemBool( "DetailsPageVisible", &mDetailsPageVisible, true ); addItemIntList( "ExtensionsSplitter", &mExtensionsSplitter ); addItemIntList( "DetailsSplitter", &mDetailsSplitter ); addItemBool( "MultipleViewsAtOnce", &mMultipleViewsAtOnce, true ); KPrefs::setCurrentGroup( "Extensions_General" ); QStringList defaultExtensions; defaultExtensions << "merge"; defaultExtensions << "distribution_list_editor"; addItemInt( "CurrentExtension", &mCurrentExtension, 0 ); addItemStringList( "ActiveExtensions", &mActiveExtensions, defaultExtensions ); KPrefs::setCurrentGroup( "Views" ); QString defaultView = i18n( "Default Table View" ); addItemString( "CurrentView", &mCurrentView, defaultView ); addItemStringList( "ViewNames", &mViewNames, defaultView ); KPrefs::setCurrentGroup( "Filters" ); addItemInt( "CurrentFilter", &mCurrentFilter, 0 ); } KABPrefs::~KABPrefs() { + //qDebug("KABPrefs::~KABPrefs() "); } KABPrefs *KABPrefs::instance() { if ( !sInstance ) { #ifdef KAB_EMBEDDED sInstance = staticDeleter.setObject( new KABPrefs() ); #else //KAB_EMBEDDED //US the following line has changed ???. Why staticDeleter.setObject( sInstance, new KABPrefs() ); #endif //KAB_EMBEDDED sInstance->readConfig(); } return sInstance; } void KABPrefs::setCategoryDefaults() { mCustomCategories.clear(); mCustomCategories << i18n( "Business" ) << i18n( "Family" ) << i18n( "School" ) << i18n( "Customer" ) << i18n( "Friend" ); } // US introduce a nonconst way to return the config object. KConfig* KABPrefs::getConfig() { return config(); } /*US void KABPrefs::usrSetDefaults() { KPimPrefs::usrSetDefaults(); } void KABPrefs::usrReadConfig() { KPimPrefs::usrReadConfig(); } void KABPrefs::usrWriteConfig() { KPimPrefs::usrWriteConfig(); } */ diff --git a/kalarmd/simplealarmdaemonapplet.cpp b/kalarmd/simplealarmdaemonapplet.cpp index bb89606..7e8125d 100644 --- a/kalarmd/simplealarmdaemonapplet.cpp +++ b/kalarmd/simplealarmdaemonapplet.cpp @@ -1,58 +1,57 @@ #include "simplealarmdaemonapplet.h" #include "simplealarmdaemonimpl.h" -#include <qpe/global.h> #include <qcopchannel_qws.h> #include <qlabel.h> #include <qapp.h> #include <qpe/resource.h> SimpleAlarmDaemonApplet::SimpleAlarmDaemonApplet() : mApplet( 0 ), ref( 0 ) { } SimpleAlarmDaemonApplet::~SimpleAlarmDaemonApplet() { delete mApplet; } QWidget *SimpleAlarmDaemonApplet::applet( QWidget *parent ) { if ( !mApplet ) { mApplet = new SimpleAlarmDaemonImpl( parent ); if ( QApplication::desktop()->width() < 480 ) mApplet->setPixmap( Resource::loadPixmap( "ko16" ) ); else mApplet->setPixmap( Resource::loadPixmap( "ko24" ) ); QCopChannel* c = new QCopChannel("koalarm",mApplet , "channel" ) ; QObject::connect( c, SIGNAL (received ( const QCString &, const QByteArray & )),mApplet, SLOT(recieve( const QCString&, const QByteArray& ))); mApplet->show(); } return mApplet; } int SimpleAlarmDaemonApplet::position() const { return 7; } QRESULT SimpleAlarmDaemonApplet::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) { *iface = 0; if ( uuid == IID_QUnknown ) *iface = this; else if ( uuid == IID_TaskbarApplet ) *iface = this; if ( *iface ) (*iface)->addRef(); return QS_OK; } Q_EXPORT_INTERFACE() { Q_CREATE_INSTANCE( SimpleAlarmDaemonApplet ) } diff --git a/kmicromail/koprefs.cpp b/kmicromail/koprefs.cpp index 6484c45..c0200ff 100644 --- a/kmicromail/koprefs.cpp +++ b/kmicromail/koprefs.cpp @@ -1,507 +1,128 @@ /* This file is part of KOrganizer. Copyright (c) 2001 Cornelius Schumacher <schumacher@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. */ #include <time.h> #ifndef _WIN32_ #include <unistd.h> #endif #include <qdir.h> #include <qtextstream.h> #include <qtextcodec.h> #include <qstring.h> #include <qregexp.h> #include <qfont.h> #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 "koprefs.h" #include "mainwindow.h" KOPrefs *KOPrefs::mInstance = 0; static KStaticDeleter<KOPrefs> insd; KOPrefs::KOPrefs() : KPimPrefs("kopiemailrc") { mAppFont = QFont("helvetica",12); mComposeFont = QFont("helvetica",12); mReadFont = QFont("helvetica",12); KPrefs::setCurrentGroup("General"); addItemString("SenderName",&mName,i18n ("Please set at") ); addItemString("SenderEmail",&mEmail,i18n ("Settings@General TAB") ); addItemBool("ViewMailAsHtml",&mViewAsHtml,false); addItemBool("SendMailLater",&mSendLater,true); addItemBool("UseKapi",&mUseKapi,false); KPrefs::setCurrentGroup("Fonts"); addItemFont("Application Font",&mAppFont); addItemFont("Compose Font",&mComposeFont); addItemFont("Read Font",&mReadFont); -#if 0 - 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"); - 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); - addItemBool("Auto Save",&mAutoSave,false); - addItemInt("Auto Save Interval",&mAutoSaveInterval,3); - addItemBool("Confirm Deletes",&mConfirm,true); - addItemString("Archive File",&mArchiveFile); - addItemString("Html Export File",&mHtmlExportFile, - QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); - addItemBool("Html With Save",&mHtmlWithSave,false); - - KPrefs::setCurrentGroup("Personal Settings"); - - addItemInt("Mail Client",&mMailClient,MailClientKMail); - addItemBool("Use Control Center Email",&mEmailControlCenter,false); - addItemBool("Bcc",&mBcc,false); - - KPrefs::setCurrentGroup("Time & Date"); - - // addItemString("Time Zone",&mTimeZone,"+0100"); - addItemString("TimeZoneName",&mTimeZoneId,i18n ("+01:00 Europe/Oslo(CET)") ); - // addItemInt("TimeZoneOffset",&mTimeZoneOffset,60); - addItemBool("UseDaylightsaving",&mUseDaylightsaving,true); - addItemInt("DaylightsavingStart",&mDaylightsavingStart,90); - addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304); - - - addItemInt("Default Start Time",&mStartTime,10); - addItemInt("Default Duration",&mDefaultDuration,2); - addItemInt("Default Alarm Time",&mAlarmTime,3); - addItemInt("Daylight Savings",&mDaylightSavings,0); - KPrefs::setCurrentGroup("AlarmSettings"); - addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); - addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); - addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); - addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); - - - KPrefs::setCurrentGroup("Calendar"); - - addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); - - KPrefs::setCurrentGroup("Fonts"); - // qDebug(" KPrefs::setCurrentGroup(Fonts); "); - addItemFont("TimeBar Font",&mTimeBarFont); - addItemFont("MonthView Font",&mMonthViewFont); - addItemFont("AgendaView Font",&mAgendaViewFont); - addItemFont("MarcusBains Font",&mMarcusBainsFont); - addItemFont("TimeLabels Font",&mTimeLabelsFont); - addItemFont("TodoView Font",&mTodoViewFont); - addItemFont("ListView Font",&mListViewFont); - addItemFont("DateNavigator Font",&mDateNavigatorFont); - addItemFont("EditBox Font",&mEditBoxFont); - addItemFont("JournalView Font",&mJornalViewFont); - 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); - addItemBool("ShowSyncEvents",&mShowSyncEvents,false); - addItemInt("LastSyncTime",&mLastSyncTime,0); - addItemInt("SyncAlgoPrefs",&mSyncAlgoPrefs,3); - addItemInt("RingSyncAlgoPrefs",&mRingSyncAlgoPrefs,3); - -#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" ); - addItemString("LastSyncedLocalFile", &mLastSyncedLocalFile ,hdp +"lastsync.ics" ); - - - KPrefs::setCurrentGroup("Locale"); - addItemInt("PreferredLanguage",&mPreferredLanguage,0); - addItemInt("PreferredTime",&mPreferredTime,0); - addItemInt("PreferredDate",&mPreferredDate,0); - addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false); - addItemBool("QuickSavingWOUnicode",&mUseQuicksave,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); - addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); - addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); - addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); - addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); - addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); - addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); - addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); - addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); - addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); - addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); - addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); - addItemBool("UseAppColors",&mUseAppColors,false); - - - - KPrefs::setCurrentGroup("Views"); - addItemInt("Hour Size",&mHourSize,8); - addItemBool("Show Daily Recurrences",&mDailyRecur,true); - addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); - addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); - addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); - addItemBool("ShowShortMonthName",&mMonthShowShort,false); - addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); - addItemBool("Enable ToolTips",&mEnableToolTips,false); - addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); - addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); - addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); - addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); - addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,false); - addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); - addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); - addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); - addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); - addItemBool("WNViewShowsParents",&mWNViewShowsParents,true); - addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); - addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); - addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); - addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); - addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); - addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,false); - addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); - addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); -#ifdef DESKTOP_VERSION - addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); -#else - addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); -#endif - addItemInt("Day Begins",&mDayBegins,7); - addItemInt("Working Hours Start",&mWorkingHoursStart,8); - addItemInt("Working Hours End",&mWorkingHoursEnd,17); - addItemBool("Exclude Holidays",&mExcludeHolidays,true); - addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); - - addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); - addItemBool("Full View Month",&mFullViewMonth,true); - addItemBool("Full View Todo",&mFullViewTodo,true); - addItemBool("Quick Todo",&mEnableQuickTodo,false); - - addItemInt("Next X Days",&mNextXDays,3); - - KPrefs::setCurrentGroup("Printer"); - - KPrefs::setCurrentGroup("Layout"); - - addItemBool("CompactDialogs",&mCompactDialogs,false); - addItemBool("VerticalScreen",&mVerticalScreen,true); - - KPrefs::setCurrentGroup("KOrganizer Plugins"); - - addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); - - KPrefs::setCurrentGroup("Group Scheduling"); - - addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); - addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); - addItemStringList("AdditionalMails",&mAdditionalMails,""); - addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); - addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); - addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); - addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); - addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); - - KPrefs::setCurrentGroup( "Editors" ); - - addItemStringList( "EventTemplates", &mEventTemplates ); - addItemStringList( "TodoTemplates", &mTodoTemplates ); - - addItemInt("DestinationPolicy",&mDestination,standardDestination); - -#endif } KOPrefs::~KOPrefs() { if (mInstance == this) mInstance = insd.setObject(0); -#if 0 - setLocaleDict( 0 ); - if ( mLocaleDict ) - delete mLocaleDict; - //qDebug("KOPrefs::~KOPrefs() "); -#endif + } KOPrefs *KOPrefs::instance() { if (!mInstance) { mInstance = insd.setObject(new KOPrefs()); mInstance->readConfig(); } return mInstance; } void KOPrefs::usrSetDefaults() { } void KOPrefs::fillMailDefaults() { if (mName.isEmpty()) mName = i18n("Anonymous"); if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); } void KOPrefs::setTimeZoneIdDefault() { mTimeZoneId = i18n("+01:00 Europe/Oslo(CET)"); } void KOPrefs::usrReadConfig() { -#if 0 - mLocaleDict = 0; - // pending LR fix translation - // qDebug("KOPrefs::usrReadConfig() fix translation "); - if ( mPreferredLanguage > 0 && mPreferredLanguage < 4 ) { - if ( mPreferredLanguage == 1 ) { - mLocaleDict = new QDict<QString>; - int i = 0; - QString fw ( germanwords[i] [0]); - while ( !fw.isEmpty() ) { - mLocaleDict->insert( fw, new QString (germanwords[i] [1] )); - ++i; - fw = germanwords[i] [0]; - } - - setLocaleDict( mLocaleDict ); - } else { - QString fileName ; - if ( mPreferredLanguage == 3 ) - fileName = MainWindow::resourcePath()+"usertranslation.txt"; - else if ( mPreferredLanguage == 2 ) - fileName = MainWindow::resourcePath()+"frenchtranslation.txt"; - QFile file( fileName ); - if (file.open( IO_ReadOnly ) ) { - QTextStream ts( &file ); - ts.setEncoding( QTextStream::Latin1 ); - //ts.setCodec( QTextCodec::latin1 ); - QString text = ts.read(); - file.close(); - text.replace( QRegExp("\\\\n"), "\n" ); - QString line; - QString we; - QString wt; - int br = 0; - int nbr; - nbr = text.find ( "},", br ); - line = text.mid( br, nbr - br ); - br = nbr+1; - int se, ee, st, et; - mLocaleDict = new QDict<QString>; - QString end = "{ \"\",\"\" }"; - while ( (line != end) && (br > 1) ) { - //qDebug("%d *%s* ", br, line.latin1()); - se = line.find("\"")+1; - et = line.findRev("\"",-1); - ee = line.find("\",\""); - st = ee+3; - we = line.mid( se, ee-se ); - wt = line.mid( st, et-st ); - //qDebug("*%s* *%s* ", we.latin1(), wt.latin1()); - mLocaleDict->insert( we, new QString (wt) ); - nbr = text.find ( "}", br ); - line = text.mid( br, nbr - br ); - br = nbr+1; - } - //qDebug("end *%s* ", end.latin1()); - - setLocaleDict( mLocaleDict ); - } else { - qDebug("KO: Cannot find translation file %s",fileName.latin1() ); - } - - } - } - config()->setGroup("General"); - - mCustomCategories = config()->readListEntry("Custom Categories"); - if ( KOPrefs::instance()->mLanguageChanged ) { - mLocationDefaults.clear(); - mEventSummaryUser.clear(); - mTodoSummaryUser.clear(); - } - if (mLocationDefaults.isEmpty()) { - mLocationDefaults << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") - << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") - << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; - // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") - mLocationDefaults.sort(); - } - if (mEventSummaryUser.isEmpty()) { - mEventSummaryUser = getDefaultList() ; - } - if (mTodoSummaryUser.isEmpty()) { - mTodoSummaryUser = getDefaultList() ; - } - - if (mCustomCategories.isEmpty()) setCategoryDefaults(); - - config()->setGroup("Personal Settings"); - mName = config()->readEntry("user_name",""); - mEmail = config()->readEntry("user_email",""); - fillMailDefaults(); - - config()->setGroup("Category Colors"); - QStringList::Iterator it; - for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { - setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); - - } - - if (mTimeZoneId.isEmpty()) { - setTimeZoneIdDefault(); - } -#endif KPimPrefs::usrReadConfig(); } void KOPrefs::usrWriteConfig() { -#if 0 - config()->setGroup("General"); - config()->writeEntry("Custom Categories",mCustomCategories); - - config()->setGroup("Personal Settings"); - config()->writeEntry("user_name",mName); - config()->writeEntry("user_email",mEmail); - - config()->setGroup("Category Colors"); - QDictIterator<QColor> it(mCategoryColors); - while (it.current()) { - config()->writeEntry(it.currentKey(),*(it.current())); - ++it; - } -#endif KPimPrefs::usrWriteConfig(); } KConfig* KOPrefs::getConfig() { return config(); } diff --git a/korganizer/main.cpp b/korganizer/main.cpp index 7f9b5c6..16186c0 100644 --- a/korganizer/main.cpp +++ b/korganizer/main.cpp @@ -1,102 +1,108 @@ #ifndef DESKTOP_VERSION #include <qpe/qpeapplication.h> +#include <qcopchannel_qws.h> #include <qpe/global.h> #include <stdlib.h> #else #include <qapplication.h> #include <qstring.h> #include <qwindowsstyle.h> #include <qplatinumstyle.h> #include <qsgistyle.h> #endif #include <qdir.h> #include <kstandarddirs.h> #include <kglobal.h> #include <stdio.h> #include "mainwindow.h" int main( int argc, char **argv ) { #ifndef DESKTOP_VERSION QPEApplication a( argc, argv ); a.setKeepRunning (); #else QApplication a( argc, argv ); QApplication::setStyle( new QPlatinumStyle ()); QString hdir = QDir::homeDirPath(); // there is a bug when creating dirs for WIN 98 // it is difficult to fix, because we have no WIN 98 runnung // such that we try it to create the dirs at startup here if ( hdir == "C:\\" ) { // win 98 or ME QDir app_dir; if ( !app_dir.exists("C:\\kdepim") ) app_dir.mkdir ("C:\\kdepim"); if ( !app_dir.exists("C:\\kdepim\\apps") ) app_dir.mkdir ("C:\\kdepim\\apps"); if ( !app_dir.exists("C:\\kdepim\\config") ) app_dir.mkdir ("C:\\kdepim\\config"); if ( !app_dir.exists("C:\\kdepim\\apps\\korganizer") ) app_dir.mkdir ("C:\\kdepim\\apps\\korganizer"); } #endif bool exitHelp = false; if ( argc > 1 ) { QString command = argv[1]; if ( command == "-help" ){ printf("KO/Pi command line commands:\n"); printf(" no command: Start KO/Pi in usual way\n"); printf(" -help: This output\n"); printf("Next Option: Open or Show after start:\n"); printf(" -newTodo: New Todo dialog\n"); printf(" -newEvent: New Event dialog\n"); printf(" -showList: List view\n"); printf(" -showDay: Day view\n"); printf(" -showWWeek: Work Week view\n"); printf(" -showWeek: Week view\n"); printf(" -showTodo: Todo view\n"); printf(" -showJournal: Journal view\n"); printf(" -showKO: Next Days view\n"); printf(" -showWNext: What's Next view\n"); printf(" -showNextXView: Next X View\n"); printf(" -new[Y] and -show[X] may be used togehther\n"); printf(" KO/Pi is exiting now. Bye!\n"); exitHelp = true; } } if ( ! exitHelp ) { KGlobal::setAppName( "korganizer" ); QString fileName ; #ifndef DESKTOP_VERSION fileName = getenv("QPEDIR"); KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/korganizer/"); #else fileName = qApp->applicationDirPath () + "/kdepim/korganizer/"; KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); #endif KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "korganizer"))); MainWindow m; #ifndef DESKTOP_VERSION + QCopChannel* c1 = new QCopChannel("QPE/Application/datebook",&m, "channel" ) ; + QObject::connect( c1, SIGNAL (received ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& ))); QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& ))); a.showMainWidget(&m ); #else a.setMainWidget(&m ); m.show(); //m.resize( 800, 600 ); QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); #endif if ( argc > 1 ) { QCString command = argv[1]; if ( argc > 2 ) command += argv[2]; qApp->processEvents(); m.recieve(command, QByteArray() ); } a.exec(); +#ifndef DESKTOP_VERSION + delete c1; +#endif } qDebug("KO: Bye! "); } diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 2d17986..3c16458 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -37,345 +37,342 @@ #endif #include <libkcal/calendarlocal.h> #include <libkcal/todo.h> #include <libkcal/phoneformat.h> #include <libkdepim/ksyncprofile.h> #include <libkdepim/phoneaccess.h> #include <libkcal/kincidenceformatter.h> #include <libkdepim/kpimglobalprefs.h> #include "calendarview.h" #include "koviewmanager.h" #include "datenavigator.h" #include "koagendaview.h" #include "koagenda.h" #include "kodialogmanager.h" #include "kdialogbase.h" #include "kapplication.h" #include "kofilterview.h" #include "kstandarddirs.h" #include "koprefs.h" #include "kfiledialog.h" #include "koglobals.h" #include "kglobal.h" #include "klocale.h" #include "kconfig.h" #include "simplealarmclient.h" #include "externalapphandler.h" using namespace KCal; #ifndef _WIN32_ #include <unistd.h> #else #include "koimportoldialog.h" #endif #include "mainwindow.h" class KOex2phonePrefs : public QDialog { public: KOex2phonePrefs( 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 ); mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); mWriteBackFuture->setChecked( true ); lay->addWidget( mWriteBackFuture ); temphb = new QHBox( this ); new QLabel( i18n("Max. weeks in future: ") , temphb ); mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); mWriteBackFutureWeeks->setValue( 8 ); lay->addWidget( temphb ); lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar 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* mWriteBackFuture; QSpinBox* mWriteBackFutureWeeks; }; int globalFlagBlockStartup; MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : QMainWindow( parent, name ) { #ifdef DESKTOP_VERSION setFont( QFont("Arial"), 14 ); #endif - mServerSocket = 0; mClosed = false; //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; QString confFile = locateLocal("config","korganizerrc"); QFileInfo finf ( confFile ); bool showWarning = !finf.exists(); setIcon(SmallIcon( "ko24" ) ); mBlockAtStartup = true; mFlagKeyPressed = false; setCaption("KOrganizer/Pi"); KOPrefs *p = KOPrefs::instance(); KPimGlobalPrefs::instance()->setGlobalConfig(); if ( p->mHourSize > 18 ) p->mHourSize = 18; QMainWindow::ToolBarDock tbd; if ( p->mToolBarHor ) { if ( p->mToolBarUp ) tbd = Bottom; else tbd = Top; } else { if ( p->mToolBarUp ) tbd = Right; else tbd = Left; } if ( KOPrefs::instance()->mUseAppColors ) QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); globalFlagBlockStartup = 1; iconToolBar = new QPEToolBar( this ); addToolBar (iconToolBar , tbd ); mCalendarModifiedFlag = false; QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); splash->setAlignment ( AlignCenter ); setCentralWidget( splash ); #ifndef DESKTOP_VERSION showMaximized(); #endif //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); setDefaultPreferences(); mCalendar = new CalendarLocal(); mView = new CalendarView( mCalendar, this,"mCalendar " ); mView->hide(); //mView->resize(splash->size() ); initActions(); mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); mSyncManager->setBlockSave(false); mView->setSyncManager(mSyncManager); #ifndef DESKTOP_VERSION iconToolBar->show(); qApp->processEvents(); #endif //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); int vh = height() ; int vw = width(); //qDebug("Toolbar hei %d ",iconToolBar->height() ); if ( iconToolBar->orientation () == Qt:: Horizontal ) { vh -= iconToolBar->height(); } else { vw -= iconToolBar->height(); } //mView->setMaximumSize( splash->size() ); //mView->resize( splash->size() ); //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); mView->readSettings(); bool newFile = false; if( !QFile::exists( defaultFileName() ) ) { QFileInfo finfo ( defaultFileName() ); QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); qDebug("oldfile %s ", oldFile.latin1()); QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; finfo.setFile( oldFile ); if (finfo.exists() ) { KMessageBox::information( this, message); mView->openCalendar( oldFile ); qApp->processEvents(); } else { oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); finfo.setFile( oldFile ); if (finfo.exists() ) { KMessageBox::information( this, message); mView->openCalendar( oldFile ); qApp->processEvents(); } } mView->saveCalendar( defaultFileName() ); newFile = true; } QTime neededSaveTime = QDateTime::currentDateTime().time(); mView->openCalendar( defaultFileName() ); int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); qDebug("KO: Calendar loading time: %d ms",msNeeded ); if ( KOPrefs::instance()->mLanguageChanged ) { KOPrefs::instance()->setCategoryDefaults(); int count = mView->addCategories(); KOPrefs::instance()->mLanguageChanged = false; } processIncidenceSelection( 0 ); connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), SLOT( processIncidenceSelection( Incidence * ) ) ); connect( mView, SIGNAL( modifiedChanged( bool ) ), SLOT( slotModifiedChanged( bool ) ) ); connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); mView->setModified( false ); mBlockAtStartup = false; mView->setModified( false ); setCentralWidget( mView ); globalFlagBlockStartup = 0; mView->show(); delete splash; if ( newFile ) mView->updateConfig(); // qApp->processEvents(); //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); //fillSyncMenu(); connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); mSyncManager->setDefaultFileName( defaultFileName()); connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); mSyncManager->fillSyncMenu(); mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); if ( showWarning ) { KMessageBox::information( this, "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); qApp->processEvents(); mView->dialogManager()->showSyncOptions(); } //US listen for result adressed from Ka/Pi #ifndef DESKTOP_VERSION connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); #endif } MainWindow::~MainWindow() { //qDebug("MainWindow::~MainWindow() "); //save toolbar location - delete mServerSocket; delete mCalendar; - delete KOPrefs::instance(); - delete KIncidenceFormatter::instance(); + delete mSyncManager; } void MainWindow::showMaximized () { #ifndef DESKTOP_VERSION if ( ! globalFlagBlockStartup ) if ( mClosed ) mView->goToday(); #endif QWidget::showMaximized () ; mClosed = false; } void MainWindow::closeEvent( QCloseEvent* ce ) { if ( ! KOPrefs::instance()->mAskForQuit ) { saveOnClose(); mClosed = true; ce->accept(); return; } switch( QMessageBox::information( this, "KO/Pi", i18n("Do you really want\nto close KO/Pi?"), i18n("Close"), i18n("No"), 0, 0 ) ) { case 0: saveOnClose(); mClosed = true; ce->accept(); break; case 1: ce->ignore(); break; case 2: default: break; } } void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) { QDataStream stream( data, IO_ReadOnly ); // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); //QString datamess; //qDebug("message "); qDebug("KO: QCOP message received: %s ", cmsg.data() ); if ( cmsg == "-writeFile" ) { // I made from the "-writeFile" an "-writeAlarm" mView->viewManager()->showWhatsNextView(); mCalendar->checkAlarmForIncidence( 0, true); showMaximized(); raise(); return; } if ( cmsg == "-writeFile" ) { // I made from the "-writeFile" an "-writeAlarm" mView->viewManager()->showWhatsNextView(); mCalendar->checkAlarmForIncidence( 0, true); showMaximized(); raise(); return; } if ( cmsg == "-writeFileSilent" ) { // I made from the "-writeFile" an "-writeAlarm" // mView->viewManager()->showWhatsNextView(); mCalendar->checkAlarmForIncidence( 0, true); //showMaximized(); //raise(); hide(); return; } if ( cmsg == "-newCountdown" ) { qDebug("newCountdown "); } QString msg ; QString allmsg = cmsg; while ( allmsg.length() > 0 ) { int nextC = allmsg.find( "-", 1 ); if ( nextC == -1 ) { msg = allmsg; allmsg = ""; } else{ msg = allmsg.left( nextC ); allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); @@ -389,193 +386,192 @@ void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) } if ( msg == "-showWN" ) { mView->viewManager()->showWhatsNextView(); } if ( msg == "-showTodo" ) { mView->viewManager()->showTodoView(); } if ( msg == "-showList" ) { mView->viewManager()->showListView(); } else if ( msg == "-showDay" ) { mView->viewManager()->showDayView(); } else if ( msg == "-showWWeek" ) { mView->viewManager()->showWorkWeekView(); } else if ( msg == "-ringSync" ) { mSyncManager->multiSync( false ); } else if ( msg == "-showWeek" ) { mView->viewManager()->showWeekView(); } else if ( msg == "-showTodo" ) { mView->viewManager()->showTodoView(); } else if ( msg == "-showJournal" ) { mView->dateNavigator()->selectDates( 1 ); mView->dateNavigator()->selectToday(); mView->viewManager()->showJournalView(); } else if ( msg == "-showKO" ) { mView->viewManager()->showNextXView(); } else if ( msg == "-showWNext" || msg == "nextView()" ) { mView->viewManager()->showWhatsNextView(); } else if ( msg == "-showNextXView" ) { mView->viewManager()->showNextXView(); } } showMaximized(); raise(); } QPixmap MainWindow::loadPixmap( QString name ) { return SmallIcon( name ); } void MainWindow::initActions() { //KOPrefs::instance()->mShowFullMenu iconToolBar->clear(); KOPrefs *p = KOPrefs::instance(); //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); QPopupMenu *viewMenu = new QPopupMenu( this ); QPopupMenu *actionMenu = new QPopupMenu( this ); QPopupMenu *importMenu = new QPopupMenu( this ); selectFilterMenu = new QPopupMenu( this ); selectFilterMenu->setCheckable( true ); syncMenu = new QPopupMenu( this ); configureAgendaMenu = new QPopupMenu( this ); configureToolBarMenu = new QPopupMenu( this ); QPopupMenu *helpMenu = new QPopupMenu( this ); if ( KOPrefs::instance()->mShowFullMenu ) { QMenuBar *menuBar1; menuBar1 = menuBar(); menuBar1->insertItem( i18n("File"), importMenu ); menuBar1->insertItem( i18n("View"), viewMenu ); menuBar1->insertItem( i18n("Actions"), actionMenu ); menuBar1->insertItem( i18n("Synchronize"), syncMenu ); menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); menuBar1->insertItem( i18n("Help"), helpMenu ); } else { QPEMenuBar *menuBar1; menuBar1 = new QPEMenuBar( iconToolBar ); QPopupMenu *menuBar = new QPopupMenu( this ); menuBar1->insertItem( i18n("ME"), menuBar); menuBar->insertItem( i18n("File"), importMenu ); menuBar->insertItem( i18n("View"), viewMenu ); menuBar->insertItem( i18n("Actions"), actionMenu ); menuBar->insertItem( i18n("Synchronize"), syncMenu ); menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); menuBar->insertItem( i18n("Filter"),selectFilterMenu ); menuBar->insertItem( i18n("Help"), helpMenu ); //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); menuBar1->setMaximumSize( menuBar1->sizeHint( )); } - connect ( syncMenu, SIGNAL( activated ( int ) ), this, SLOT (slotSyncMenu( int ) ) ); connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) ); // ****************** QAction *action; QIconSet icon; // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); configureToolBarMenu->setCheckable( true ); QString pathString = ""; if ( !p->mToolBarMiniIcons ) { if ( QApplication::desktop()->width() < 480 ) pathString += "icons16/"; } else pathString += "iconsmini/"; configureAgendaMenu->setCheckable( true ); configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 ); configureAgendaMenu->insertSeparator(); configureAgendaMenu->insertItem(i18n("Tiny"), 4 ); configureAgendaMenu->insertItem(i18n("Small"), 6 ); configureAgendaMenu->insertItem(i18n("Medium"), 8 ); configureAgendaMenu->insertItem(i18n("Normal"), 10 ); configureAgendaMenu->insertItem(i18n("Large"), 12 ); configureAgendaMenu->insertItem(i18n("Big"), 14 ); configureAgendaMenu->insertItem(i18n("Bigger"), 16 ); configureAgendaMenu->insertItem(i18n("Biggest"), 18 ); //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); icon = loadPixmap( pathString + "configure" ); action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); action->addTo( actionMenu ); connect( action, SIGNAL( activated() ), mView, SLOT( edit_options() ) ); actionMenu->insertSeparator(); icon = loadPixmap( pathString + "newevent" ); configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); configureToolBarMenu->insertSeparator(); configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); ne_action->addTo( actionMenu ); connect( ne_action, SIGNAL( activated() ), mView, SLOT( newEvent() ) ); icon = loadPixmap( pathString + "newtodo" ); configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); nt_action->addTo( actionMenu ); connect( nt_action, SIGNAL( activated() ), mView, SLOT( newTodo() ) ); icon = loadPixmap( pathString + "navi" ); action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); action->addTo( viewMenu ); connect( action, SIGNAL( activated() ), mView, SLOT( toggleDateNavigatorWidget() ) ); icon = loadPixmap( pathString + "filter" ); action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); action->addTo( viewMenu ); connect( action, SIGNAL( activated() ), mView, SLOT( toggleFilter() ) ); viewMenu->insertSeparator(); icon = loadPixmap( pathString + "picker" ); action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); action->addTo( viewMenu ); connect( action, SIGNAL( activated() ), mView, SLOT( showDatePicker() ) ); action->addTo( iconToolBar ); viewMenu->insertSeparator(); icon = loadPixmap( pathString + "list" ); configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); showlist_action->addTo( viewMenu ); connect( showlist_action, SIGNAL( activated() ), mView->viewManager(), SLOT( showListView() ) ); icon = loadPixmap( pathString + "day" ); configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); day1_action->addTo( viewMenu ); // action->addTo( toolBar ); connect( day1_action, SIGNAL( activated() ), mView->viewManager(), SLOT( showDayView() ) ); icon = loadPixmap( pathString + "workweek" ); configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); day5_action->addTo( viewMenu ); connect( day5_action, SIGNAL( activated() ), mView->viewManager(), SLOT( showWorkWeekView() ) ); icon = loadPixmap( pathString + "week" ); configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); day7_action->addTo( viewMenu ); connect( day7_action, SIGNAL( activated() ), diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h index ee7bd87..e3383ed 100644 --- a/korganizer/mainwindow.h +++ b/korganizer/mainwindow.h @@ -1,130 +1,128 @@ #ifndef KORGE_MAINWINDOW_H #define KORGE_MAINWINDOW_H #include <qmainwindow.h> #include <qtimer.h> #include <qdict.h> #include <qfile.h> #include <qtextstream.h> #include <qregexp.h> #include <libkcal/incidence.h> #include "simplealarmclient.h" #include <ksyncmanager.h> class QAction; class CalendarView; class KSyncProfile; #ifdef DESKTOP_VERSION #define QPEToolBar QToolBar #define QPEMenuBar QMenuBar #endif class QPEToolBar; namespace KCal { class CalendarLocal; } using namespace KCal; class MainWindow : public QMainWindow { Q_OBJECT public: MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); ~MainWindow(); public slots: virtual void showMaximized (); void configureAgenda( int ); void recieve( const QCString& msg, const QByteArray& data ); static QString defaultFileName(); static QString syncFileName(); static QString resourcePath(); protected slots: void setCaptionToDates(); void about(); void licence(); void faq(); void usertrans(); void features(); void synchowto(); void whatsNew(); void keyBindings(); void aboutAutoSaving();; void aboutKnownBugs(); void processIncidenceSelection( Incidence * ); void importQtopia(); void importBday(); void importOL(); void importIcal(); void importFile( QString, bool ); void quickImportIcal(); void slotModifiedChanged( bool ); void save(); void configureToolBar( int ); void printSel(); void printCal(); void saveCalendar(); void loadCalendar(); void exportVCalendar(); void fillFilterMenu(); void selectFilter( int ); void exportToPhone( int ); protected: void displayText( QString, QString); void displayFile( QString, QString); void enableIncidenceActions( bool ); private slots: QSocket* piSocket; QString piFileString; QTime piTime; void getFile( bool ); void syncFileRequest(); private: KSyncManager* mSyncManager; - //QTimer* mTimerCommandSocket; - KServerSocket * mServerSocket; bool mClosed; void saveOnClose(); bool mFlagKeyPressed; bool mBlockAtStartup; QPEToolBar *iconToolBar; void initActions(); void setDefaultPreferences(); void keyPressEvent ( QKeyEvent * ) ; void keyReleaseEvent ( QKeyEvent * ) ; QPopupMenu *configureToolBarMenu; QPopupMenu *selectFilterMenu; QPopupMenu *configureAgendaMenu, *syncMenu; CalendarLocal *mCalendar; CalendarView *mView; QAction *mNewSubTodoAction; QAction *mShowAction; QAction *mEditAction; QAction *mDeleteAction; QAction *mCloneAction; QAction *mMoveAction; QAction *mBeamAction; QAction *mCancelAction; void closeEvent( QCloseEvent* ce ); SimpleAlarmClient mAlarmClient; QTimer mSaveTimer; //bool mBlockSaveFlag; bool mCalendarModifiedFlag; QPixmap loadPixmap( QString ); }; #endif diff --git a/libkdepim/kpimglobalprefs.cpp b/libkdepim/kpimglobalprefs.cpp index b71e18d..5081b26 100644 --- a/libkdepim/kpimglobalprefs.cpp +++ b/libkdepim/kpimglobalprefs.cpp @@ -1,140 +1,138 @@ /* This file is part of libkdepim. Copyright (c) 2002 Cornelius Schumacher <schumacher@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 <kglobal.h> #include <kconfig.h> #include <klocale.h> #include <kdebug.h> #include <kstaticdeleter.h> #include <qregexp.h> #include "kpimglobalprefs.h" KPimGlobalPrefs *KPimGlobalPrefs::sInstance = 0; static KStaticDeleter<KPimGlobalPrefs> staticDeleter; KPimGlobalPrefs::KPimGlobalPrefs( const QString &name ) : KPrefs("microkdeglobalrc") { KPrefs::setCurrentGroup("Locale"); addItemInt("PreferredLanguage",&mPreferredLanguage,0); addItemInt("PreferredTime",&mPreferredTime,0); addItemInt("PreferredDate",&mPreferredDate,0); addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false); //addItemBool("QuickSavingWOUnicode",&mUseQuicksave,false); // 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() { + //qDebug("KPimGlobalPrefs::~KPimGlobalPrefs() "); + writeConfig(); } KPimGlobalPrefs *KPimGlobalPrefs::instance() { if ( !sInstance ) { sInstance = staticDeleter.setObject( new KPimGlobalPrefs() ); sInstance->readConfig(); } return sInstance; } diff --git a/microkde/kstaticdeleter.h b/microkde/kstaticdeleter.h index 190f3e4..dfd3929 100644 --- a/microkde/kstaticdeleter.h +++ b/microkde/kstaticdeleter.h @@ -1,35 +1,37 @@ /* * This file is part of the KDE Libraries * Copyright (C) 2000 Stephan Kulow <coolo@kde.org> * 2001 KDE Team * * 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 _KSTATIC_DELETER_H_ #define _KSTATIC_DELETER_H_ template<class type> class KStaticDeleter { public: KStaticDeleter() {}; - type *setObject( type *obj, bool isArray = false) { return obj; } - virtual ~KStaticDeleter() {}; + type *setObject( type *obj, bool isArray = false) { _mobj = obj;return obj; } + virtual ~KStaticDeleter() {delete _mobj;}; + private: + type* _mobj; }; #endif |