summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koprefs.cpp7
-rw-r--r--korganizer/koprefs.h7
-rw-r--r--korganizer/mainwindow.cpp206
-rw-r--r--korganizer/mainwindow.h11
4 files changed, 196 insertions, 35 deletions
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index 7e3deff..2168094 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -85,27 +85,34 @@ KOPrefs::KOPrefs() :
addItemBool("ShowIconForward",&mShowIconForward,true);
addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true);
addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,true);
addItemBool("ShowIconWeekNum",&mShowIconWeekNum,true);
addItemBool("ShowIconNextDays",&mShowIconNextDays,true);
addItemBool("ShowIconNext",&mShowIconNext,true);
addItemBool("ShowIconJournal",&mShowIconJournal,true);
addItemBool("ShowIconStretch",&mShowIconStretch,true);
+ addItemBool("ShowIconFilter",&mShowIconFilter,false);
addItemInt("LastLoadedLanguage",&mOldLanguage,0);
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("ToolBarHorV",&mToolBarHorV, true );
+ addItemBool("ToolBarUpV",&mToolBarUpV, false );
+ addItemBool("ToolBarHorN",&mToolBarHorN, true );
+ addItemBool("ToolBarUpN",&mToolBarUpN, false );
+ addItemBool("ToolBarHorF",&mToolBarHorF, true );
+ addItemBool("ToolBarUpF",&mToolBarUpF, false );
addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false );
addItemInt("Whats Next Days",&mWhatsNextDays,3);
addItemInt("Whats Next Prios",&mWhatsNextPrios,1);
addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true);
addItemBool("ShowTimeInAgenda",&mShowTimeInAgenda,true);
addItemBool("HideNonStartedTodos",&mHideNonStartedTodos,false);
addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true);
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index 09a0dce..8dfdf69 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -180,21 +180,28 @@ class KOPrefs : public KPimPrefs
bool mShowIconToday;
bool mShowIconForward;
bool mShowIconForwardFast;
bool mShowIconWhatsThis;
bool mShowIconWeekNum;
bool mShowIconNextDays;
bool mShowIconNext;
bool mShowIconJournal;
+ bool mShowIconFilter;
bool mShowIconStretch;
bool mToolBarHor;
bool mToolBarUp;
+ bool mToolBarHorV;
+ bool mToolBarUpV;
+ bool mToolBarHorN;
+ bool mToolBarUpN;
+ bool mToolBarHorF;
+ bool mToolBarUpF;
bool mToolBarMiniIcons;
bool mAskForQuit;
bool mUsePassWd;
bool mShowSyncEvents;
bool mShowTodoInAgenda;
bool mShowTimeInAgenda;
bool mHideNonStartedTodos;
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index ca0d542..c6ae868 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -52,16 +52,17 @@
#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 "ktoolbar.h"
#include "klocale.h"
#include "kconfig.h"
#include "simplealarmclient.h"
#include "externalapphandler.h"
using namespace KCal;
#ifndef _WIN32_
#include <unistd.h>
@@ -159,16 +160,78 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
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 );
+
+ if ( KOPrefs::instance()->mShowIconFilter ) {
+ if ( p->mToolBarHorF ) {
+ if ( p->mToolBarUpF )
+ tbd = Bottom;
+ else
+ tbd = Top;
+ }
+ else {
+ if ( p->mToolBarUpF )
+ tbd = Right;
+ else
+ tbd = Left;
+ }
+ filterToolBar = new QPEToolBar ( this );
+ filterMenubar = new QPEMenuBar( filterToolBar );
+ QFontMetrics fm ( filterMenubar->font() );
+
+ filterPopupMenu = new QPopupMenu( this );
+ filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 );
+ filterMenubar->setFixedWidth( fm.width( i18n("No Filter")+"Ax" ) );
+ addToolBar (filterToolBar , tbd );
+ connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) );
+ connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) );
+ } else {
+ filterToolBar = 0;
+ filterMenubar = 0;
+ filterPopupMenu = 0;
+ }
+
+ if ( p->mToolBarHorV ) {
+ if ( p->mToolBarUpV )
+ tbd = Bottom;
+ else
+ tbd = Top;
+ }
+ else {
+ if ( p->mToolBarUpV )
+ tbd = Right;
+ else
+ tbd = Left;
+ }
+ viewToolBar = new QPEToolBar( this );
+ addToolBar (viewToolBar , tbd );
+ if ( p->mToolBarHorN ) {
+ if ( p->mToolBarUpN )
+ tbd = Bottom;
+ else
+ tbd = Top;
+ }
+ else {
+ if ( p->mToolBarUpN )
+ tbd = Right;
+ else
+ tbd = Left;
+ }
+ navigatorToolBar = new QPEToolBar( this );
+ addToolBar (navigatorToolBar , tbd );
+
+
+
+
mCalendarModifiedFlag = false;
QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
splash->setAlignment ( AlignCenter );
setCentralWidget( splash );
#ifndef DESKTOP_VERSION
showMaximized();
#endif
@@ -626,16 +689,18 @@ void MainWindow::initActions()
action->addTo( actionMenu );
connect( action, SIGNAL( activated() ),
mView, SLOT( undo_delete() ) );
actionMenu->insertSeparator();
icon = loadPixmap( pathString + "newevent" );
configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
configureToolBarMenu->insertSeparator();
+ configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 );
+ configureToolBarMenu->insertSeparator();
configureToolBarMenu->insertItem(i18n("Week Number"), 400);
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 );
@@ -994,83 +1059,83 @@ void MainWindow::initActions()
connect( action, SIGNAL( activated() ),
SLOT( about() ) );
//menuBar->insertSeparator();
// ******************************************************
// menubar icons
- iconToolBar->setHorizontalStretchable (true );
+
//menuBar->insertItem( iconToolBar );
//xdays_action
if (p-> mShowIconNewEvent)
ne_action->addTo( iconToolBar );
if (p->mShowIconNewTodo )
nt_action->addTo( iconToolBar );
if (p-> mShowIconSearch)
search_action->addTo( iconToolBar );
if (p-> mShowIconWhatsThis)
QWhatsThis::whatsThisButton ( iconToolBar );
if (p-> mShowIconNext)
- whatsnext_action->addTo( iconToolBar );
+ whatsnext_action->addTo( viewToolBar );
if (p-> mShowIconNextDays)
- xdays_action->addTo( iconToolBar );
+ xdays_action->addTo( viewToolBar );
if (p-> mShowIconJournal)
- viewjournal_action->addTo( iconToolBar );
+ viewjournal_action->addTo( viewToolBar );
if (p-> mShowIconDay1)
- day1_action->addTo( iconToolBar );
+ day1_action->addTo( viewToolBar );
if (p-> mShowIconDay5)
- day5_action->addTo( iconToolBar );
+ day5_action->addTo( viewToolBar );
if (p-> mShowIconDay7)
- day7_action->addTo( iconToolBar );
+ day7_action->addTo( viewToolBar );
if (p-> mShowIconDay6)
- day6_action->addTo( iconToolBar );
+ day6_action->addTo( viewToolBar );
if (p-> mShowIconMonth)
- month_action->addTo( iconToolBar );
+ month_action->addTo( viewToolBar );
if (p-> mShowIconList)
- showlist_action->addTo( iconToolBar );
+ showlist_action->addTo( viewToolBar );
if (p-> mShowIconTodoview)
- todoview_action->addTo( iconToolBar );
+ todoview_action->addTo( viewToolBar );
icon = loadPixmap( pathString + "2leftarrowB" );
configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200);
if (p-> mShowIconBackFast) {
action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
connect( action, SIGNAL( activated() ),
mView, SLOT( goPreviousMonth() ) );
- action->addTo( iconToolBar );
+ action->addTo( navigatorToolBar );
}
icon = loadPixmap( pathString + "1leftarrowB" );
configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210);
if (p-> mShowIconBack) {
action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
connect( action, SIGNAL( activated() ),
mView, SLOT( goPrevious() ) );
- action->addTo( iconToolBar );
+ action->addTo( navigatorToolBar );
}
icon = loadPixmap( pathString + "today" );
configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
if (p-> mShowIconToday)
- today_action->addTo( iconToolBar );
+ today_action->addTo( navigatorToolBar );
icon = loadPixmap( pathString + "1rightarrowB" );
configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
if (p-> mShowIconForward) {
action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
connect( action, SIGNAL( activated() ),
mView, SLOT( goNext() ) );
- action->addTo( iconToolBar );
+ action->addTo( navigatorToolBar );
}
icon = loadPixmap( pathString + "2rightarrowB" );
configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
if (p-> mShowIconForwardFast) {
action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this );
connect( action, SIGNAL( activated() ),
mView, SLOT( goNextMonth() ) );
- action->addTo( iconToolBar );
+ action->addTo( navigatorToolBar );
}
configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6);
if (p-> mShowIconNewEvent)
configureToolBarMenu->setItemChecked( 10, true );
if (p->mShowIconNewTodo )
@@ -1106,22 +1171,37 @@ void MainWindow::initActions()
if (p-> mShowIconNext)
configureToolBarMenu->setItemChecked( 110, true );
if (p-> mShowIconJournal)
configureToolBarMenu->setItemChecked( 90, true );
if (p-> mShowIconWhatsThis)
configureToolBarMenu->setItemChecked( 300, true );
if (p-> mShowIconWeekNum)
configureToolBarMenu->setItemChecked( 400, true );
- QLabel* dummy = new QLabel( iconToolBar );
- dummy->setBackgroundColor( iconToolBar->backgroundColor() );
- if (!p-> mShowIconStretch)
+ if (!p-> mShowIconStretch) {
+ QLabel* dummy = new QLabel( iconToolBar );
+ dummy->setBackgroundColor( iconToolBar->backgroundColor() );
+ dummy->setMinimumWidth( 0 );
iconToolBar->setStretchableWidget ( dummy ) ;
- else
+ }
+ else {
+ iconToolBar->setHorizontalStretchable (true );
+ viewToolBar->setHorizontalStretchable (true );
+ navigatorToolBar->setHorizontalStretchable (true );
+ iconToolBar->setVerticalStretchable (true );
+ viewToolBar->setVerticalStretchable (true );
+ navigatorToolBar->setVerticalStretchable (true );
configureToolBarMenu->setItemChecked( 5, true );
+ }
+ if (p-> mShowIconFilter)
+ configureToolBarMenu->setItemChecked( 7, true );
+
+
+ if ( filterMenubar )
+ connect( mView->filterView(), SIGNAL( filterChanged() ), SLOT( updateFilterToolbar() ) );
connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) );
configureAgenda( p->mHourSize );
connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) );
}
void MainWindow::exportToPhone( int mode )
{
@@ -1556,18 +1636,37 @@ void MainWindow::importQtopia()
#endif
}
void MainWindow::saveOnClose()
{
KOPrefs *p = KOPrefs::instance();
p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
- p->mToolBarUp = iconToolBar->x() > width()/2 ||
- iconToolBar->y() > height()/2;
+ if ( p->mToolBarHor )
+ p->mToolBarUp = iconToolBar->y() > height()/2;
+ else
+ p->mToolBarUp = iconToolBar->x() > width()/2;
+ p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal );
+ if ( p->mToolBarHorV )
+ p->mToolBarUpV = viewToolBar->y() > height()/2;
+ else
+ p->mToolBarUpV = viewToolBar->x() > width()/2 ;
+ p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal );
+ if ( p->mToolBarHorN )
+ p->mToolBarUpN = navigatorToolBar->y() > height()/2;
+ else
+ p->mToolBarUpN = navigatorToolBar->x() > width()/2 ;
+ if ( filterToolBar ) {
+ p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal );
+ if ( p->mToolBarHorF )
+ p->mToolBarUpF = filterToolBar->y() > height()/2;
+ else
+ p->mToolBarUpF = filterToolBar->x() > width()/2 ;
+ }
mView->writeSettings();
if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName()))
save();
}
void MainWindow::slotModifiedChanged( bool changed )
{
if ( mBlockAtStartup )
return;
@@ -1800,57 +1899,96 @@ void MainWindow::keyPressEvent ( QKeyEvent * e )
;// setCaptionToDates();
}
}
void MainWindow::fillFilterMenu()
{
selectFilterMenu->clear();
- bool disable = false;
selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 );
selectFilterMenu->insertSeparator();
- if ( mView->filterView()->filtersEnabled() ) {
- selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 1 );
- }
- else {
- selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 1 );
- disable = true;
- }
+ selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 );
+
selectFilterMenu->insertSeparator();
QPtrList<CalFilter> fili = mView->filters();
CalFilter *curfilter = mView->filterView()->selectedFilter();
CalFilter *filter = fili.first();
int iii = 2;
+ bool checkitem = mView->filterView()->filtersEnabled();
while(filter) {
selectFilterMenu->insertItem( filter->name(), iii );
if ( filter == curfilter)
- selectFilterMenu->setItemChecked( iii, true );
- if ( disable )
- selectFilterMenu->setItemEnabled( iii, false );
+ selectFilterMenu->setItemChecked( iii, checkitem );
filter = fili.next();
++iii;
}
+ if ( !checkitem )
+ selectFilterMenu->setItemChecked( 1, true );
+}
+void MainWindow::fillFilterMenuPopup()
+{
+ filterPopupMenu->clear();
+ filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 );
+
+ filterPopupMenu->insertSeparator();
+ QPtrList<CalFilter> fili = mView->filters();
+ CalFilter *curfilter = mView->filterView()->selectedFilter();
+ CalFilter *filter = fili.first();
+ int iii = 1;
+ bool checkitem = mView->filterView()->filtersEnabled();
+ while(filter) {
+ filterPopupMenu->insertItem( filter->name(), iii );
+ if ( filter == curfilter)
+ filterPopupMenu->setItemChecked( iii, checkitem );
+ filter = fili.next();
+ ++iii;
+ }
+ if ( !checkitem )
+ filterPopupMenu->setItemChecked( 0, true );
}
void MainWindow::selectFilter( int fil )
{
+
if ( fil == 0 ) {
mView->editFilters( );
} else if ( fil == 1 ){
- mView->toggleFilerEnabled( );
+ if ( mView->filterView()->filtersEnabled() )
+ mView->toggleFilerEnabled( );
} else {
+ if ( !mView->filterView()->filtersEnabled() )
+ mView->toggleFilerEnabled( );
mView->selectFilter( fil-2 );
+ }
+}
+void MainWindow::updateFilterToolbar()
+{
+ if ( filterMenubar ) {
+ if ( !mView->filterView()->filtersEnabled() ) {
+ filterMenubar->changeItem( 0, i18n("No Filter") );
+ } else {
+ CalFilter *curfilter = mView->filterView()->selectedFilter();
+ if ( curfilter ) {
+ filterMenubar->changeItem( 0, curfilter->name() );
+ }
+ }
}
}
+void MainWindow::selectFilterPopup( int fil )
+{
+ selectFilter( fil + 1 );
+
+}
void MainWindow::configureToolBar( int item )
{
configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) );
KOPrefs *p = KOPrefs::instance();
p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 );
+ p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 );
p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 );
p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 );
p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 );
p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 );
p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 );
p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 );
p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 );
p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 );
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index b3041dc..79fb305 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -19,16 +19,17 @@ class QAction;
class CalendarView;
class KSyncProfile;
#ifdef DESKTOP_VERSION
#define QPEToolBar QToolBar
#define QPEMenuBar QMenuBar
#endif
class QPEToolBar;
+class QPEMenuBar;
namespace KCal {
class CalendarLocal;
}
class KOMenuBar : public QMenuBar
{
@@ -48,16 +49,17 @@ class MainWindow : public QMainWindow
bool beamReceiveEnabled();
static QString defaultFileName();
static QString syncFileName();
static QString resourcePath();
public slots:
void setCaption ( const QString & );
void updateWeekNum(const KCal::DateList &);
void updateWeek(QDate);
+ void updateFilterToolbar();
virtual void showMaximized ();
void configureAgenda( int );
void recieve( const QCString& msg, const QByteArray& data );
protected slots:
void setCaptionToDates();
void weekAction();
void about();
void licence();
@@ -88,16 +90,18 @@ class MainWindow : public QMainWindow
void configureToolBar( int );
void printSel();
void printCal();
void saveCalendar();
void loadCalendar();
void exportVCalendar();
void fillFilterMenu();
void selectFilter( int );
+ void fillFilterMenuPopup();
+ void selectFilterPopup( int );
void exportToPhone( int );
void toggleBeamReceive();
void disableBR(bool);
signals:
void selectWeek ( int );
private slots:
void showConfigureAgenda();
void getFile( bool );
@@ -109,23 +113,28 @@ class MainWindow : public QMainWindow
void displayText( QString, QString);
void enableIncidenceActions( bool );
private:
bool mBRdisabled;
#ifndef DESKTOP_VERSION
QCopChannel* infrared;
#endif
- QAction* brAction;
+ QAction* brAction;
KSyncManager* mSyncManager;
bool mClosed;
void saveOnClose();
bool mFlagKeyPressed;
bool mBlockAtStartup;
QPEToolBar *iconToolBar;
+ QPEToolBar *viewToolBar;
+ QPEToolBar *navigatorToolBar;
+ QPEToolBar *filterToolBar;
+ QPEMenuBar *filterMenubar;
+ QPopupMenu * filterPopupMenu;
void initActions();
void setDefaultPreferences();
void keyPressEvent ( QKeyEvent * ) ;
void keyReleaseEvent ( QKeyEvent * ) ;
QPopupMenu *configureToolBarMenu;
QPopupMenu *selectFilterMenu;
QPopupMenu *configureAgendaMenu, *syncMenu;
CalendarLocal *mCalendar;