-rw-r--r-- | korganizer/calendarview.cpp | 6 | ||||
-rw-r--r-- | korganizer/kodialogmanager.cpp | 4 | ||||
-rw-r--r-- | korganizer/koprefs.h | 11 | ||||
-rw-r--r-- | korganizer/koviewmanager.cpp | 20 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 1 | ||||
-rw-r--r-- | korganizer/searchdialog.cpp | 47 | ||||
-rw-r--r-- | korganizer/searchdialog.h | 1 |
7 files changed, 75 insertions, 15 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 1e83236..beb19d9 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -1830,54 +1830,58 @@ void CalendarView::readSettings() 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(); + h = list[3].toInt(); + KApplication::testCoords( &x,&y,&w,&h ); 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(); + KApplication::testCoords( &x,&y,&w,&h ); 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(); + KApplication::testCoords( &x,&y,&w,&h ); 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(); + KApplication::testCoords( &x,&y,&w,&h ); 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 ) { diff --git a/korganizer/kodialogmanager.cpp b/korganizer/kodialogmanager.cpp index a8652ea..c927b37 100644 --- a/korganizer/kodialogmanager.cpp +++ b/korganizer/kodialogmanager.cpp @@ -31,24 +31,25 @@ #include "kotodoeditor.h" #include "searchdialog.h" #include "filtereditdialog.h" #ifndef KORG_NOPLUGINS #include "plugindialog.h" #endif #ifndef KORG_NOARCHIVE #include "archivedialog.h" #endif #include "kconfig.h" #include "kodialogmanager.h" +#include <kapplication.h> KODialogManager::KODialogManager( CalendarView *mainView ) : QObject(), mMainView( mainView ) { mOutgoingDialog = 0; mIncomingDialog = 0; mOptionsDialog = 0; mSearchDialog = 0; mArchiveDialog = 0; mFilterEditDialog = 0; mPluginDialog = 0; @@ -195,38 +196,39 @@ void KODialogManager::showSearchDialog() mSearchDialog->showMaximized(); #else KConfig *config = KOGlobals::config(); config->setGroup("WidgetLayout"); QStringList list; list = config->readListEntry("SearchLayout"); int x,y,w,h; if ( ! list.isEmpty() ) { x = list[0].toInt(); y = list[1].toInt(); w = list[2].toInt(); h = list[3].toInt(); + KApplication::testCoords( &x,&y,&w,&h ); mSearchDialog->setGeometry(x,y,w,h); } #endif } // make sure the widget is on top again #ifdef DESKTOP_VERSION mSearchDialog->show(); #else mSearchDialog->setMaximumSize( QApplication::desktop()->size()); mSearchDialog->showMaximized(); #endif - mSearchDialog->raise(); + mSearchDialog->raiseAndSelect(); } SearchDialog * KODialogManager::getSearchDialog() { return mSearchDialog; } void KODialogManager::showArchiveDialog() { #ifndef KORG_NOARCHIVE if (!mArchiveDialog) { mArchiveDialog = new ArchiveDialog(mMainView->calendar(),mMainView); connect(mArchiveDialog,SIGNAL(eventsDeleted()), diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h index 3a07348..cf8dae6 100644 --- a/korganizer/koprefs.h +++ b/korganizer/koprefs.h @@ -23,24 +23,33 @@ #ifndef KOPREFS_H #define KOPREFS_H #include <libkdepim/kpimprefs.h> #include <qdict.h> class KConfig; class QFont; class QColor; class QStringList; +#define VIEW_WN_VIEW 1 +#define VIEW_NX_VIEW 2 +#define VIEW_J_VIEW 3 +#define VIEW_A_VIEW 4 +#define VIEW_ML_VIEW 5 +#define VIEW_M_VIEW 6 +#define VIEW_L_VIEW 7 +#define VIEW_T_VIEW 8 + class KOPrefs : public KPimPrefs { public: enum { FormatVCalendar, FormatICalendar }; enum { MailClientKMail, MailClientSendmail }; enum { IMIPDummy, IMIPKMail }; enum { IMIPOutbox, IMIPdirectsend }; enum { neverAuto, addressbookAuto, selectedAuto }; enum { standardDestination, askDestination }; virtual ~KOPrefs(); @@ -281,24 +290,26 @@ class KOPrefs : public KPimPrefs QString mActiveSyncPort; QString mActiveSyncIP; // settings for eventviewer bool mEVshowDetails; bool mEVshowCreated; bool mEVshowChanged; bool mWTshowDetails; bool mWTshowCreated; bool mWTshowChanged; + int mCurrentDisplayedView; + private: QDict<QColor> mCategoryColors; QColor mDefaultCategoryColor; QFont mDefaultTimeBarFont; QFont mDefaultViewFont; QFont mDefaultMonthViewFont; QString mName; QString mEmail; }; diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index c442d0b..406e741 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp @@ -218,33 +218,25 @@ void KOViewManager::showNextView() if (mCurrentView == mJournalView ) goto DAY_1; if (mCurrentView == mAgendaView && mCurrentAgendaView == 1 ) goto DAY_5; if (mCurrentView == mAgendaView && mCurrentAgendaView == 5 ) goto DAY_7; if (mCurrentView == mAgendaView ) goto DAY_6; if (mCurrentView == mMonthView && KOPrefs::instance()->mMonthViewWeek) goto MONTH; if (mCurrentView == mMonthView ) goto LIST; if (mCurrentView == mListView ) goto TODO; // if (mCurrentView == mTodoView ) goto NEXT; NEXT: if ( KOPrefs::instance()->mShowIconNext ) { showWhatsNextView();goto ENTE ;} NEXT_X: if ( KOPrefs::instance()->mShowIconNextDays ) { - globalFlagBlockAgenda = 1; - if ( mCurrentAgendaView != 3 ) - mCurrentAgendaView = -1; - showAgendaView(KOPrefs::instance()->mFullViewMonth); - globalFlagBlockAgenda = 2; - mMainView->dateNavigator()->selectDates( baseCycleDate , - KOPrefs::instance()->mNextXDays ); - mFlagShowNextxDays = true; - mCurrentAgendaView = 3 ; + showNextXView(); goto ENTE ; } JOURNAL: if ( KOPrefs::instance()->mShowIconJournal ) { resetDateSilent( baseCycleDate , 1 ); showJournalView() ;goto ENTE ;} DAY_1: if ( KOPrefs::instance()->mShowIconDay1 ) { resetDateSilent( baseCycleDate , 2 ); showDayView() ;goto ENTE ;} DAY_5: if ( KOPrefs::instance()->mShowIconDay5 ) { @@ -398,25 +390,25 @@ void KOViewManager::showWhatsNextView() if (!mWhatsNextView) { mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), "KOViewManager::WhatsNextView"); mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); addView(mWhatsNextView); connect(this, SIGNAL( printWNV() ), mWhatsNextView, SLOT( printMe() ) ); } globalFlagBlockAgenda = 1; showView(mWhatsNextView, true ); //mWhatsNextView->updateView(); - + KOPrefs::instance()->mCurrentDisplayedView = VIEW_WN_VIEW; } void KOViewManager::slotprintWNV() { if (!mWhatsNextView) showWhatsNextView(); emit printWNV(); } void KOViewManager::showListView() { if (!mListView) { @@ -444,24 +436,25 @@ void KOViewManager::showListView() mMainView, SLOT ( beamIncidence( Incidence * ) ) ); } // bool temp = mFlagShowNextxDays; //globalFlagBlockPainting = true; globalFlagBlockAgenda = 1; if ( KOPrefs::instance()->mListViewMonthTimespan ) { mMainView->setBlockShowDates( true ); mMainView->dateNavigator()->selectMonth(); mMainView->setBlockShowDates( false ); } showView(mListView, KOPrefs::instance()->mFullViewTodo); //mFlagShowNextxDays = temp; + KOPrefs::instance()->mCurrentDisplayedView = VIEW_L_VIEW; } void KOViewManager::showAgendaView( bool fullScreen ) { mMainView->dialogManager()->hideSearchDialog(); // qDebug("KOViewManager::showAgendaView "); bool full; full = fullScreen; if (!mAgendaView) { full = false; mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); @@ -509,25 +502,25 @@ void KOViewManager::showAgendaView( bool fullScreen ) mMainView, SIGNAL( todoModified( Todo *, int ))); connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), mMainView, SLOT ( moveIncidence( Incidence * ) ) ); connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), mMainView, SLOT ( beamIncidence( Incidence * ) ) ); connect( mAgendaView, SIGNAL( selectWeekNum( int ) ), mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) ); mAgendaView->readSettings(); mAgendaView->updateConfig(); } showView( mAgendaView, full); - + KOPrefs::instance()->mCurrentDisplayedView = VIEW_A_VIEW; } void KOViewManager::showDayView() { mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); mFlagShowNextxDays = false; globalFlagBlockLabel = 1; globalFlagBlockAgenda = 1; if ( mCurrentAgendaView != 1 ) mCurrentAgendaView = -1; showAgendaView(); qApp->processEvents(); @@ -583,24 +576,25 @@ void KOViewManager::showWeekView() void KOViewManager::showNextXView() { globalFlagBlockAgenda = 1; if ( mCurrentAgendaView != 3 ) mCurrentAgendaView = -1; showAgendaView(KOPrefs::instance()->mFullViewMonth); globalFlagBlockAgenda = 2; mMainView->dateNavigator()->selectDates( QDate::currentDate(), KOPrefs::instance()->mNextXDays ); mFlagShowNextxDays = true; mCurrentAgendaView = 3 ; + KOPrefs::instance()->mCurrentDisplayedView = VIEW_NX_VIEW; } bool KOViewManager::showsNextDays() { return mFlagShowNextxDays; } void KOViewManager::createMonthView() { if (!mMonthView) { mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); addView(mMonthView); // mMonthView->show(); @@ -667,24 +661,25 @@ void KOViewManager::showMonthViewWeek() if ( mCurrentView == mMonthView) full = mMainView->leftFrame()->isVisible(); if ( !KOPrefs::instance()->mMonthViewWeek ) { mMonthView->switchView(); if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() ) full = false; else full = true; } mMainView->dateNavigator()->selectWeek(); showView(mMonthView, full ); mMonthView->setKeyBFocus(); + KOPrefs::instance()->mCurrentDisplayedView = VIEW_ML_VIEW ; } void KOViewManager::showMonth( const QDate & date ) { mMainView->dateNavigator()->blockSignals( true ); mMainView->dateNavigator()->selectDate( date ); mMainView->dateNavigator()->blockSignals( false ); showMonthView(); } void KOViewManager::showMonthView() { @@ -697,24 +692,25 @@ void KOViewManager::showMonthView() // if(mMonthView == mCurrentView) return; if ( KOPrefs::instance()->mMonthViewWeek ) { mMonthView->switchView(); if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() ) full = false; else full = true; } mMainView->dateNavigator()->selectMonth(); showView(mMonthView, full ); mMonthView->setKeyBFocus(); + KOPrefs::instance()->mCurrentDisplayedView = VIEW_M_VIEW ; } void KOViewManager::showTodoView() { //mFlagShowNextxDays = false; if ( !mTodoView ) { mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(), "KOViewManager::TodoView" ); addView( mTodoView ); // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold ); @@ -752,41 +748,43 @@ void KOViewManager::showTodoView() mMainView, SLOT ( todo_resub( Todo *, Todo *) ) ); connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ), mMainView, SLOT ( moveIncidence( Incidence * ) ) ); connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ), mMainView, SLOT ( beamIncidence( Incidence * ) ) ); KConfig *config = KOGlobals::config(); mTodoView->restoreLayout(config,"Todo View"); mTodoView->setNavigator( mMainView->dateNavigator() ); } globalFlagBlockAgenda = 1; showView( mTodoView, true ); + KOPrefs::instance()->mCurrentDisplayedView = VIEW_T_VIEW ; } void KOViewManager::showJournalView() { //mFlagShowNextxDays = false; if (!mJournalView) { mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(), "KOViewManager::JournalView"); connect( mMainView, SIGNAL( configChanged() ), mJournalView, SLOT( updateConfig() ) ); connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) ); addView(mJournalView); } showView(mJournalView); mMainView->dateNavigator()->selectDates( 1 ); + KOPrefs::instance()->mCurrentDisplayedView = VIEW_J_VIEW ; } void KOViewManager::showTimeSpanView() { //mFlagShowNextxDays = false; if (!mTimeSpanView) { mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(), "KOViewManager::TimeSpanView"); addView(mTimeSpanView); mTimeSpanView->readSettings(); } diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index d98915b..357154e 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -136,24 +136,25 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : 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("KO/Pi"); KOPrefs *p = KOPrefs::instance(); KPimGlobalPrefs::instance()->setGlobalConfig(); + p->mCurrentDisplayedView = 0; if ( p->mHourSize > 22 ) p->mHourSize = 22; QMainWindow::ToolBarDock tbd; if ( p->mToolBarHor ) { if ( p->mToolBarUp ) tbd = Bottom; else tbd = Top; } else { if ( p->mToolBarUp ) tbd = Right; diff --git a/korganizer/searchdialog.cpp b/korganizer/searchdialog.cpp index 341a839..db60383 100644 --- a/korganizer/searchdialog.cpp +++ b/korganizer/searchdialog.cpp @@ -68,25 +68,25 @@ SearchDialog::SearchDialog(Calendar *calendar,CalendarView *parent) searchEdit->setText("*"); // Find all events by default searchEdit->setFocus(); connect(searchEdit, SIGNAL(textChanged ( const QString & )),this,SLOT(searchTextChanged( const QString & ))); connect(searchEdit, SIGNAL( returnPressed () ),this,SLOT(doSearch())); // Subjects to search // QGroupBox *subjectGroup = new QGroupBox(1,Vertical,i18n("Search In"), // topFrame); QHBox *incidenceGroup = new QHBox( topFrame ); layout->addWidget(incidenceGroup); mSearchEvent = new QCheckBox(i18n("Events"),incidenceGroup); - mSearchEvent->setChecked(true); + //mSearchEvent->setChecked(true); mSearchTodo = new QCheckBox(i18n("Todos"),incidenceGroup); mSearchJournal = new QCheckBox(i18n("Journals"),incidenceGroup); QHBox *subjectGroup = new QHBox( topFrame ); layout->addWidget(subjectGroup); mSummaryCheck = new QCheckBox(i18n("Summary/Loc."),subjectGroup); mSummaryCheck->setChecked(true); mDescriptionCheck = new QCheckBox(i18n("Details"),subjectGroup); mCategoryCheck = new QCheckBox(i18n("Categories"),subjectGroup); QHBox *attendeeGroup = new QHBox( topFrame ); @@ -120,24 +120,67 @@ SearchDialog::SearchDialog(Calendar *calendar,CalendarView *parent) setCaption( i18n("KO/Pi Find: ")); #ifdef DESKTOP_VERSION OkButton = new QPushButton( i18n("Close"), this ); connect(OkButton,SIGNAL(clicked()),SLOT(hide())); #endif } SearchDialog::~SearchDialog() { } +void SearchDialog::raiseAndSelect() +{ + + static int currentState = 0; + + if ( !mSearchJournal->isChecked() && !mSearchTodo->isChecked() && !mSearchEvent->isChecked() ) + currentState = 0; + int newState = 0; + if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { + newState = VIEW_J_VIEW; + } + else if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { + newState = VIEW_T_VIEW; + } + else { + newState = VIEW_A_VIEW; + } + if ( newState != currentState ) { + if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { + if ( ! mSearchJournal->isChecked() ) { + mSearchJournal->setChecked( true ); + mSearchTodo->setChecked( false ); + mSearchEvent->setChecked( false ); + } + } + else if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { + if ( ! mSearchTodo->isChecked() ) { + mSearchTodo->setChecked( true ); + mSearchJournal->setChecked( false ); + mSearchEvent->setChecked( false ); + } + } + else { + if ( ! mSearchEvent->isChecked() ) { + mSearchEvent->setChecked( true ); + mSearchJournal->setChecked( false ); + mSearchTodo->setChecked( false ); + } + } + } + currentState = newState; + raise(); +} void SearchDialog::setFocusToList() { listView->resetFocus(); } void SearchDialog::accept() { doSearch(); } void SearchDialog::updateList() { //listView->updateList(); if ( isVisible() ) { @@ -192,25 +235,25 @@ void SearchDialog::doSearch() mess = mess.sprintf( i18n("%d item(s) found."), mMatchedEvents.count()+ mMatchedJournals.count() + mMatchedTodos.count() ); setCaption( i18n("KO/Pi Find: ") + mess); } searchEdit->setFocus(); } void SearchDialog::updateConfig() { listView->updateConfig(); } void SearchDialog::updateView() { - + //qDebug("SearchDialog::updateView() %d ", isVisible()); QRegExp re; re.setWildcard(true); // most people understand these better. re.setCaseSensitive(false); re.setPattern(searchEdit->text()); if (re.isValid()) { search(re); } else { mMatchedEvents.clear(); mMatchedTodos.clear(); mMatchedJournals.clear(); } listView->setStartDate( mStartDate->date() ); diff --git a/korganizer/searchdialog.h b/korganizer/searchdialog.h index b730ed5..4559d20 100644 --- a/korganizer/searchdialog.h +++ b/korganizer/searchdialog.h @@ -40,24 +40,25 @@ class KLineEdit; class QLabel; class CalendarView; using namespace KCal; class SearchDialog : public QVBox { Q_OBJECT public: SearchDialog(Calendar *calendar,CalendarView *parent=0); virtual ~SearchDialog(); KOListView *listview(){ return listView;} void updateView(); + void raiseAndSelect(); public slots: void changeEventDisplay(Event *, int) { updateView(); } void updateConfig(); void updateList(); protected slots: void setFocusToList(); void accept(); void doSearch(); void searchTextChanged( const QString &_text ); signals: |