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