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