Diffstat (limited to 'korganizer/filtereditdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | korganizer/filtereditdialog.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/korganizer/filtereditdialog.cpp b/korganizer/filtereditdialog.cpp index df84911..a3cff49 100644 --- a/korganizer/filtereditdialog.cpp +++ b/korganizer/filtereditdialog.cpp | |||
@@ -1,115 +1,120 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qlayout.h> | 24 | #include <qlayout.h> |
25 | #include <qpushbutton.h> | 25 | #include <qpushbutton.h> |
26 | #include <qcombobox.h> | 26 | #include <qcombobox.h> |
27 | #include <qcheckbox.h> | 27 | #include <qcheckbox.h> |
28 | #include <qradiobutton.h> | 28 | #include <qradiobutton.h> |
29 | #include <qlistbox.h> | 29 | #include <q3listbox.h> |
30 | #include <qapplication.h> | 30 | #include <qapplication.h> |
31 | //Added by qt3to4: | ||
32 | #include <Q3GridLayout> | ||
33 | #include <Q3PtrList> | ||
34 | |||
35 | #include <QDesktopWidget> | ||
31 | 36 | ||
32 | #include <kdebug.h> | 37 | #include <kdebug.h> |
33 | #include <klocale.h> | 38 | #include <klocale.h> |
34 | #include <klineeditdlg.h> | 39 | #include <klineeditdlg.h> |
35 | #include <kmessagebox.h> | 40 | #include <kmessagebox.h> |
36 | 41 | ||
37 | #include <libkdepim/categoryselectdialog.h> | 42 | #include <libkdepim/categoryselectdialog.h> |
38 | 43 | ||
39 | #include "koprefs.h" | 44 | #include "koprefs.h" |
40 | #include "filteredit_base.h" | 45 | #include "filteredit_base.h" |
41 | 46 | ||
42 | #include "filtereditdialog.h" | 47 | #include "filtereditdialog.h" |
43 | //#include "filtereditdialog.moc" | 48 | //#include "filtereditdialog.moc" |
44 | 49 | ||
45 | // TODO: Make dialog work on a copy of the filters objects. | 50 | // TODO: Make dialog work on a copy of the filters objects. |
46 | 51 | ||
47 | class ComboFilterBox: public QComboBox | 52 | class ComboFilterBox: public QComboBox |
48 | { | 53 | { |
49 | public: | 54 | public: |
50 | ComboFilterBox( QWidget *parent=0, const char *name=0) : | 55 | ComboFilterBox( QWidget *parent=0, const char *name=0) : |
51 | QComboBox( parent,name ) { } | 56 | QComboBox( parent,name ) { } |
52 | void popupBox() { popup(); } | 57 | void popupBox() { popup(); } |
53 | 58 | ||
54 | }; | 59 | }; |
55 | 60 | ||
56 | FilterEditDialog::FilterEditDialog(QPtrList<CalFilter> *filters,QWidget *parent, | 61 | FilterEditDialog::FilterEditDialog(Q3PtrList<CalFilter> *filters,QWidget *parent, |
57 | const char *name) : | 62 | const char *name) : |
58 | KDialogBase(parent,name,true,i18n("Edit Calendar Filters"), | 63 | KDialogBase(parent,name,true,i18n("Edit Calendar Filters"), |
59 | Ok|Apply|Cancel) | 64 | Ok|Apply|Cancel) |
60 | { | 65 | { |
61 | mFilters = filters; | 66 | mFilters = filters; |
62 | 67 | ||
63 | QWidget *mainWidget = new QWidget(this); | 68 | QWidget *mainWidget = new QWidget(this); |
64 | setMainWidget(mainWidget); | 69 | setMainWidget(mainWidget); |
65 | 70 | ||
66 | mSelectionCombo = new ComboFilterBox(mainWidget); | 71 | mSelectionCombo = new ComboFilterBox(mainWidget); |
67 | connect(mSelectionCombo,SIGNAL(activated(int)),SLOT(filterSelected())); | 72 | connect(mSelectionCombo,SIGNAL(activated(int)),SLOT(filterSelected())); |
68 | // mSelectionCombo->setEditable ( true ); | 73 | // mSelectionCombo->setEditable ( true ); |
69 | QPushButton *addButton = new QPushButton(i18n("Add Filter"),mainWidget); | 74 | QPushButton *addButton = new QPushButton(i18n("Add Filter"),mainWidget); |
70 | connect(addButton,SIGNAL(clicked()),SLOT(slotAdd())); | 75 | connect(addButton,SIGNAL(clicked()),SLOT(slotAdd())); |
71 | addButton->setMaximumSize( addButton->sizeHint()); | 76 | addButton->setMaximumSize( addButton->sizeHint()); |
72 | mRemoveButton = new QPushButton( i18n("Remove"), mainWidget ); | 77 | mRemoveButton = new QPushButton( i18n("Remove"), mainWidget ); |
73 | connect( mRemoveButton, SIGNAL( clicked() ), SLOT( slotRemove() ) ); | 78 | connect( mRemoveButton, SIGNAL( clicked() ), SLOT( slotRemove() ) ); |
74 | mRemoveButton->setMaximumSize( mRemoveButton->sizeHint()); | 79 | mRemoveButton->setMaximumSize( mRemoveButton->sizeHint()); |
75 | 80 | ||
76 | QPushButton *upButton = new QPushButton(i18n("Up"),mainWidget); | 81 | QPushButton *upButton = new QPushButton(i18n("Up"),mainWidget); |
77 | upButton->setMaximumSize( upButton->sizeHint()); | 82 | upButton->setMaximumSize( upButton->sizeHint()); |
78 | connect(upButton,SIGNAL(clicked()),SLOT(slotUp())); | 83 | connect(upButton,SIGNAL(clicked()),SLOT(slotUp())); |
79 | 84 | ||
80 | 85 | ||
81 | mEditor = new FilterEdit_base(mainWidget); | 86 | mEditor = new FilterEdit_base(mainWidget); |
82 | 87 | ||
83 | QGridLayout *topLayout = new QGridLayout(mainWidget,2,2); | 88 | Q3GridLayout *topLayout = new Q3GridLayout(mainWidget,2,2); |
84 | topLayout->setSpacing(spacingHint()); | 89 | topLayout->setSpacing(spacingHint()); |
85 | topLayout->addWidget(mSelectionCombo,0,0); | 90 | topLayout->addWidget(mSelectionCombo,0,0); |
86 | topLayout->addWidget(upButton,0,1); | 91 | topLayout->addWidget(upButton,0,1); |
87 | topLayout->addWidget(addButton,0,2); | 92 | topLayout->addWidget(addButton,0,2); |
88 | topLayout->addWidget(mRemoveButton,0,3); | 93 | topLayout->addWidget(mRemoveButton,0,3); |
89 | topLayout->addMultiCellWidget(mEditor,1,1,0,3); | 94 | topLayout->addMultiCellWidget(mEditor,1,1,0,3); |
90 | mSelectionCombo->setMaximumWidth ( QApplication::desktop()->width() - | 95 | mSelectionCombo->setMaximumWidth ( QApplication::desktop()->width() - |
91 | addButton->maximumWidth() - | 96 | addButton->maximumWidth() - |
92 | mRemoveButton->maximumWidth() - | 97 | mRemoveButton->maximumWidth() - |
93 | upButton->maximumWidth() - | 98 | upButton->maximumWidth() - |
94 | spacingHint() * 5 ); | 99 | spacingHint() * 5 ); |
95 | connect(mEditor->mCatEditButton,SIGNAL(clicked()), | 100 | connect(mEditor->mCatEditButton,SIGNAL(clicked()), |
96 | SLOT(editCategorySelection())); | 101 | SLOT(editCategorySelection())); |
97 | 102 | ||
98 | // Clicking cancel exits the dialog without saving | 103 | // Clicking cancel exits the dialog without saving |
99 | connect(this,SIGNAL(cancelClicked()),SLOT(reject())); | 104 | connect(this,SIGNAL(cancelClicked()),SLOT(reject())); |
100 | updateFilterList(); | 105 | updateFilterList(); |
101 | } | 106 | } |
102 | 107 | ||
103 | FilterEditDialog::~FilterEditDialog() | 108 | FilterEditDialog::~FilterEditDialog() |
104 | { | 109 | { |
105 | } | 110 | } |
106 | void FilterEditDialog::slotUp() | 111 | void FilterEditDialog::slotUp() |
107 | { | 112 | { |
108 | 113 | ||
109 | if ( mFilters->count() <= 1 ) return; | 114 | if ( mFilters->count() <= 1 ) return; |
110 | if ( mSelectionCombo->currentItem() == 0 ) return; | 115 | if ( mSelectionCombo->currentItem() == 0 ) return; |
111 | int num = mSelectionCombo->currentItem(); | 116 | int num = mSelectionCombo->currentItem(); |
112 | CalFilter* f = new CalFilter( ); | 117 | CalFilter* f = new CalFilter( ); |
113 | *f = *(mFilters->at( num )); | 118 | *f = *(mFilters->at( num )); |
114 | mFilters->remove( num ); | 119 | mFilters->remove( num ); |
115 | mFilters->insert( num-1, f ); | 120 | mFilters->insert( num-1, f ); |