-rw-r--r-- | korganizer/kofilterview.cpp | 8 | ||||
-rw-r--r-- | korganizer/kofilterview.h | 6 | ||||
-rw-r--r-- | korganizer/kotodoview.cpp | 15 |
3 files changed, 25 insertions, 4 deletions
diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp index 6a6fff9..e86ec95 100644 --- a/korganizer/kofilterview.cpp +++ b/korganizer/kofilterview.cpp @@ -1,79 +1,80 @@ /* 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 <qcheckbox.h> #include <qcombobox.h> #include <qpushbutton.h> #include <qlayout.h> #include <qlabel.h> #include <qdialog.h> #include <qtextstream.h> #include <qtextcodec.h> +#include <qwhatsthis.h> #include <libkcal/calfilter.h> #include "kofilterview.h" #include "koprefs.h" #include <kiconloader.h> #include <kglobal.h> #include <kglobalsettings.h> #include <kcolorbutton.h> #include <kmessagebox.h> KOFilterView::KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent, const char* name,WFlags fl ) : KOFilterView_base(parent,name,fl) { mFilters = filterList; connect(mSelectionCombo,SIGNAL(activated(int)),SIGNAL(filterChanged())); connect(mEnabledCheck,SIGNAL(clicked()),SIGNAL(filterChanged())); connect(mEditButton,SIGNAL(clicked()),SIGNAL(editFilters())); } KOFilterView::~KOFilterView() { // no need to delete child widgets, Qt does it all for us } bool KOFilterView::filtersEnabled() { return mEnabledCheck->isChecked(); } void KOFilterView::setFiltersEnabled(bool set) { mEnabledCheck->setChecked(set); emit filterChanged(); } void KOFilterView::updateFilters() { mSelectionCombo->clear(); @@ -206,132 +207,137 @@ void KOCalEditView::setColor( const QColor& c, int id ) void KOCalEditView::deleteCal( int id ) { KopiCalendarFile * kkf = KOPrefs::instance()->getCalendar( id ); QString name = kkf->mName; QString file = KGlobal::formatMessage ( kkf->mFileName ,0 ); if ( KMessageBox::warningContinueCancel( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>. Do you want to remove this calendar from KO/Pi? (The file is not removed!)").arg(name).arg(file) ) != KMessageBox::Continue ) return; bool findnewstd = kkf->isStandard; emit removeCalendar ( id ); KOPrefs::instance()->mCalendars.remove ( kkf ); if ( findnewstd ) findNewStandard(); emit needsUpdate(); QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); } void KOCalEditView::infoCal( int id ) { QString name = KOPrefs::instance()->getCalendar( id )->mName; QString file = KGlobal::formatMessage ( KOPrefs::instance()->getCalendar( id )->mFileName, 0 ); if ( KOPrefs::instance()->getCalendar( id )->mErrorOnLoad ) { if ( KMessageBox::Yes == KMessageBox::questionYesNo( this, i18n("The calendar <b>%1</b> is not loaded! Loading of file <b>%2</b> failed! <b>Try again to load the calendar?</b>").arg(name).arg(file) ) ) { emit calendarAdded( id ); emit needsUpdate(); QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); QTimer::singleShot( 100, this, SIGNAL ( checkCalendar() ) ); } } else KMessageBox::information( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>").arg(name).arg(file) ); } void KOCalEditView::readConfig() { mStdandardB.clear(); mEnabledB.clear(); mAlarmB.clear(); mROB.clear(); if ( mw ) delete mw; mw = new QWidget ( viewport() ); addChild(mw); int ii = 0; mainLayout = new QGridLayout ( mw , 2, 8 ); mainLayout->setMargin( 2 ); mainLayout->setSpacing( 2 ); QPushButton * addButT = new QPushButton ( mw ); addButT->setFocusPolicy(NoFocus); mainLayout->addWidget( addButT,0,0 ); addButT->setText( "D"); connect(addButT,SIGNAL(clicked()),SLOT(defaultInfo())); + QWhatsThis::add( addButT, i18n("Please choose the <b>default calendar</b> in this column. Newly created or imported items are added to the default calendar.") ); //addBut->setPixmap ( SmallIcon("greenhook16")); QPushButton *addBut = new QPushButton ( mw ); addBut->setFocusPolicy(NoFocus); mainLayout->addWidget( addBut,0,++ii ); addBut->setPixmap ( SmallIcon("eye")); + QWhatsThis::add( addBut, i18n("In this column you can <b>set a calendar to be visible</b>. If a calendar is not visible its entries are not displayed in the views. You can add items to it and it is loaded/saved as usual.") ); connect(addBut,SIGNAL(clicked()),SLOT(enableAll())); int max = addBut->sizeHint().height(); addBut->setMaximumWidth( max ); addButT->setFixedSize( QSize( max, max ) ); QLabel* lab = new QLabel (i18n(" Calendar \n Resource "), mw ); mainLayout->addWidget( lab,0,++ii ); + QWhatsThis::add( lab, i18n("In this column you can see the <b>name of the calendar</b>. If you click on the name button you will get an information box about the loaded calendar file. If the file was not loaded at startup you can try to load it here again.") ); //lab = new QLabel ( i18n(" "), mw ); //mainLayout->addWidget( lab,0,++ii ); //lab->setFixedWidth( 1 ); addBut = new QPushButton ( mw ); addBut->setFocusPolicy(NoFocus); mainLayout->addWidget( addBut,0,++ii ); addBut->setPixmap ( SmallIcon("bell")); + QWhatsThis::add( addBut, i18n("In this column you can <b>disable the alarms of a calendar all together</b>. The alarm data in the calendar itself is not changed, the alarms are marked internally as \"do not use\". Useful if you load a calendar of another person but do not want to get notified about alarms of that person.") ); connect(addBut,SIGNAL(clicked()),SLOT(enableAlarm())); addBut->setMaximumWidth( addBut->sizeHint().height() ); addBut = new QPushButton ( mw ); addBut->setFocusPolicy(NoFocus); mainLayout->addWidget( addBut,0,++ii ); addBut->setPixmap ( SmallIcon("pencil")); + QWhatsThis::add( addBut, i18n("In this column you can <b>set a calendar and all entries of the calendar to read only</b>. If a calendar is readonly the entries cannot be edited and no items can be added to the calendar. If you change a setting of a calendar to readonly in this column all data will be saved because the data of a readonly calendar is not saved later.") ); connect(addBut,SIGNAL(clicked()),SLOT(disableRO())); addBut->setMaximumWidth( addBut->sizeHint().height() ); lab = new QLabel ( "", mw ); mainLayout->addWidget( lab,0,++ii ); addBut = new QPushButton ( mw ); addBut->setFocusPolicy(NoFocus); mainLayout->addWidget( addBut,0,++ii ); addBut->setPixmap ( SmallIcon("plus")); connect(addBut,SIGNAL(clicked()),SLOT(addCal())); - + QWhatsThis::add( addBut, i18n("Click this button to <b>add a calendar</b>. You can add an existing calendar file or you can add a new calendar and KO/Pi creates a new empty calendar file for you.") ); lab = new QLabel ( " ", mw ); mainLayout->addWidget( lab,0,++ii ); KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); int row = 1; bool errorLoadStandard = false; while ( kkf ) { int iii = 0; KOCalRadioButton* rb = new KOCalRadioButton( mw ); mainLayout->addWidget( rb,row,0 );mStdandardB.append( rb ); rb->setChecked( kkf->isStandard ); if ( kkf->isStandard && ( kkf->mErrorOnLoad || kkf->isReadOnly ) ) errorLoadStandard = true; rb->setNum( kkf->mCalNumber ); connect (rb, SIGNAL (selectNum(int)), SLOT ( selectStdCal(int) ) ); if ( kkf->mErrorOnLoad || kkf->isReadOnly ) rb->setEnabled( false ); KOCalCheckButton* cb = new KOCalCheckButton( mw ); mainLayout->addWidget( cb,row,++iii );mEnabledB.append( cb ); cb->setChecked( kkf->isEnabled && !kkf->mErrorOnLoad ); cb->setNum( kkf->mCalNumber ); if ( kkf->mErrorOnLoad ) cb->setEnabled( false ); connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCal(int,bool) ) ); KOCalButton* name = new KOCalButton( mw ); name->setNum( kkf->mCalNumber ); name->setText( kkf->mName ); mainLayout->addWidget( name,row,++iii ); connect (name, SIGNAL (selectNum(int)), SLOT ( infoCal(int) ) ); //lab = new QLabel (" ", mw ); //mainLayout->addWidget( lab,row,++iii ); cb = new KOCalCheckButton( mw ); mainLayout->addWidget( cb,row,++iii );mAlarmB.append( cb ); cb->setChecked( kkf->isAlarmEnabled && !kkf->mErrorOnLoad); cb->setNum( kkf->mCalNumber ); connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCalAlarm(int,bool) ) ); if ( kkf->mErrorOnLoad ) cb->setEnabled( false ); cb = new KOCalCheckButton( mw ); mainLayout->addWidget( cb,row,++iii );mROB.append( cb ); cb->setChecked( kkf->isReadOnly ); cb->setNum( kkf->mCalNumber ); connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectReadOnly(int,bool) ) ); if ( kkf->mErrorOnLoad ) cb->setEnabled( false ); if ( row > 1) { KColorButton *colb = new KColorButton( mw ); diff --git a/korganizer/kofilterview.h b/korganizer/kofilterview.h index be7b5b6..d534dbf 100644 --- a/korganizer/kofilterview.h +++ b/korganizer/kofilterview.h @@ -16,108 +16,108 @@ 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. */ #ifndef KOFILTERVIEW_H #define KOFILTERVIEW_H #include <qstring.h> #include <qcheckbox.h> #include <qapplication.h> #include <qradiobutton.h> #include <qlayout.h> #include <qlabel.h> #include <qdialog.h> #include <qscrollview.h> #include <qpushbutton.h> #include <kconfig.h> #include "kofilterview_base.h" #include <libkcal/calfilter.h> #include <kurlrequester.h> #include <klineedit.h> #include <kglobal.h> #include <kmessagebox.h> class QGridLayout; using namespace KCal; class KONewCalPrefs : public QDialog { Q_OBJECT public: KONewCalPrefs( QWidget *parent=0, const char *name=0 ) : QDialog( parent, name, true ) { setCaption( i18n("Add new Calendar") ); QVBoxLayout* lay = new QVBoxLayout( this ); lay->setSpacing( 3 ); lay->setMargin( 3 ); QLabel * lab = new QLabel( i18n("<b>Name of new calendar:</b>"), this ); lay->addWidget( lab ); nameE = new KLineEdit( this ); lay->addWidget( nameE ); - lab = new QLabel( i18n("<b>Local ical (*.ics) file:</b>"), this ); + lab = new QLabel( i18n("<b>iCal (*.ics) file on disk:</b><br>(will be created, if not existing)"), this ); lay->addWidget( lab ); url = new KURLRequester ( this ); lay->addWidget( url ); QPushButton * ok = new QPushButton( i18n("OK"), this ); lay->addWidget( ok ); QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); lay->addWidget( cancel ); connect ( ok,SIGNAL(clicked() ),this , SLOT ( checkValid() ) ); connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); - int minwid = 220; - if ( QApplication::desktop()->width() >= 320 ) minwid = 300; + int minwid = 440; + if ( QApplication::desktop()->width() < 480 ) minwid = 220; setMinimumWidth( minwid ); resize(sizeHint() ); } QString calName() { return nameE->text(); } QString calFileName() { return url->url(); } public slots: void checkValid() { if ( nameE->text().isEmpty() ) { KMessageBox::information( this, i18n("Sorry, the calendar name is empty!") ); nameE->setText( "LPQJ_"+ QString::number( QTime::currentTime().msec () )); return; } if ( url->url().isEmpty() ) { KMessageBox::information( this, i18n("Sorry, the file name is empty!") ); url->setURL( nameE->text() + ".ics" ); return; } accept(); } public: KLineEdit* nameE; KURLRequester *url; }; class KOCalButton : public QPushButton { Q_OBJECT public: KOCalButton( QWidget *parent=0, const char *name=0 ) : QPushButton( parent, name) { connect( this, SIGNAL( clicked() ), SLOT( bottonClicked() )); mNumber = -1; setFocusPolicy(NoFocus); } void setNum ( int num ) {mNumber = num; } signals: void selectNum ( int ); private: int mNumber; void keyPressEvent ( QKeyEvent * e ) { e->ignore(); } diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 27d755e..17248dc 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp @@ -438,166 +438,181 @@ void KOTodoListView::keyPressEvent ( QKeyEvent * e ) if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { switch ( e->key() ) { case Qt::Key_Down: case Qt::Key_Up: QListView::keyPressEvent ( e ); e->accept(); break; case Qt::Key_Left: case Qt::Key_Right: QListView::keyPressEvent ( e ); e->accept(); return; break; default: e->ignore(); break; } return; } e->ignore(); } void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) { QListView::contentsMouseReleaseEvent(e); mMousePressed = false; } void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) { if (!e) return; QPoint vp = contentsToViewport(e->pos()); QListViewItem *item = itemAt(vp); emit double_Clicked(item); if (!item) return; emit doubleClicked(item,vp,0); } ///////////////////////////////////////////////////////////////////////////// KOQuickTodo::KOQuickTodo(QWidget *parent) : QLineEdit(parent) { setText(i18n("Click to add new Todo")); + setFocusPolicy ( QWidget::ClickFocus ); } void KOQuickTodo::focusInEvent(QFocusEvent *ev) { if ( text()==i18n("Click to add new Todo") ) setText(""); QLineEdit::focusInEvent(ev); } void KOQuickTodo::focusOutEvent(QFocusEvent *ev) { setText(i18n("Click to add new Todo")); QLineEdit::focusOutEvent(ev); } ///////////////////////////////////////////////////////////////////////////// KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : KOrg::BaseView(calendar,parent,name) { mActiveItem = 0; mCategoryPopupMenu = 0; mPendingUpdateBeforeRepaint = false; isFlatDisplay = false; mNavigator = 0; QBoxLayout *topLayout = new QVBoxLayout(this); mName = QString ( name ); mBlockUpdate = false; mQuickBar = new QWidget( this ); topLayout->addWidget(mQuickBar); mQuickAdd = new KOQuickTodo(mQuickBar); QBoxLayout *quickLayout = new QHBoxLayout(mQuickBar); quickLayout->addWidget( mQuickAdd ); mNewSubBut = new QPushButton( "sub",mQuickBar ); QPushButton * s_done = new QPushButton( "D",mQuickBar ); QPushButton * s_run = new QPushButton( "R",mQuickBar ); QPushButton * allopen = new QPushButton( "O",mQuickBar ); QPushButton * allclose = new QPushButton( "C",mQuickBar ); QPushButton * flat = new QPushButton( "F",mQuickBar ); int fixwid = mQuickAdd->sizeHint().height(); int fixhei = fixwid; if ( QApplication::desktop()->width() > 800 ) fixwid = (fixwid*3)/2; connect ( flat, SIGNAL ( clicked()), SLOT ( setAllFlat())); connect ( allopen, SIGNAL ( clicked()), SLOT ( setAllOpen())); connect ( allclose, SIGNAL ( clicked()), SLOT ( setAllClose())); s_done->setPixmap( SmallIcon("greenhook16")); connect ( s_done, SIGNAL ( clicked()), SLOT ( toggleCompleted())); s_run->setPixmap( SmallIcon("ko16old")); connect ( s_run, SIGNAL ( clicked()), SLOT ( toggleRunning())); connect ( mNewSubBut, SIGNAL ( clicked()), SLOT ( newSubTodo())); mNewSubBut->setFixedWidth(mNewSubBut->sizeHint().width() ); mNewSubBut->setEnabled( false ); flat->setFixedWidth( fixwid ); s_done->setFixedWidth( fixwid ); allopen->setFixedWidth( fixwid ); allclose->setFixedWidth( fixwid ); s_run->setFixedWidth( fixwid ); flat->setFixedHeight(fixhei ); s_done->setFixedHeight(fixhei ); allopen->setFixedHeight(fixhei ); allclose->setFixedHeight(fixhei ); s_run->setFixedHeight(fixhei ); mNewSubBut->setFixedHeight(fixhei ); + flat->setFocusPolicy( NoFocus ); + s_done->setFocusPolicy( NoFocus ); + allopen->setFocusPolicy( NoFocus ); + allclose->setFocusPolicy( NoFocus ); + s_run->setFocusPolicy( NoFocus ); + mNewSubBut->setFocusPolicy( NoFocus ); + + QWhatsThis::add( flat, i18n("Click this button to display all todos in a <b>flat</b> hierarchy" ) ); + QWhatsThis::add( allopen, i18n("Click this button to display all todos <b>openend</b>" ) ); + QWhatsThis::add( allclose, i18n("Click this button to display all todos <b>closed</b>" ) ); + QWhatsThis::add( s_run, i18n("Click this button to toggle show/hide <b>running</b> todos" ) ); + QWhatsThis::add( mNewSubBut, i18n("Click this button to add a new subtodo to the currently selected todo" ) ); + QWhatsThis::add( s_done, i18n("Click this button to toggle show/hide <b>completed</b> todos" ) ); + quickLayout->addWidget( mNewSubBut ); quickLayout->addWidget( s_done ); quickLayout->addWidget( s_run ); quickLayout->addWidget( allopen ); quickLayout->addWidget( allclose ); quickLayout->addWidget( flat ); if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickBar->hide(); mTodoListView = new KOTodoListView(calendar,this, name ); topLayout->addWidget(mTodoListView); //mTodoListView->header()->setMaximumHeight(30); mTodoListView->setRootIsDecorated(true); mTodoListView->setAllColumnsShowFocus(true); mTodoListView->setShowSortIndicator(true); mTodoListView->addColumn(i18n("Todo")); mTodoListView->addColumn(i18n("Prio")); mTodoListView->setColumnAlignment(1,AlignHCenter); mTodoListView->addColumn(i18n("Complete")); mTodoListView->setColumnAlignment(2,AlignCenter); mTodoListView->addColumn(i18n("Due Date")); mTodoListView->setColumnAlignment(3,AlignLeft); mTodoListView->addColumn(i18n("Due Time")); mTodoListView->setColumnAlignment(4,AlignHCenter); mTodoListView->addColumn(i18n("Start Date")); mTodoListView->setColumnAlignment(5,AlignLeft); mTodoListView->addColumn(i18n("Start Time")); mTodoListView->setColumnAlignment(6,AlignHCenter); //mTodoListView->addColumn(i18n("Cancelled")); mTodoListView->addColumn(i18n("Categories")); mTodoListView->addColumn(i18n("Calendar")); mTodoListView->addColumn(i18n("Last Modified")); mTodoListView->addColumn(i18n("Created")); mTodoListView->addColumn(i18n("Last Modified Sub")); #if 0 mTodoListView->addColumn(i18n("Sort Id")); mTodoListView->setColumnAlignment(4,AlignHCenter); #endif mTodoListView->setMinimumHeight( 60 ); mTodoListView->setItemsRenameable( true ); mTodoListView->setRenameable( 0 ); mTodoListView->setColumnWidth( 0, 120 ); |