summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-03-21 14:46:33 (UTC)
committer zautrix <zautrix>2005-03-21 14:46:33 (UTC)
commit86c420a68008e4430bd769ebdecdfa430ba552f5 (patch) (side-by-side diff)
tree76a1e6485169f5601c82754dc9d8971702b5c1b1
parent6e5a0c6cff04fff115e63b62537c5274dc7a5564 (diff)
downloadkdepimpi-86c420a68008e4430bd769ebdecdfa430ba552f5.zip
kdepimpi-86c420a68008e4430bd769ebdecdfa430ba552f5.tar.gz
kdepimpi-86c420a68008e4430bd769ebdecdfa430ba552f5.tar.bz2
init fix
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--korganizer/calendarview.cpp86
1 files changed, 43 insertions, 43 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 96ced08..90b36ac 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1730,310 +1730,310 @@ bool CalendarView::checkFileVersion(QString fn)
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, true)) ,
i18n("KO/Pi Warning"),i18n("Overwrite"),
i18n("Sync+save"));
if ( km == KMessageBox::Cancel )
return false;
if ( km == KMessageBox::Yes )
return true;
setSyncDevice("deleteaftersync" );
mSyncManager->mAskForPreferences = true;
mSyncManager->mSyncAlgoPrefs = 3;
mSyncManager->mWriteBackFile = false;
mSyncManager->mWriteBackExistingOnly = false;
mSyncManager->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();
QDateTime lfv = QDateTime::currentDateTime().addSecs( -2);
mStorage->setSaveFormat( new ICalFormat() );
mStorage->setFileName( filename );
bool success;
success = mStorage->save();
if ( !success ) {
return false;
}
if ( filename == MainWindow::defaultFileName() ) {
setLoadedFileVersion( lfv );
watchSavedFile();
}
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);
+
+#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
config->setGroup( "Views" );
int dateCount = config->readNumEntry( "ShownDatesCount", 7 );
QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame");
int resetval = 0;
int maxVal = 0;
if (sizes.count() != 3) {
if ( KOPrefs::instance()->mVerticalScreen ) {
resetval = mDateNavigator->sizeHint().width()+2;
} else {
resetval = mDateNavigator->sizeHint().height()+2;
}
}
if ( !resetval ){// i.e. sizes.count() == 3
if ( KOPrefs::instance()->mVerticalScreen ) {
if ( sizes[0] < mDateNavigator->sizeHint().width()+1 )
resetval = mDateNavigator->sizeHint().width()+2;
} else {
if ( sizes[0] < mDateNavigator->sizeHint().height()+1 )
resetval = mDateNavigator->sizeHint().height()+2;
}
}
if ( resetval ) {
sizes.clear();
if ( KOPrefs::instance()->mVerticalScreen ) {
maxVal = QApplication::desktop()->width() -10;
} else {
maxVal = QApplication::desktop()->height()-10;
}
sizes << resetval;
if ( maxVal < resetval + resetval)
resetval = maxVal - resetval;
sizes << resetval;
sizes << 100;
}
mLeftFrame->setSizes(sizes);
sizes = config->readIntListEntry("Main Splitter Frame");
if (sizes.count() != 2) {
if ( !KOPrefs::instance()->mVerticalScreen ) {
resetval = mDateNavigator->sizeHint().width()+2;
} else {
resetval = mDateNavigator->sizeHint().height()+2;
}
}
if ( !resetval ){// i.e. sizes.count() == 3
if ( !KOPrefs::instance()->mVerticalScreen ) {
if ( sizes[0] < mDateNavigator->sizeHint().width()+1 )
resetval = mDateNavigator->sizeHint().width()+2;
} else {
if ( sizes[0] < mDateNavigator->sizeHint().height()+1 )
resetval = mDateNavigator->sizeHint().height()+2;
}
}
if ( resetval ) {
sizes.clear();
if ( !KOPrefs::instance()->mVerticalScreen ) {
maxVal = QApplication::desktop()->width() -10;
} else {
maxVal = QApplication::desktop()->height()-10;
}
sizes << resetval;
if ( maxVal < resetval + resetval)
resetval = maxVal - resetval;
sizes << resetval;
}
mMainFrame->setSizes(sizes);
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();
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() );
QValueList<int> listINT = mLeftFrame->sizes();
config->writeEntry("Left Splitter Frame",listINT);
QValueList<int> listINT2 = mMainFrame->sizes();
config->writeEntry("Main Splitter Frame",listINT2);
#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 );
list << QString::number( y );
list << QString::number( w );
list << QString::number( h );
config->writeEntry("EditTodoLayout",list );
wid = getEventViewerDialog();
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("ViewerLayout",list );
wid = mDialogManager->getSearchDialog();
if ( wid ) {
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("SearchLayout",list );
}
#endif
config->sync();
}
void CalendarView::readFilterSettings(KConfig *config)
{