author | zautrix <zautrix> | 2004-09-17 00:05:23 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-17 00:05:23 (UTC) |
commit | 8462751df135b9ad08b1269661d2c7eb18c67976 (patch) (side-by-side diff) | |
tree | 1c40fa2638f9f22df2d96b0879acfd20a9c2c502 /korganizer | |
parent | eebe4409884ccd4dedb7cb697a800f74b33eb292 (diff) | |
download | kdepimpi-8462751df135b9ad08b1269661d2c7eb18c67976.zip kdepimpi-8462751df135b9ad08b1269661d2c7eb18c67976.tar.gz kdepimpi-8462751df135b9ad08b1269661d2c7eb18c67976.tar.bz2 |
Rearranged linking
-rw-r--r-- | korganizer/calendarview.cpp | 4 | ||||
-rw-r--r-- | korganizer/incomingdialog.cpp | 3 | ||||
-rw-r--r-- | korganizer/korganizerE.pro | 4 | ||||
-rw-r--r-- | korganizer/publishdialog.cpp | 3 |
4 files changed, 10 insertions, 4 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 369c7a0..56b3fb0 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -945,811 +945,813 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int local->resetTempSyncStat(); mLastCalendarSync = QDateTime::currentDateTime(); QDateTime modifiedCalendar = mLastCalendarSync;; eventLSync = getLastSyncEvent(); eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); if ( eventR ) { eventRSync = (Event*) eventR->clone(); remote->deleteEvent(eventR ); } else { if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { eventRSync = (Event*)eventLSync->clone(); } else { fullDateRange = true; eventRSync = new Event(); eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); eventRSync->setUid("last-syncEvent-"+mCurrentSyncName ); eventRSync->setDtStart( mLastCalendarSync ); eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); eventRSync->setCategories( i18n("SyncEvent") ); } } if ( eventLSync->dtStart() == mLastCalendarSync ) fullDateRange = true; if ( ! fullDateRange ) { if ( eventLSync->dtStart() != eventRSync->dtStart() ) { // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); fullDateRange = true; } } if ( fullDateRange ) mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); else mLastCalendarSync = eventLSync->dtStart(); // for resyncing if own file has changed if ( mCurrentSyncDevice == "deleteaftersync" ) { mLastCalendarSync = loadedFileVersion; qDebug("setting mLastCalendarSync "); } //qDebug("*************************** "); qDebug("mLastCalendarSync %s ",mLastCalendarSync.toString().latin1() ); QPtrList<Incidence> er = remote->rawIncidences(); Incidence* inR = er.first(); Incidence* inL; QProgressBar bar( er.count(),0 ); bar.setCaption (i18n("Syncing - close to abort!") ); int w = 300; if ( QApplication::desktop()->width() < 320 ) w = 220; int h = bar.sizeHint().height() ; int dw = QApplication::desktop()->width(); int dh = QApplication::desktop()->height(); bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); bar.show(); int modulo = (er.count()/10)+1; int incCounter = 0; while ( inR ) { if ( ! bar.isVisible() ) return false; if ( incCounter % modulo == 0 ) bar.setProgress( incCounter ); ++incCounter; uid = inR->uid(); bool skipIncidence = false; if ( uid.left(15) == QString("last-syncEvent-") ) skipIncidence = true; QString idS; qApp->processEvents(); if ( !skipIncidence ) { inL = local->incidence( uid ); if ( inL ) { // maybe conflict - same uid in both calendars int maxrev = inL->revision(); if ( maxrev < inR->revision() ) maxrev = inR->revision(); if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { //qDebug("take %d %s ", take, inL->summary().latin1()); if ( take == 3 ) return false; if ( take == 1 ) {// take local if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); else idS = inR->IDStr(); remote->deleteIncidence( inR ); if ( inL->revision() < maxrev ) inL->setRevision( maxrev ); inR = inL->clone(); inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) inR->setIDStr( idS ); remote->addIncidence( inR ); ++changedRemote; } else { if ( inR->revision() < maxrev ) inR->setRevision( maxrev ); idS = inL->IDStr(); local->deleteIncidence( inL ); inL = inR->clone(); inL->setIDStr( idS ); local->addIncidence( inL ); ++changedLocal; } } } else { // no conflict if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { QString des = eventLSync->description(); QString pref = "e"; if ( inR->type() == "Todo" ) pref = "t"; if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); //remote->deleteIncidence( inR ); ++deletedEventR; } else { inR->setLastModified( modifiedCalendar ); inL = inR->clone(); local->addIncidence( inL ); ++addedEvent; } } else { if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { inR->setLastModified( modifiedCalendar ); local->addIncidence( inR->clone() ); ++addedEvent; } else { checkExternSyncEvent(eventRSyncSharp, inR); remote->deleteIncidence( inR ); ++deletedEventR; } } } } inR = er.next(); } QPtrList<Incidence> el = local->rawIncidences(); inL = el.first(); modulo = (el.count()/10)+1; bar.setCaption (i18n("Add / remove events") ); bar.setTotalSteps ( el.count() ) ; bar.show(); incCounter = 0; while ( inL ) { qApp->processEvents(); if ( ! bar.isVisible() ) return false; if ( incCounter % modulo == 0 ) bar.setProgress( incCounter ); ++incCounter; uid = inL->uid(); bool skipIncidence = false; if ( uid.left(15) == QString("last-syncEvent-") ) skipIncidence = true; if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" ) skipIncidence = true; if ( !skipIncidence ) { inR = remote->incidence( uid ); if ( ! inR ) { if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { checkExternSyncEvent(eventLSyncSharp, inL); local->deleteIncidence( inL ); ++deletedEventL; } else { if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { inL->removeID(mCurrentSyncDevice ); ++addedEventR; //qDebug("remote added Incidence %s ", inL->summary().latin1()); inL->setLastModified( modifiedCalendar ); inR = inL->clone(); inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); remote->addIncidence( inR ); } } } else { if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { checkExternSyncEvent(eventLSyncSharp, inL); local->deleteIncidence( inL ); ++deletedEventL; } else { if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { ++addedEventR; inL->setLastModified( modifiedCalendar ); remote->addIncidence( inL->clone() ); } } } } } inL = el.next(); } int delFut = 0; if ( KOPrefs::instance()->mWriteBackInFuture ) { er = remote->rawIncidences(); inR = er.first(); QDateTime dt; QDateTime cur = QDateTime::currentDateTime(); QDateTime end = cur.addSecs( KOPrefs::instance()->mWriteBackInFuture * 3600 *24 *7 ); while ( inR ) { if ( inR->type() == "Todo" ) { Todo * t = (Todo*)inR; if ( t->hasDueDate() ) dt = t->dtDue(); else dt = cur.addSecs( 62 ); } else if (inR->type() == "Event" ) { bool ok; dt = inR->getNextOccurence( cur, &ok ); if ( !ok ) dt = cur.addSecs( -62 ); } else dt = inR->dtStart(); if ( dt < cur || dt > end ) { remote->deleteIncidence( inR ); ++delFut; } inR = er.next(); } } bar.hide(); mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); eventLSync->setReadOnly( false ); eventLSync->setDtStart( mLastCalendarSync ); eventRSync->setDtStart( mLastCalendarSync ); eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); eventLSync->setReadOnly( true ); if ( mGlobalSyncMode == SYNC_MODE_NORMAL) remote->addEvent( eventRSync ); QString mes; mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR ); QString delmess; if ( delFut ) { delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\n"),delFut, KOPrefs::instance()->mWriteBackInFuture ); mes += delmess; } if ( KOPrefs::instance()->mShowSyncSummary ) { KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") ); } qDebug( mes ); mCalendar->checkAlarmForIncidence( 0, true ); return syncOK; } void CalendarView::setSyncDevice( QString s ) { mCurrentSyncDevice= s; } void CalendarView::setSyncName( QString s ) { mCurrentSyncName= s; } bool CalendarView::syncCalendar(QString filename, int mode) { mGlobalSyncMode = SYNC_MODE_NORMAL; CalendarLocal* calendar = new CalendarLocal(); calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); FileStorage* storage = new FileStorage( calendar ); bool syncOK = false; storage->setFileName( filename ); // qDebug("loading ... "); if ( storage->load(KOPrefs::instance()->mUseQuicksave) ) { getEventViewerDialog()->setSyncMode( true ); syncOK = synchronizeCalendar( mCalendar, calendar, mode ); getEventViewerDialog()->setSyncMode( false ); if ( syncOK ) { if ( KOPrefs::instance()->mWriteBackFile ) { storage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); storage->save(); } } setModified( true ); } delete storage; delete calendar; if ( syncOK ) updateView(); return syncOK; } void CalendarView::syncPhone() { syncExternal( 1 ); } void CalendarView::syncExternal( int mode ) { mGlobalSyncMode = SYNC_MODE_EXTERNAL; //mCurrentSyncDevice = "sharp-DTM"; if ( KOPrefs::instance()->mAskForPreferences ) edit_sync_options(); qApp->processEvents(); CalendarLocal* calendar = new CalendarLocal(); calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); bool syncOK = false; bool loadSuccess = false; PhoneFormat* phoneFormat = 0; #ifndef DESKTOP_VERSION SharpFormat* sharpFormat = 0; if ( mode == 0 ) { // sharp sharpFormat = new SharpFormat () ; loadSuccess = sharpFormat->load( calendar, mCalendar ); } else #endif if ( mode == 1 ) { // phone phoneFormat = new PhoneFormat (mCurrentSyncDevice, KOPrefs::instance()->mPhoneDevice, KOPrefs::instance()->mPhoneConnection, KOPrefs::instance()->mPhoneModel); loadSuccess = phoneFormat->load( calendar,mCalendar); } else return; if ( loadSuccess ) { getEventViewerDialog()->setSyncMode( true ); syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs ); getEventViewerDialog()->setSyncMode( false ); qApp->processEvents(); if ( syncOK ) { if ( KOPrefs::instance()->mWriteBackFile ) { QPtrList<Incidence> iL = mCalendar->rawIncidences(); Incidence* inc = iL.first(); if ( phoneFormat ) { while ( inc ) { inc->removeID(mCurrentSyncDevice); inc = iL.next(); } } #ifndef DESKTOP_VERSION if ( sharpFormat ) sharpFormat->save(calendar); #endif if ( phoneFormat ) phoneFormat->save(calendar); iL = calendar->rawIncidences(); inc = iL.first(); Incidence* loc; while ( inc ) { if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { loc = mCalendar->incidence(inc->uid() ); if ( loc ) { loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); } } inc = iL.next(); } Incidence* lse = getLastSyncEvent(); if ( lse ) { lse->setReadOnly( false ); lse->setDescription( "" ); lse->setReadOnly( true ); } } } setModified( true ); } else { QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), question, i18n("Ok")) ; } delete calendar; updateView(); return ;//syncOK; } void CalendarView::syncSharp() { syncExternal( 0 ); } -#include <kabc/stdaddressbook.h> +//#include <kabc/stdaddressbook.h> bool CalendarView::importBday() { +#if 0 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); KABC::AddressBook::Iterator it; int count = 0; for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { ++count; } QProgressBar bar(count,0 ); int w = 300; if ( QApplication::desktop()->width() < 320 ) w = 220; int h = bar.sizeHint().height() ; int dw = QApplication::desktop()->width(); int dh = QApplication::desktop()->height(); bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); bar.show(); bar.setCaption (i18n("Reading addressbook - close to abort!") ); qApp->processEvents(); count = 0; int addCount = 0; KCal::Attendee* a = 0; for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { if ( ! bar.isVisible() ) return false; bar.setProgress( count++ ); qApp->processEvents(); //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); if ( (*it).birthday().date().isValid() ){ a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) ++addCount; } QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); if ( anni.isValid() ){ a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) ++addCount; } } updateView(); topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); +#endif return true; } bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) { //qDebug("addAnni "); Event * ev = new Event(); if ( a ) { ev->addAttendee( a ); } QString kind; if ( birthday ) kind = i18n( "Birthday" ); else kind = i18n( "Anniversary" ); ev->setSummary( name + " - " + kind ); ev->setOrganizer( "nobody@nowhere" ); ev->setCategories( kind ); ev->setDtStart( QDateTime(date) ); ev->setDtEnd( QDateTime(date) ); ev->setFloats( true ); Recurrence * rec = ev->recurrence(); rec->setYearly(Recurrence::rYearlyMonth,1,-1); rec->addYearlyNum( date.month() ); if ( !mCalendar->addAnniversaryNoDup( ev ) ) { delete ev; return false; } return true; } bool CalendarView::importQtopia( const QString &categories, const QString &datebook, const QString &todolist ) { QtopiaFormat qtopiaFormat; qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); updateView(); return true; #if 0 mGlobalSyncMode = SYNC_MODE_QTOPIA; mCurrentSyncDevice = "qtopia-XML"; if ( KOPrefs::instance()->mAskForPreferences ) edit_sync_options(); qApp->processEvents(); CalendarLocal* calendar = new CalendarLocal(); calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); bool syncOK = false; QtopiaFormat qtopiaFormat; qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); bool loadOk = true; if ( !categories.isEmpty() ) loadOk = qtopiaFormat.load( calendar, categories ); if ( loadOk && !datebook.isEmpty() ) loadOk = qtopiaFormat.load( calendar, datebook ); if ( loadOk && !todolist.isEmpty() ) loadOk = qtopiaFormat.load( calendar, todolist ); if ( loadOk ) { getEventViewerDialog()->setSyncMode( true ); syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs ); getEventViewerDialog()->setSyncMode( false ); qApp->processEvents(); if ( syncOK ) { if ( KOPrefs::instance()->mWriteBackFile ) { // write back XML file } setModified( true ); } } else { QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), question, i18n("Ok")) ; } delete calendar; updateView(); return syncOK; #endif } void CalendarView::setSyncEventsReadOnly() { Event * ev; QPtrList<Event> eL = mCalendar->rawEvents(); ev = eL.first(); while ( ev ) { if ( ev->uid().left(15) == QString("last-syncEvent-") ) ev->setReadOnly( true ); ev = eL.next(); } } bool CalendarView::openCalendar(QString filename, bool merge) { if (filename.isEmpty()) { return false; } if (!QFile::exists(filename)) { KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); return false; } globalFlagBlockAgenda = 1; if (!merge) mCalendar->close(); mStorage->setFileName( filename ); if ( mStorage->load(KOPrefs::instance()->mUseQuicksave) ) { if ( merge ) ;//setModified( true ); else { //setModified( true ); mViewManager->setDocumentId( filename ); mDialogManager->setDocumentId( filename ); mTodoList->setDocumentId( filename ); } globalFlagBlockAgenda = 2; // if ( getLastSyncEvent() ) // getLastSyncEvent()->setReadOnly( true ); mCalendar->reInitAlarmSettings(); setSyncEventsReadOnly(); updateUnmanagedViews(); updateView(); if ( filename != MainWindow::defaultFileName() ) saveCalendar( MainWindow::defaultFileName() ); loadedFileVersion = QDateTime::currentDateTime(); return true; } else { // while failing to load, the calendar object could // have become partially populated. Clear it out. if ( !merge ) mCalendar->close(); KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); globalFlagBlockAgenda = 2; updateView(); } return false; } void CalendarView::setLoadedFileVersion(QDateTime dt) { loadedFileVersion = dt; } bool CalendarView::checkFileChanged(QString fn) { QFileInfo finf ( fn ); if ( !finf.exists() ) return true; QDateTime dt = finf.lastModified (); if ( dt <= loadedFileVersion ) return false; return true; } bool CalendarView::checkFileVersion(QString fn) { QFileInfo finf ( fn ); if ( !finf.exists() ) return true; QDateTime dt = finf.lastModified (); //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); //qDebug("file on disk version %s",dt.toString().latin1()); if ( dt <= loadedFileVersion ) return true; int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, false)) , i18n("KO/Pi Warning"),i18n("Overwrite"), i18n("Sync+save")); if ( km == KMessageBox::Cancel ) return false; if ( km == KMessageBox::Yes ) return true; setSyncDevice("deleteaftersync" ); KOPrefs::instance()->mAskForPreferences = true; KOPrefs::instance()->mSyncAlgoPrefs = 3; KOPrefs::instance()->mWriteBackFile = false; KOPrefs::instance()->mWriteBackExistingOnly = false; KOPrefs::instance()->mShowSyncSummary = false; syncCalendar( fn, 3 ); Event * e = getLastSyncEvent(); mCalendar->deleteEvent ( e ); updateView(); return true; } bool CalendarView::saveCalendar( QString filename ) { // Store back all unsaved data into calendar object // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); if ( mViewManager->currentView() ) mViewManager->currentView()->flushView(); //mStorage->setFileName( filename ); mStorage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); mStorage->setFileName( filename ); bool success; success = mStorage->save(); if ( !success ) { return false; } return true; } void CalendarView::closeCalendar() { // child windows no longer valid emit closingDown(); mCalendar->close(); setModified(false); updateView(); } void CalendarView::archiveCalendar() { mDialogManager->showArchiveDialog(); } void CalendarView::readSettings() { // mViewManager->showAgendaView(); QString str; //qDebug("CalendarView::readSettings() "); // read settings from the KConfig, supplying reasonable // defaults where none are to be found KConfig *config = KOGlobals::config(); #ifndef KORG_NOSPLITTER config->setGroup("KOrganizer Geometry"); QValueList<int> sizes = config->readIntListEntry("Separator1"); if (sizes.count() != 2) { sizes << mDateNavigator->minimumSizeHint().width(); sizes << 300; } mPanner->setSizes(sizes); sizes = config->readIntListEntry("Separator2"); if ( ( mResourceView && sizes.count() == 4 ) || ( !mResourceView && sizes.count() == 3 ) ) { mLeftSplitter->setSizes(sizes); } #endif globalFlagBlockAgenda = 1; mViewManager->showAgendaView(); //mViewManager->readSettings( config ); mTodoList->restoreLayout(config,QString("Todo Layout")); readFilterSettings(config); config->setGroup( "Views" ); int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); if ( dateCount == 5 ) mNavigator->selectWorkWeek(); else if ( dateCount == 7 ) mNavigator->selectWeek(); else mNavigator->selectDates( dateCount ); // mViewManager->readSettings( config ); updateConfig(); globalFlagBlockAgenda = 2; mViewManager->readSettings( config ); #ifdef DESKTOP_VERSION config->setGroup("WidgetLayout"); QStringList list; list = config->readListEntry("MainLayout"); int x,y,w,h; if ( ! list.isEmpty() ) { x = list[0].toInt(); y = list[1].toInt(); w = list[2].toInt(); h = list[3].toInt(); topLevelWidget()->setGeometry(x,y,w,h); } else { topLevelWidget()->setGeometry( 40 ,40 , 640, 440); } list = config->readListEntry("EditEventLayout"); if ( ! list.isEmpty() ) { x = list[0].toInt(); y = list[1].toInt(); w = list[2].toInt(); h = list[3].toInt(); mEventEditor->setGeometry(x,y,w,h); } list = config->readListEntry("EditTodoLayout"); if ( ! list.isEmpty() ) { x = list[0].toInt(); y = list[1].toInt(); w = list[2].toInt(); h = list[3].toInt(); mTodoEditor->setGeometry(x,y,w,h); } list = config->readListEntry("ViewerLayout"); if ( ! list.isEmpty() ) { x = list[0].toInt(); y = list[1].toInt(); w = list[2].toInt(); h = list[3].toInt(); getEventViewerDialog()->setGeometry(x,y,w,h); } #endif } void CalendarView::writeSettings() { // kdDebug() << "CalendarView::writeSettings" << endl; KConfig *config = KOGlobals::config(); #ifndef KORG_NOSPLITTER config->setGroup("KOrganizer Geometry"); QValueList<int> list = mPanner->sizes(); config->writeEntry("Separator1",list); list = mLeftSplitter->sizes(); config->writeEntry("Separator2",list); #endif mViewManager->writeSettings( config ); mTodoList->saveLayout(config,QString("Todo Layout")); mDialogManager->writeSettings( config ); //KOPrefs::instance()->usrWriteConfig(); KOPrefs::instance()->writeConfig(); writeFilterSettings(config); config->setGroup( "Views" ); config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); #ifdef DESKTOP_VERSION config->setGroup("WidgetLayout"); QStringList list ;//= config->readListEntry("MainLayout"); int x,y,w,h; QWidget* wid; wid = topLevelWidget(); x = wid->geometry().x(); y = wid->geometry().y(); w = wid->width(); h = wid->height(); list.clear(); list << QString::number( x ); list << QString::number( y ); list << QString::number( w ); list << QString::number( h ); config->writeEntry("MainLayout",list ); wid = mEventEditor; x = wid->geometry().x(); y = wid->geometry().y(); w = wid->width(); h = wid->height(); list.clear(); list << QString::number( x ); list << QString::number( y ); list << QString::number( w ); list << QString::number( h ); config->writeEntry("EditEventLayout",list ); wid = mTodoEditor; x = wid->geometry().x(); y = wid->geometry().y(); w = wid->width(); h = wid->height(); list.clear(); list << QString::number( x ); diff --git a/korganizer/incomingdialog.cpp b/korganizer/incomingdialog.cpp index f3bd09f..50e3077 100644 --- a/korganizer/incomingdialog.cpp +++ b/korganizer/incomingdialog.cpp @@ -1,437 +1,438 @@ /* 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. */ #include <qlistview.h> #include <qfile.h> #include <qdir.h> #include <qmap.h> #include <kglobal.h> #include <klocale.h> #include <kdebug.h> #include <kstandarddirs.h> #include <kmessagebox.h> #include <libkcal/incidence.h> #include <libkcal/event.h> #include <libkcal/calendar.h> #include <libkcal/freebusy.h> #include <libkcal/attendee.h> #include <libkcal/calendarresources.h> #include <libkcal/resourcecalendar.h> #include <kresources/resourceselectdialog.h> #ifndef KORG_NOMAIL #include "mailscheduler.h" #else #include <libkcal/dummyscheduler.h> #endif #include "incomingdialog.h" #include "koeventviewerdialog.h" #include "kocounterdialog.h" #include "koprefs.h" #ifndef KORG_NOKABC -#include <kabc/stdaddressbook.h> +#define KORG_NOKABC +//#include <kabc/stdaddressbook.h> #define size count #endif ScheduleItemIn::ScheduleItemIn(QListView *parent,IncidenceBase *ev, Scheduler::Method method,ScheduleMessage::Status status) : QListViewItem(parent) { mIncidence = ev; mMethod = method; mStatus = status; setText(6,Scheduler::translatedMethodName(mMethod)+" "); setText(7,ScheduleMessage::statusName(status)); } /* Visitor */ ScheduleItemVisitor::ScheduleItemVisitor(ScheduleItemIn *item) { mItem = item; } ScheduleItemVisitor::~ScheduleItemVisitor() { } bool ScheduleItemVisitor::visit(Event *e) { mItem->setText(0,e->summary()); mItem->setText(1,e->dtStartDateStr()); if (e->doesFloat()) { mItem->setText(2,i18n("no time ")); mItem->setText(4,i18n("no time ")); } else { mItem->setText(2,e->dtStartTimeStr()); mItem->setText(4,e->dtEndTimeStr()); } if (e->hasEndDate()) { mItem->setText(3,e->dtEndDateStr()); } else { mItem->setText(3,""); } mItem->setText(5,e->organizer()+" "); return true; } bool ScheduleItemVisitor::visit(Todo *e) { mItem->setText(0,e->summary()); if (e->hasStartDate()) { mItem->setText(1,e->dtStartDateStr()); if (!e->doesFloat()) { mItem->setText(2,e->dtStartTimeStr()); } } if (e->hasDueDate()) { mItem->setText(1,e->dtDueDateStr()); if (!e->doesFloat()) { mItem->setText(2,e->dtDueTimeStr()); } } mItem->setText(5,e->organizer()+" "); return true; } bool ScheduleItemVisitor::visit(Journal *) { return false; } /* * Constructs a IncomingDialog which is a child of 'parent', with the * name 'name' and widget flags set to 'f' * * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */ IncomingDialog::IncomingDialog(Calendar *calendar,OutgoingDialog *outgoing, QWidget* parent,const char* name,bool modal,WFlags fl) : IncomingDialog_base(parent,name,modal,fl) { mCalendar = calendar; mOutgoing = outgoing; #ifndef KORG_NOMAIL mScheduler = new MailScheduler(mCalendar); #else mScheduler = new DummyScheduler(mCalendar); #endif mMessageListView->setColumnAlignment(1,AlignHCenter); mMessageListView->setColumnAlignment(2,AlignHCenter); mMessageListView->setColumnAlignment(3,AlignHCenter); mMessageListView->setColumnAlignment(4,AlignHCenter); QObject::connect(mMessageListView,SIGNAL(doubleClicked(QListViewItem *)), this,SLOT(showEvent(QListViewItem *))); retrieve(); } /* * Destroys the object and frees any allocated resources */ IncomingDialog::~IncomingDialog() { // no need to delete child widgets, Qt does it all for us } void IncomingDialog::setOutgoingDialog(OutgoingDialog *outgoing) { mOutgoing = outgoing; } void IncomingDialog::retrieve() { QPtrList <ScheduleMessage> messages = mScheduler->retrieveTransactions(); ScheduleMessage *message; for(message = messages.first();message;message = messages.next()) { IncidenceBase *inc = message->event(); Scheduler::Method method = (Scheduler::Method)message->method(); ScheduleMessage::Status status = message->status(); ScheduleItemIn *item = new ScheduleItemIn(mMessageListView,inc,method,status); if(inc->type()!="FreeBusy") { Incidence *incidence = static_cast<Incidence *>(inc); ScheduleItemVisitor v(item); if (!incidence->accept(v)) delete item; } else { FreeBusy *fb = static_cast<FreeBusy *>(item->event()); item->setText(0, "FreeBusy"); item->setText(1, KGlobal::locale()->formatDate( fb->dtStart().date() ) ); item->setText(2, KGlobal::locale()->formatTime( fb->dtStart().time() ) ); item->setText(3, KGlobal::locale()->formatDate( fb->dtEnd().date() ) ); item->setText(4, KGlobal::locale()->formatTime( fb->dtEnd().time() ) ); item->setText(5, fb->organizer()); } automaticAction(item); } emit numMessagesChanged(mMessageListView->childCount()); } void IncomingDialog::acceptAllMessages() { bool success = false; ScheduleItemIn *item = (ScheduleItemIn *)mMessageListView->firstChild(); while(item) { ScheduleItemIn *nextitem = (ScheduleItemIn *)(item->nextSibling()); if (acceptMessage(item)) success = true; item = nextitem; } if (success) emit calendarUpdated(); } void IncomingDialog::acceptMessage() { ScheduleItemIn *item = (ScheduleItemIn *)mMessageListView->selectedItem(); if (item) { if (acceptMessage(item)) emit calendarUpdated(); } } bool IncomingDialog::acceptMessage(ScheduleItemIn *item) { switch (item->method()) { case Scheduler::Refresh: return incomeRefresh(item); break; case Scheduler::Counter: return incomeCounter(item); break; case Scheduler::Declinecounter: return incomeDeclineCounter(item); break; case Scheduler::Add: return incomeAdd(item); break; case Scheduler::Request: return incomeRequest(item); break; default: return incomeDefault(item); } return false; } void IncomingDialog::rejectMessage() { ScheduleItemIn *item = (ScheduleItemIn *)mMessageListView->selectedItem(); if (item) { mScheduler->deleteTransaction(item->event()); delete item; emit numMessagesChanged(mMessageListView->childCount()); } } void IncomingDialog::showEvent(QListViewItem *item) { IncidenceBase *incidence = ((ScheduleItemIn *)item)->event(); if( incidence && incidence->type() == "Event" ) { Event *event = static_cast<Event *>(incidence); KOEventViewerDialog *eventViewer = new KOEventViewerDialog(this); eventViewer->setEvent(event); eventViewer->show(); } } bool IncomingDialog::incomeRefresh(ScheduleItemIn *item) { Event *ev = mCalendar->event(item->event()->uid()); if (ev) { //user interaction before?? Attendee *att; QPtrList<Attendee> attlist = ev->attendees(); for (att=attlist.first(); att; att=attlist.next()) { Event *event = new Event(*ev); mOutgoing->addMessage(event,Scheduler::Request,att->email()); delete(event); } mScheduler->deleteTransaction(item->event()); delete item; emit numMessagesChanged(mMessageListView->childCount()); return true; } mScheduler->deleteTransaction(item->event()); delete item; emit numMessagesChanged(mMessageListView->childCount()); return false; } bool IncomingDialog::incomeCounter(ScheduleItemIn *item) { IncidenceBase *incidence = ((ScheduleItemIn *)item)->event(); // currently only events supportet - attetion at insertion below! if ( incidence->type() != "Event" ) return false; Event *counterEvent = static_cast<Event *>( incidence ); Event *even = mCalendar->event(counterEvent->uid()); KOCounterDialog *eventViewer = new KOCounterDialog(this); eventViewer->addText(i18n("counter proposal event","<b>Counter-event:</b><p>")); eventViewer->addEvent(counterEvent); eventViewer->addText("<hr>"); eventViewer->addText(i18n("<b>Original event:</b><p>")); if (even) eventViewer->addEvent(even); else eventViewer->addText(i18n("A corresponding event is missing in your calendar!")); eventViewer->addText("<hr>"); eventViewer->addText(i18n("If this counter-event is a good proposal for your event, press 'Accept'. All Attendees will then get the new version of this event")); eventViewer->show(); eventViewer->exec(); if (eventViewer->result()) { kdDebug() << "IncomingDialog::Counter:Accept" << endl; int revision = 0; if (even) { revision = even->revision(); mCalendar->deleteEvent(even); } mCalendar->addIncidence(counterEvent); even = mCalendar->event(item->event()->uid()); if (even) { if (revision < even->revision()) even->setRevision(even->revision()+1); else even->setRevision(revision+1); Event *ev = new Event(*even); mOutgoing->addMessage(ev,Scheduler::Request); delete(ev); } mScheduler->deleteTransaction(item->event()); delete item; emit numMessagesChanged(mMessageListView->childCount()); return true; } else { kdDebug() << "IncomingDialog::Counter:Decline" << endl; //the counter-sender's email is missing... //now every attendee gets an declinecounter :-( mOutgoing->addMessage(counterEvent,Scheduler::Declinecounter); delete item; emit numMessagesChanged(mMessageListView->childCount()); mScheduler->deleteTransaction(item->event()); delete item; emit numMessagesChanged(mMessageListView->childCount()); return true; } //mScheduler->deleteTransaction(item->event()); delete item; emit numMessagesChanged(mMessageListView->childCount()); return false; } bool IncomingDialog::incomeDeclineCounter(ScheduleItemIn *item) { Event *even = mCalendar->event(item->event()->uid()); if (even) { mOutgoing->addMessage(even,Scheduler::Refresh); mScheduler->deleteTransaction(item->event()); delete item; emit numMessagesChanged(mMessageListView->childCount()); return true; } mScheduler->deleteTransaction(item->event()); delete item; emit numMessagesChanged(mMessageListView->childCount()); return false; } bool IncomingDialog::incomeAdd(ScheduleItemIn *item) { IncidenceBase *incidence = ((ScheduleItemIn *)item)->event(); if (incidence->type() == "Event" ) { Event *refr = static_cast<Event *>( incidence ); mOutgoing->addMessage(refr,Scheduler::Refresh); mScheduler->deleteTransaction( incidence ); delete item; emit numMessagesChanged(mMessageListView->childCount()); return true; } else { kdDebug() << "IncomingDialog::incomeAdd - only Events are supportet yet" << endl; mScheduler->deleteTransaction( incidence ); delete item; emit numMessagesChanged(mMessageListView->childCount()); return false; } } bool IncomingDialog::incomeDefault(ScheduleItemIn *item) { if (mScheduler->acceptTransaction(item->event(),item->method(),item->status())) { delete item; emit numMessagesChanged(mMessageListView->childCount()); return true; } else { KMessageBox::error(this,i18n("Unable to accept the IMIP-message. It may be a problem with the email addresses.")); kdDebug() << "IncomingDialog::acceptMessage(): Error!" << endl; return false; } return false; } bool IncomingDialog::incomeRequest(ScheduleItemIn *item) { if (item->event()->type()=="FreeBusy") { //handel freebusy request IncidenceBase *inc = item->event(); QDateTime start = inc->dtStart(); QDateTime end = start.addDays(inc->duration()/86400); FreeBusy *freebusy = new FreeBusy(mCalendar, start, end); freebusy->setOrganizer(inc->organizer()); Attendee *att = new Attendee(KOPrefs::instance()->fullName(), KOPrefs::instance()->email()); freebusy->addAttendee(att); kdDebug() << "calendarview: schedule_publish_freebusy: startDate: " << KGlobal::locale()->formatDateTime( start ) << " End Date: " << KGlobal::locale()->formatDateTime( end ) << endl; if (mOutgoing->addMessage(freebusy,Scheduler::Reply)) { delete item; emit numMessagesChanged(mMessageListView->childCount()); delete(freebusy); return true; } return false; } else { return incomeDefault(item); } return false; } bool IncomingDialog::automaticAction(ScheduleItemIn *item) { bool autoAction = false; IncidenceBase *inc = item->event(); Scheduler::Method method = item->method(); diff --git a/korganizer/korganizerE.pro b/korganizer/korganizerE.pro index 4247838..d841193 100644 --- a/korganizer/korganizerE.pro +++ b/korganizer/korganizerE.pro @@ -1,155 +1,157 @@ TEMPLATE = app CONFIG += qt warn_on TARGET = kopi OBJECTS_DIR = obj/$(PLATFORM) MOC_DIR = moc/$(PLATFORM) DESTDIR=$(QPEDIR)/bin INCLUDEPATH += $(KDEPIMDIR) $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kio/kfile $(KDEPIMDIR)/microkde/kio/kio $(KDEPIMDIR)/microkde/kdeui $(KDEPIMDIR)/qtcompat $(KDEPIMDIR)/libkdepim interfaces $(KDEPIMDIR)/kabc $(QPEDIR)/include DEFINES += KORG_NODND KORG_NOPLUGINS KORG_NOARCHIVE KORG_NOMAIL DEFINES += KORG_NOPRINTER KORG_NODCOP KORG_NOKALARMD KORG_NORESOURCEVIEW KORG_NOSPLITTER DEFINES += KORG_NOLVALTERNATION #KORG_NOKABC LIBS += -lmicrokdepim LIBS += -lmicrokcal LIBS += -lmicrokde LIBS += -lmicroqtcompat -LIBS += -lmicrokabc +#LIBS += -lmicrokabc #LIBS += $(QPEDIR)/lib/gammu #LIBS += -lmicrogammu #LIBS += -lbluetooth #LIBS += -lsdp +LIBS += $(GCC3EXTRALIB1) +LIBS += $(GCC3EXTRALIB2) LIBS += -lqpe LIBS += -ljpeg LIBS += $(QTOPIALIB) LIBS += -L$(QPEDIR)/lib INTERFACES = kofilterview_base.ui #filteredit_base.ui HEADERS = \ wordsgerman.h \ filteredit_base.h \ alarmclient.h \ calendarview.h \ customlistviewitem.h \ datenavigator.h \ docprefs.h \ filtereditdialog.h \ incomingdialog.h \ incomingdialog_base.h \ interfaces/korganizer/baseview.h \ interfaces/korganizer/calendarviewbase.h \ journalentry.h \ kdateedit.h \ kdatenavigator.h \ koagenda.h \ koagendaitem.h \ koagendaview.h \ kocounterdialog.h \ kodaymatrix.h \ kodialogmanager.h \ koeditordetails.h \ koeditorgeneral.h \ koeditorgeneralevent.h \ koeditorgeneraltodo.h \ koeditorrecurrence.h \ koeventeditor.h \ koeventpopupmenu.h \ koeventview.h \ koeventviewer.h \ koeventviewerdialog.h \ kofilterview.h \ koglobals.h \ koincidenceeditor.h \ kojournalview.h \ kolistview.h \ kolocationbox.h \ komonthview.h \ koprefs.h \ koprefsdialog.h \ kotimespanview.h \ kotodoeditor.h \ kotodoview.h \ kotodoviewitem.h \ koviewmanager.h \ kowhatsnextview.h \ ktimeedit.h \ lineview.h \ mainwindow.h \ navigatorbar.h \ outgoingdialog.h \ outgoingdialog_base.h \ publishdialog.h \ publishdialog_base.h \ savetemplatedialog.h \ searchdialog.h \ simplealarmclient.h \ statusdialog.h \ timeline.h \ timespanview.h \ version.h \ ../kalarmd/alarmdialog.h SOURCES = \ filteredit_base.cpp \ calendarview.cpp \ datenavigator.cpp \ docprefs.cpp \ filtereditdialog.cpp \ incomingdialog.cpp \ incomingdialog_base.cpp \ journalentry.cpp \ kdatenavigator.cpp \ koagenda.cpp \ koagendaitem.cpp \ koagendaview.cpp \ kocounterdialog.cpp \ kodaymatrix.cpp \ kodialogmanager.cpp \ koeditordetails.cpp \ koeditorgeneral.cpp \ koeditorgeneralevent.cpp \ koeditorgeneraltodo.cpp \ koeditorrecurrence.cpp \ koeventeditor.cpp \ koeventpopupmenu.cpp \ koeventview.cpp \ koeventviewer.cpp \ koeventviewerdialog.cpp \ kofilterview.cpp \ koglobals.cpp \ koincidenceeditor.cpp \ kojournalview.cpp \ kolistview.cpp \ kolocationbox.cpp \ komonthview.cpp \ koprefs.cpp \ koprefsdialog.cpp \ kotimespanview.cpp \ kotodoeditor.cpp \ kotodoview.cpp \ kotodoviewitem.cpp \ koviewmanager.cpp \ kowhatsnextview.cpp \ ktimeedit.cpp \ lineview.cpp \ main.cpp \ mainwindow.cpp \ navigatorbar.cpp \ outgoingdialog.cpp \ outgoingdialog_base.cpp \ publishdialog.cpp \ publishdialog_base.cpp \ savetemplatedialog.cpp \ searchdialog.cpp \ simplealarmclient.cpp \ statusdialog.cpp \ timeline.cpp \ timespanview.cpp \ ../kalarmd/alarmdialog.cpp diff --git a/korganizer/publishdialog.cpp b/korganizer/publishdialog.cpp index 4323b91..2ae6720 100644 --- a/korganizer/publishdialog.cpp +++ b/korganizer/publishdialog.cpp @@ -1,150 +1,151 @@ /* 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 <qlineedit.h> #include <kdebug.h> #include <kglobal.h> #include <klocale.h> #ifndef KORG_NOKABC -#include <kabc/addresseedialog.h> +#define KORG_NOKABC +//#include <kabc/addresseedialog.h> #endif #include "koprefs.h" #include "publishdialog.h" PublishDialog::PublishDialog(QWidget* parent, const char* name, bool modal, WFlags fl) : PublishDialog_base(parent,name,modal,fl) { setCaption(i18n("Select Addresses")); mNameLineEdit->setEnabled(false); mEmailLineEdit->setEnabled(false); connect(mAddressListView,SIGNAL(selectionChanged(QListViewItem *)), SLOT(updateInput())); } PublishDialog::~PublishDialog() { } void PublishDialog::addAttendee(Attendee *attendee) { mNameLineEdit->setEnabled(true); mEmailLineEdit->setEnabled(true); QListViewItem *item = new QListViewItem(mAddressListView); item->setText(0,attendee->name()); item->setText(1,attendee->email()); mAddressListView->insertItem(item); } QString PublishDialog::addresses() { QString to = ""; QListViewItem *item; int i, count; count = mAddressListView->childCount(); for (i=0;i<count;i++) { item = mAddressListView->firstChild(); mAddressListView->takeItem(item); to += item->text(1); if (i<count-1) { to += ", "; } } return to; } void PublishDialog::addItem() { mNameLineEdit->setEnabled(true); mEmailLineEdit->setEnabled(true); QListViewItem *item = new QListViewItem(mAddressListView); mAddressListView->insertItem(item); mAddressListView->setSelected(item,true); mNameLineEdit->setText(i18n("(EmptyName)")); mEmailLineEdit->setText(i18n("(EmptyEmail)")); } void PublishDialog::removeItem() { QListViewItem *item; item = mAddressListView->selectedItem(); if (!item) return; mAddressListView->takeItem(item); item = mAddressListView->selectedItem(); if (!item) { mNameLineEdit->setText(""); mEmailLineEdit->setText(""); mNameLineEdit->setEnabled(false); mEmailLineEdit->setEnabled(false); } if (mAddressListView->childCount() == 0) { mNameLineEdit->setEnabled(false); mEmailLineEdit->setEnabled(false); } } void PublishDialog::openAddressbook() { #ifndef KORG_NOKABC KABC::Addressee::List addressList; addressList = KABC::AddresseeDialog::getAddressees(this); //KABC::Addressee a = KABC::AddresseeDialog::getAddressee(this); KABC::Addressee a = addressList.first(); if (!a.isEmpty()) { uint i; for (i=0;i<addressList.count();i++) { a = addressList[i]; mNameLineEdit->setEnabled(true); mEmailLineEdit->setEnabled(true); QListViewItem *item = new QListViewItem(mAddressListView); mAddressListView->setSelected(item,true); mNameLineEdit->setText(a.realName()); mEmailLineEdit->setText(a.preferredEmail()); mAddressListView->insertItem(item); } } #endif } void PublishDialog::updateItem() { QListViewItem *item; item = mAddressListView->selectedItem(); if (!item) return; item->setText(0,mNameLineEdit->text()); item->setText(1,mEmailLineEdit->text()); } void PublishDialog::updateInput() { QListViewItem *item; item = mAddressListView->selectedItem(); if (!item) return; mNameLineEdit->setEnabled(true); mEmailLineEdit->setEnabled(true); QString mail = item->text(1); mNameLineEdit->setText(item->text(0)); mEmailLineEdit->setText(mail); } |