-rw-r--r-- | korganizer/calendarview.cpp | 20 | ||||
-rw-r--r-- | korganizer/calendarview.h | 1 | ||||
-rw-r--r-- | korganizer/journalentry.cpp | 22 | ||||
-rw-r--r-- | korganizer/journalentry.h | 3 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 2 |
5 files changed, 46 insertions, 2 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 940ea91..ccacc52 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -1446,30 +1446,34 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int //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(); + int calID = inR->calID(); remote->deleteIncidence( inR ); inR = inL->clone(); + inR->setCalID( calID ); inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) inR->setIDStr( idS ); remote->addIncidence( inR ); if ( mSyncManager->syncWithDesktop() ) inR->setPilotId( 2 ); ++changedRemote; } else {// take remote ********************** idS = inL->IDStr(); int pid = inL->pilotId(); + int calID = inL->calID(); local->deleteIncidence( inL ); inL = inR->clone(); + inL->setCalID( calID ); if ( mSyncManager->syncWithDesktop() ) inL->setPilotId( pid ); inL->setIDStr( idS ); if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); } local->addIncidence( inL ); @@ -1488,25 +1492,28 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int //remote->deleteIncidence( inR ); ++deletedEventR; } else { inR->setLastModified( modifiedCalendar ); inL = inR->clone(); inL->setIDStr( ":" ); inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); + + inL->setCalID( 0 );// add to default cal local->addIncidence( inL ); ++addedEvent; } } else { if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { inR->setLastModified( modifiedCalendar ); inL = inR->clone(); inL->setIDStr( ":" ); + inL->setCalID( 0 );// add to default cal local->addIncidence( inL ); ++addedEvent; } else { checkExternSyncEvent(eventRSyncSharp, inR); remote->deleteIncidence( inR ); ++deletedEventR; } @@ -1554,30 +1561,32 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int if ( ! mSyncManager->mWriteBackExistingOnly ) { inL->removeID(mCurrentSyncDevice ); ++addedEventR; //qDebug("remote added Incidence %s ", inL->summary().latin1()); inL->setLastModified( modifiedCalendar ); inR = inL->clone(); inR->setIDStr( ":" ); inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); + inR->setCalID( 0 );// add to default cal remote->addIncidence( inR ); } } } else { if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { checkExternSyncEvent(eventLSyncSharp, inL); local->deleteIncidence( inL ); ++deletedEventL; } else { if ( ! mSyncManager->mWriteBackExistingOnly ) { ++addedEventR; inL->setLastModified( modifiedCalendar ); inR = inL->clone(); inR->setIDStr( ":" ); + inR->setCalID( 0 );// add to default cal remote->addIncidence( inR ); } } } } else { ++filteredOUT; } } @@ -2138,16 +2147,25 @@ bool CalendarView::openCalendar(QString filename, bool merge) globalFlagBlockAgenda = 2; mCalendar->reInitAlarmSettings(); setSyncEventsReadOnly(); updateUnmanagedViews(); updateView(); } return false; } +void CalendarView::mergeFile( QString fn ) +{ + clearAllViews(); + mCalendar->mergeCalendarFile( fn ); + mCalendar->reInitAlarmSettings(); + setSyncEventsReadOnly(); + updateUnmanagedViews(); + updateView(); +} void CalendarView::showOpenError() { KMessageBox::error(this,i18n("Couldn't load calendar\n.")); } void CalendarView::setLoadedFileVersion(QDateTime dt) { loadedFileVersion = dt; } @@ -3353,22 +3371,24 @@ void CalendarView::newEvent() } else { newEvent(aView->selectionStart(),aView->selectionEnd()); } return; } } QDate date = mNavigator->selectedDates().first(); +#if 0 QDateTime current = QDateTime::currentDateTime(); if ( date <= current.date() ) { int hour = current.time().hour() +1; newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ), QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); } else +#endif newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ), QDateTime( date, QTime( KOPrefs::instance()->mStartTime + KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); } void CalendarView::newEvent(QDateTime fh) { newEvent(fh, diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index 706d05d..799c297 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h @@ -133,16 +133,17 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser DateNavigator *dateNavigator(); KDateNavigator *dateNavigatorWidget(); void addView(KOrg::BaseView *); void showView(KOrg::BaseView *); KOEventViewerDialog* getEventViewerDialog(); Incidence *currentSelection(); void checkSuspendAlarm(); + void mergeFile( QString fn ); signals: void save (); void saveStopTimer (); void tempDisableBR(bool); /** This todo has been modified */ void todoModified(Todo *, int); diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp index b8a4cf2..f0e0f86 100644 --- a/korganizer/journalentry.cpp +++ b/korganizer/journalentry.cpp @@ -71,17 +71,18 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : mJournal = 0; visibleMode = true; QHBox * vb = new QHBox ( this ); QPixmap iconp; vb->setMargin ( KDialog::marginHint()-1 ); QPushButton * toggleJournal = new QPushButton( vb ); iconp = SmallIcon("1updownarrow"); toggleJournal->setPixmap (iconp ) ; - vb->setStretchFactor (new QLabel(" "+i18n("Title: "),vb),1); + QLabel* textLabel = new QLabel(" "+i18n("Title: "),vb); + vb->setStretchFactor (textLabel,1); vb->setStretchFactor( toggleJournal, 1 ); mTitle = new KOLocationBox(TRUE, vb, 30); mTitle->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding ,QSizePolicy::Fixed ,FALSE) ); mCalendarBox = new QComboBox(vb); mCalendarBox->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding ,QSizePolicy::Fixed ,FALSE) ); #ifndef DESKTOP_VERSION mTitle->setSizeLimit( 8 ); mCalendarBox->setSizeLimit( 8 ); @@ -107,32 +108,51 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : saveTemplate->setFixedSize( size, size ); toggleJournal->setFixedSize( size , size ); mTitle->setFixedHeight( size+4); mCalendarBox->setFixedHeight( size+4); mEditor = new KTextEdit(this); #ifndef DESKTOP_VERSION QPEApplication::setStylusOperation( mEditor, QPEApplication::RightOnHold ); #endif + mMaxWidDiff = 3*size - 2*frameWidth() - textLabel->sizeHint().width(); + mDeskWid = QApplication::desktop()->width(); + int maxwid = mDeskWid - mMaxWidDiff; + mTitle->setMaximumWidth( maxwid/2 +20 ); + mCalendarBox->setMaximumWidth( maxwid/2 -20 ); mEditor->setWordWrap( KTextEdit::WidgetWidth ); QBoxLayout *topLayout = new QVBoxLayout(this); topLayout->addWidget(vb); topLayout->addWidget(mEditor); mEditor->installEventFilter(this); connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); connect( toggleJournal, SIGNAL( clicked() ), this , SLOT( toggleShowJournal() ) ); mTitle->load( KOLocationBox::SUMMARYJOURNAL ); mTitle->lineEdit ()->setText(""); } JournalEntry::~JournalEntry() { //qDebug("JournalEntry::~JournalEntry() "); } +void JournalEntry::resizeEvent(QResizeEvent* e ) +{ +#ifndef DESKTOP_VERSION + if ( mDeskWid != QApplication::desktop()->width() ) { + mDeskWid == QApplication::desktop()->width(); + int maxwid = mDeskWid - mMaxWidDiff; + mTitle->setMaximumWidth( maxwid/2 +20 ); + mCalendarBox->setMaximumWidth( maxwid/2 -20 ); + } + setMaximumWidth( QApplication::desktop()->width() ); + qDebug("MAXXX %d ", QApplication::desktop()->width()); +#endif + QFrame::resizeEvent( e ); +} QSize JournalEntry::sizeHint() const { return QSize ( 240, heiHint ); } void JournalEntry::slotSaveTemplate() { QString fileName =locateLocal( "templates", "journals" ); QDir t_dir; diff --git a/korganizer/journalentry.h b/korganizer/journalentry.h index ed04b7c..a69846c 100644 --- a/korganizer/journalentry.h +++ b/korganizer/journalentry.h @@ -50,32 +50,35 @@ class JournalEntry : public QFrame { void clear(); void flushEntry(); void setShowOnly(); QSize sizeHint() const; void setVisibleMode( bool b ) { visibleMode = b;} void fillCalendar( int id = 0 ); + void resizeEvent(QResizeEvent* e ) ; protected slots: void slotSaveTemplate(); void slotLoadTemplate(); void toggleShowJournal(); void setVisibleOn(); signals: void deleteJournal(Journal *); void newJournal(); void showJournalOnly( Journal * ); protected: bool eventFilter( QObject *o, QEvent *e ); void writeJournal(); private: + int mMaxWidDiff; + int mDeskWid; bool visibleMode; bool showOnlyMode; Calendar *mCalendar; Journal *mJournal; QDate mDate; void keyPressEvent ( QKeyEvent * ) ; QComboBox *mCalendarBox; KOLocationBox * mTitle; diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 5249300..4bedb61 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -2539,17 +2539,17 @@ void MainWindow::syncFileRequest() } void MainWindow::getFile( bool success ) { if ( ! success ) { setCaption( i18n("Error receiving file. Nothing changed!") ); return; } - mView->openCalendar( sentSyncFile() ); + mView->mergeFile( sentSyncFile() ); if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { mSyncManager->slotSyncMenu( 999 ); } setCaption( i18n("Pi-Sync successful!") ); } void MainWindow::printListView() { |