00001 #include <kdialog.h>
00002 #include <klocale.h>
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "filteredit_base.h"
00013
00014 #include <qvariant.h>
00015 #include <qpushbutton.h>
00016 #include <qlistbox.h>
00017 #include <qbuttongroup.h>
00018 #include <qlabel.h>
00019 #include <qlineedit.h>
00020 #include <qcheckbox.h>
00021 #include <knuminput.h>
00022 #include <qradiobutton.h>
00023 #include <qlayout.h>
00024 #include <qtooltip.h>
00025 #include <qwhatsthis.h>
00026 #include "knuminput.h"
00027
00028
00029
00030
00031
00032 FilterEdit_base::FilterEdit_base( QWidget* parent, const char* name, WFlags fl )
00033 : QWidget( parent, name, fl )
00034 {
00035 if ( !name )
00036 setName( "FilterEdit_base" );
00037 FilterEdit_baseLayout = new QGridLayout( this, 1, 1, 11, 6, "FilterEdit_baseLayout");
00038
00039 mRulesList = new QListBox( this, "mRulesList" );
00040
00041 FilterEdit_baseLayout->addMultiCellWidget( mRulesList, 0, 0, 0, 1 );
00042
00043 mNewButton = new QPushButton( this, "mNewButton" );
00044
00045 FilterEdit_baseLayout->addWidget( mNewButton, 1, 0 );
00046
00047 mDeleteButton = new QPushButton( this, "mDeleteButton" );
00048
00049 FilterEdit_baseLayout->addWidget( mDeleteButton, 1, 1 );
00050
00051 mDetailsFrame = new QButtonGroup( this, "mDetailsFrame" );
00052 mDetailsFrame->setColumnLayout(0, Qt::Vertical );
00053 mDetailsFrame->layout()->setSpacing( 6 );
00054 mDetailsFrame->layout()->setMargin( 11 );
00055 mDetailsFrameLayout = new QGridLayout( mDetailsFrame->layout() );
00056 mDetailsFrameLayout->setAlignment( Qt::AlignTop );
00057
00058 layout3 = new QHBoxLayout( 0, 0, 6, "layout3");
00059
00060 textLabel1 = new QLabel( mDetailsFrame, "textLabel1" );
00061 layout3->addWidget( textLabel1 );
00062
00063 mNameLineEdit = new QLineEdit( mDetailsFrame, "mNameLineEdit" );
00064 layout3->addWidget( mNameLineEdit );
00065
00066 mDetailsFrameLayout->addLayout( layout3, 0, 0 );
00067
00068 mRecurringCheck = new QCheckBox( mDetailsFrame, "mRecurringCheck" );
00069
00070 mDetailsFrameLayout->addWidget( mRecurringCheck, 1, 0 );
00071
00072 mCompletedCheck = new QCheckBox( mDetailsFrame, "mCompletedCheck" );
00073
00074 mDetailsFrameLayout->addWidget( mCompletedCheck, 2, 0 );
00075
00076 layout1 = new QHBoxLayout( 0, 0, 6, "layout1");
00077 spacer2 = new QSpacerItem( 15, 20, QSizePolicy::Fixed, QSizePolicy::Minimum );
00078 layout1->addItem( spacer2 );
00079
00080 mCompletedTimeSpanLabel = new QLabel( mDetailsFrame, "mCompletedTimeSpanLabel" );
00081 mCompletedTimeSpanLabel->setEnabled( FALSE );
00082 layout1->addWidget( mCompletedTimeSpanLabel );
00083
00084 mCompletedTimeSpan = new KIntNumInput( mDetailsFrame, "mCompletedTimeSpan" );
00085 mCompletedTimeSpan->setEnabled( FALSE );
00086 mCompletedTimeSpan->setMinValue( 0 );
00087 mCompletedTimeSpan->setMaxValue( 999 );
00088 layout1->addWidget( mCompletedTimeSpan );
00089 spacer3 = new QSpacerItem( 16, 21, QSizePolicy::Expanding, QSizePolicy::Minimum );
00090 layout1->addItem( spacer3 );
00091
00092 mDetailsFrameLayout->addLayout( layout1, 3, 0 );
00093
00094 mHideInactiveTodosCheck = new QCheckBox( mDetailsFrame, "mHideInactiveTodosCheck" );
00095
00096 mDetailsFrameLayout->addWidget( mHideInactiveTodosCheck, 4, 0 );
00097
00098 mCategoriesButtonGroup = new QButtonGroup( mDetailsFrame, "mCategoriesButtonGroup" );
00099 mCategoriesButtonGroup->setColumnLayout(0, Qt::Vertical );
00100 mCategoriesButtonGroup->layout()->setSpacing( 6 );
00101 mCategoriesButtonGroup->layout()->setMargin( 11 );
00102 mCategoriesButtonGroupLayout = new QGridLayout( mCategoriesButtonGroup->layout() );
00103 mCategoriesButtonGroupLayout->setAlignment( Qt::AlignTop );
00104
00105 mCatList = new QListBox( mCategoriesButtonGroup, "mCatList" );
00106 mCatList->setSelectionMode( QListBox::NoSelection );
00107
00108 mCategoriesButtonGroupLayout->addMultiCellWidget( mCatList, 2, 3, 0, 0 );
00109 spacer4 = new QSpacerItem( 20, 110, QSizePolicy::Minimum, QSizePolicy::Expanding );
00110 mCategoriesButtonGroupLayout->addItem( spacer4, 3, 1 );
00111
00112 mCatHideCheck = new QRadioButton( mCategoriesButtonGroup, "mCatHideCheck" );
00113 mCategoriesButtonGroup->insert( mCatHideCheck, 1 );
00114
00115 mCategoriesButtonGroupLayout->addMultiCellWidget( mCatHideCheck, 1, 1, 0, 1 );
00116
00117 mCatShowCheck = new QRadioButton( mCategoriesButtonGroup, "mCatShowCheck" );
00118 mCategoriesButtonGroup->insert( mCatShowCheck, 0 );
00119
00120 mCategoriesButtonGroupLayout->addMultiCellWidget( mCatShowCheck, 0, 0, 0, 1 );
00121
00122 mCatEditButton = new QPushButton( mCategoriesButtonGroup, "mCatEditButton" );
00123
00124 mCategoriesButtonGroupLayout->addWidget( mCatEditButton, 2, 1 );
00125
00126 mDetailsFrameLayout->addWidget( mCategoriesButtonGroup, 6, 0 );
00127
00128 mHideTodosNotAssignedToMeCheck = new QCheckBox( mDetailsFrame, "mHideTodosNotAssignedToMeCheck" );
00129
00130 mDetailsFrameLayout->addWidget( mHideTodosNotAssignedToMeCheck, 5, 0 );
00131
00132 FilterEdit_baseLayout->addMultiCellWidget( mDetailsFrame, 0, 1, 2, 2 );
00133 languageChange();
00134 resize( QSize(504, 436).expandedTo(minimumSizeHint()) );
00135 clearWState( WState_Polished );
00136
00137
00138 connect( mCompletedCheck, SIGNAL( toggled(bool) ), mCompletedTimeSpanLabel, SLOT( setEnabled(bool) ) );
00139 connect( mCompletedCheck, SIGNAL( toggled(bool) ), mCompletedTimeSpan, SLOT( setEnabled(bool) ) );
00140
00141
00142 mCompletedTimeSpanLabel->setBuddy( mCompletedTimeSpan );
00143 }
00144
00145
00146
00147
00148 FilterEdit_base::~FilterEdit_base()
00149 {
00150
00151 }
00152
00153
00154
00155
00156
00157 void FilterEdit_base::languageChange()
00158 {
00159 mNewButton->setText( tr2i18n( "&New" ) );
00160 mDeleteButton->setText( tr2i18n( "&Delete" ) );
00161 mDetailsFrame->setTitle( tr2i18n( "Filter Details" ) );
00162 textLabel1->setText( tr2i18n( "Name:" ) );
00163 mRecurringCheck->setText( tr2i18n( "Hide &recurring events and to-dos" ) );
00164 QWhatsThis::add( mRecurringCheck, tr2i18n( "Select this option if you do not want to show recurring events and to-dos in your views. Daily and weekly recurring items may take a lot of space, so it might be handy to hide them." ) );
00165 mCompletedCheck->setText( tr2i18n( "Hide co&mpleted to-dos" ) );
00166 QWhatsThis::add( mCompletedCheck, tr2i18n( "If this box is checked, the filter will hide all to-do items from the list, that have been completed. Optionally, only items that have been completed a given number of days are hidden." ) );
00167 mCompletedTimeSpanLabel->setText( tr2i18n( "Days after completion:" ) );
00168 QWhatsThis::add( mCompletedTimeSpanLabel, tr2i18n( "This option will allow you to select which completed to-dos should be hidden. When you choose <i>Immediately</i>, it will hide the to-do as soon as you check it. You can increase or decrease the number of days in the spinbox." ) );
00169 mCompletedTimeSpan->setSpecialValueText( tr2i18n( "Immediately" ) );
00170 QWhatsThis::add( mCompletedTimeSpan, tr2i18n( "Here you can give the number of days a to-do item has to be completed to be hidden from the to-do list. If you select \"Immediately\", all completed to-dos will be hidden. If you, for example, choose a value of 1, all to-do items will be hidden, that have been marked finished longer than 24 hours ago." ) );
00171 mHideInactiveTodosCheck->setText( tr2i18n( "Hide &inactive to-dos" ) );
00172 QWhatsThis::add( mHideInactiveTodosCheck, tr2i18n( "This option hides all to-dos from your list, where the start date has not been reached. (Note that the start date is not the due date of the to-do item.)" ) );
00173 mCategoriesButtonGroup->setTitle( tr2i18n( "Categories" ) );
00174 mCatHideCheck->setText( tr2i18n( "Show all except selected" ) );
00175 mCatHideCheck->setAccel( QKeySequence( QString::null ) );
00176 QWhatsThis::add( mCatHideCheck, tr2i18n( "When this option is enabled, this filter will show all items which do <i>not</i> contain the selected categories." ) );
00177 mCatShowCheck->setText( tr2i18n( "Show only selected" ) );
00178 mCatShowCheck->setAccel( QKeySequence( QString::null ) );
00179 QWhatsThis::add( mCatShowCheck, tr2i18n( "When this option is enabled, this filter will show all items containing at least the selected items." ) );
00180 mCatEditButton->setText( tr2i18n( "Change..." ) );
00181 mCatEditButton->setAccel( QKeySequence( QString::null ) );
00182 mHideTodosNotAssignedToMeCheck->setText( tr2i18n( "Hide to-dos not assigned to me" ) );
00183 mHideTodosNotAssignedToMeCheck->setAccel( QKeySequence( QString::null ) );
00184 QWhatsThis::add( mHideTodosNotAssignedToMeCheck, tr2i18n( "This option hides all to-dos from your list which are assigned to someone else.<br>\n"
00185 "Only to-dos which have least one attendee will be checked. If you are not in the list of attendees the to-do will be hidden." ) );
00186 }
00187
00188 void FilterEdit_base::updateFilter()
00189 {
00190 qWarning( "FilterEdit_base::updateFilter(): Not implemented yet" );
00191 }
00192
00193 #include "filteredit_base.moc"