-rw-r--r-- | korganizer/searchdialog.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/korganizer/searchdialog.cpp b/korganizer/searchdialog.cpp index bba49f0..a8de297 100644 --- a/korganizer/searchdialog.cpp +++ b/korganizer/searchdialog.cpp | |||
@@ -45,192 +45,193 @@ | |||
45 | #include "searchdialog.h" | 45 | #include "searchdialog.h" |
46 | 46 | ||
47 | SearchDialog::SearchDialog(Calendar *calendar,CalendarView *parent) | 47 | SearchDialog::SearchDialog(Calendar *calendar,CalendarView *parent) |
48 | : QVBox( 0 ) | 48 | : QVBox( 0 ) |
49 | 49 | ||
50 | { | 50 | { |
51 | mCalendar = calendar; | 51 | mCalendar = calendar; |
52 | QFrame *topFrame = new QFrame( this ) ;//plainPage(); | 52 | QFrame *topFrame = new QFrame( this ) ;//plainPage(); |
53 | QVBoxLayout *layout = new QVBoxLayout(topFrame,KDialog::marginHint(),KDialog::spacingHint()); | 53 | QVBoxLayout *layout = new QVBoxLayout(topFrame,KDialog::marginHint(),KDialog::spacingHint()); |
54 | 54 | ||
55 | // Search expression | 55 | // Search expression |
56 | QHBoxLayout *subLayout = new QHBoxLayout(); | 56 | QHBoxLayout *subLayout = new QHBoxLayout(); |
57 | layout->addLayout(subLayout); | 57 | layout->addLayout(subLayout); |
58 | /* | 58 | /* |
59 | searchLabel = new QLabel(topFrame); | 59 | searchLabel = new QLabel(topFrame); |
60 | searchLabel->setText(i18n("Search for:")); | 60 | searchLabel->setText(i18n("Search for:")); |
61 | subLayout->addWidget(searchLabel); | 61 | subLayout->addWidget(searchLabel); |
62 | */ | 62 | */ |
63 | QPushButton *OkButton = new QPushButton( i18n("Search for:"), topFrame ); | 63 | QPushButton *OkButton = new QPushButton( i18n("Search for:"), topFrame ); |
64 | //OkButton->setDefault( true ); | 64 | //OkButton->setDefault( true ); |
65 | connect(OkButton,SIGNAL(clicked()),SLOT(doSearch())); | 65 | connect(OkButton,SIGNAL(clicked()),SLOT(doSearch())); |
66 | subLayout->addWidget(OkButton); | 66 | subLayout->addWidget(OkButton); |
67 | searchEdit = new KLineEdit(topFrame); | 67 | searchEdit = new KLineEdit(topFrame); |
68 | subLayout->addWidget(searchEdit); | 68 | subLayout->addWidget(searchEdit); |
69 | 69 | ||
70 | mAddItems = new QRadioButton( "+ ", topFrame ); | 70 | mAddItems = new QRadioButton( "+ ", topFrame ); |
71 | mSubItems = new QRadioButton( "- ", topFrame ); | 71 | mSubItems = new QRadioButton( "- ", topFrame ); |
72 | mRefineItems = new QRadioButton( "< ", topFrame ); | 72 | mRefineItems = new QRadioButton( "< ", topFrame ); |
73 | subLayout->addWidget( mAddItems ); | 73 | subLayout->addWidget( mAddItems ); |
74 | subLayout->addWidget( mSubItems ); | 74 | subLayout->addWidget( mSubItems ); |
75 | subLayout->addWidget( mRefineItems ); | 75 | subLayout->addWidget( mRefineItems ); |
76 | QFont fo ( mAddItems->font() ); | 76 | QFont fo ( mAddItems->font() ); |
77 | fo.setBold( true ); | 77 | fo.setBold( true ); |
78 | fo.setPointSize( fo.pointSize() + 2 ); | 78 | fo.setPointSize( fo.pointSize() + 2 ); |
79 | mAddItems->setFont( fo ); | 79 | mAddItems->setFont( fo ); |
80 | mSubItems->setFont( fo ); | 80 | mSubItems->setFont( fo ); |
81 | mRefineItems->setFont( fo ); | 81 | mRefineItems->setFont( fo ); |
82 | connect( mAddItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_add( bool ))); | 82 | connect( mAddItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_add( bool ))); |
83 | connect( mSubItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_sub( bool ))); | 83 | connect( mSubItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_sub( bool ))); |
84 | connect( mRefineItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_refine( bool ))); | 84 | connect( mRefineItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_refine( bool ))); |
85 | 85 | ||
86 | QPushButton *togButton = new QPushButton( "", topFrame ); | 86 | QPushButton *togButton = new QPushButton( "", topFrame ); |
87 | subLayout->addWidget(togButton); | 87 | subLayout->addWidget(togButton); |
88 | connect(togButton,SIGNAL(clicked()),SLOT(toggleCheckboxes())); | 88 | connect(togButton,SIGNAL(clicked()),SLOT(toggleCheckboxes())); |
89 | togButton->setPixmap(SmallIcon("1updownarrow")); | 89 | togButton->setPixmap(SmallIcon("1updownarrow")); |
90 | togButton->setMinimumWidth( togButton->sizeHint().height() ); | 90 | togButton->setMinimumWidth( togButton->sizeHint().height() ); |
91 | 91 | ||
92 | searchEdit->setText("*"); // Find all events by default | 92 | searchEdit->setText("*"); // Find all events by default |
93 | searchEdit->setFocus(); | 93 | searchEdit->setFocus(); |
94 | connect(searchEdit, SIGNAL(textChanged ( const QString & )),this,SLOT(searchTextChanged( const QString & ))); | 94 | connect(searchEdit, SIGNAL(textChanged ( const QString & )),this,SLOT(searchTextChanged( const QString & ))); |
95 | connect(searchEdit, SIGNAL( returnPressed () ),this,SLOT(doSearch())); | 95 | connect(searchEdit, SIGNAL( returnPressed () ),this,SLOT(doSearch())); |
96 | // Subjects to search | 96 | // Subjects to search |
97 | // QGroupBox *subjectGroup = new QGroupBox(1,Vertical,i18n("Search In"), | 97 | // QGroupBox *subjectGroup = new QGroupBox(1,Vertical,i18n("Search In"), |
98 | // topFrame); | 98 | // topFrame); |
99 | 99 | ||
100 | incidenceGroup = new QHBox( topFrame ); | 100 | incidenceGroup = new QHBox( topFrame ); |
101 | layout->addWidget(incidenceGroup); | 101 | layout->addWidget(incidenceGroup); |
102 | 102 | ||
103 | mSearchEvent = new QCheckBox(i18n("Events"),incidenceGroup); | 103 | mSearchEvent = new QCheckBox(i18n("Events"),incidenceGroup); |
104 | //mSearchEvent->setChecked(true); | 104 | //mSearchEvent->setChecked(true); |
105 | mSearchTodo = new QCheckBox(i18n("Todos"),incidenceGroup); | 105 | mSearchTodo = new QCheckBox(i18n("Todos"),incidenceGroup); |
106 | mSearchJournal = new QCheckBox(i18n("Journals"),incidenceGroup); | 106 | mSearchJournal = new QCheckBox(i18n("Journals"),incidenceGroup); |
107 | 107 | ||
108 | subjectGroup = new QHBox( topFrame ); | 108 | subjectGroup = new QHBox( topFrame ); |
109 | layout->addWidget(subjectGroup); | 109 | layout->addWidget(subjectGroup); |
110 | 110 | ||
111 | mSummaryCheck = new QCheckBox(i18n("Summary/Loc."),subjectGroup); | 111 | mSummaryCheck = new QCheckBox(i18n("Summary/Loc."),subjectGroup); |
112 | mSummaryCheck->setChecked(true); | 112 | mSummaryCheck->setChecked(true); |
113 | mDescriptionCheck = new QCheckBox(i18n("Details"),subjectGroup); | 113 | mDescriptionCheck = new QCheckBox(i18n("Details"),subjectGroup); |
114 | mCategoryCheck = new QCheckBox(i18n("Categories"),subjectGroup); | 114 | mCategoryCheck = new QCheckBox(i18n("Categories"),subjectGroup); |
115 | 115 | ||
116 | attendeeGroup = new QHBox( topFrame ); | 116 | attendeeGroup = new QHBox( topFrame ); |
117 | layout->addWidget(attendeeGroup ); | 117 | layout->addWidget(attendeeGroup ); |
118 | new QLabel( i18n("Attendee:"),attendeeGroup ); | 118 | new QLabel( i18n("Attendee:"),attendeeGroup ); |
119 | mSearchAName = new QCheckBox(i18n("Name"),attendeeGroup ); | 119 | mSearchAName = new QCheckBox(i18n("Name"),attendeeGroup ); |
120 | mSearchAEmail = new QCheckBox(i18n("Email"), attendeeGroup ); | 120 | mSearchAEmail = new QCheckBox(i18n("Email"), attendeeGroup ); |
121 | // Date range | 121 | // Date range |
122 | // QGroupBox *rangeGroup = new QGroupBox(1,Horizontal,i18n("Date Range"), | 122 | // QGroupBox *rangeGroup = new QGroupBox(1,Horizontal,i18n("Date Range"), |
123 | // topFrame); | 123 | // topFrame); |
124 | // layout->addWidget(rangeGroup); | 124 | // layout->addWidget(rangeGroup); |
125 | 125 | ||
126 | QWidget *rangeWidget = new QWidget(topFrame); | 126 | QWidget *rangeWidget = new QWidget(topFrame); |
127 | QHBoxLayout *rangeLayout = new QHBoxLayout(rangeWidget,0,KDialog::spacingHint()); | 127 | QHBoxLayout *rangeLayout = new QHBoxLayout(rangeWidget,0,KDialog::spacingHint()); |
128 | rangeLayout->addWidget(new QLabel(i18n("From:"),rangeWidget)); | 128 | rangeLayout->addWidget(new QLabel(i18n("From:"),rangeWidget)); |
129 | mStartDate = new KDateEdit(rangeWidget); | 129 | mStartDate = new KDateEdit(rangeWidget); |
130 | rangeLayout->addWidget(mStartDate); | 130 | rangeLayout->addWidget(mStartDate); |
131 | rangeLayout->addWidget(new QLabel(i18n("To:"),rangeWidget)); | 131 | rangeLayout->addWidget(new QLabel(i18n("To:"),rangeWidget)); |
132 | mEndDate = new KDateEdit(rangeWidget); | 132 | mEndDate = new KDateEdit(rangeWidget); |
133 | mEndDate->setDate(QDate::currentDate().addDays(365)); | 133 | mEndDate->setDate(QDate::currentDate().addDays(365)); |
134 | rangeLayout->addWidget(mEndDate); | 134 | rangeLayout->addWidget(mEndDate); |
135 | QToolButton *wt = QWhatsThis::whatsThisButton ( rangeWidget ); | 135 | QToolButton *wt = QWhatsThis::whatsThisButton ( rangeWidget ); |
136 | rangeLayout->addWidget( (QWidget*)wt ); | 136 | rangeLayout->addWidget( (QWidget*)wt ); |
137 | layout->addWidget(rangeWidget); | 137 | layout->addWidget(rangeWidget); |
138 | // Results list view | 138 | // Results list view |
139 | listView = new KOListView(mCalendar,topFrame); | 139 | listView = new KOListView(mCalendar,topFrame); |
140 | layout->addWidget(listView); | 140 | layout->addWidget(listView); |
141 | listView->showCompletedTodos(); | ||
141 | //layout->setStretchFactor( listView, 333 ); | 142 | //layout->setStretchFactor( listView, 333 ); |
142 | //listView->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Expanding) ); | 143 | //listView->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Expanding) ); |
143 | //listView->setMaximumHeight( 50 ); | 144 | //listView->setMaximumHeight( 50 ); |
144 | listView->readSettings(KOGlobals::config(),"SearchListView Layout"); | 145 | listView->readSettings(KOGlobals::config(),"SearchListView Layout"); |
145 | connect(searchEdit,SIGNAL(scrollDOWN()),SLOT(setFocusToList())); | 146 | connect(searchEdit,SIGNAL(scrollDOWN()),SLOT(setFocusToList())); |
146 | 147 | ||
147 | setCaption( i18n("KO/Pi Find: ")); | 148 | setCaption( i18n("KO/Pi Find: ")); |
148 | #ifdef DESKTOP_VERSION | 149 | #ifdef DESKTOP_VERSION |
149 | OkButton = new QPushButton( i18n("Close"), this ); | 150 | OkButton = new QPushButton( i18n("Close"), this ); |
150 | connect(OkButton,SIGNAL(clicked()),SLOT(hide())); | 151 | connect(OkButton,SIGNAL(clicked()),SLOT(hide())); |
151 | #endif | 152 | #endif |
152 | } | 153 | } |
153 | 154 | ||
154 | SearchDialog::~SearchDialog() | 155 | SearchDialog::~SearchDialog() |
155 | { | 156 | { |
156 | 157 | ||
157 | } | 158 | } |
158 | void SearchDialog::slot_add( bool b ) | 159 | void SearchDialog::slot_add( bool b ) |
159 | { | 160 | { |
160 | if ( b ) { | 161 | if ( b ) { |
161 | if ( mSubItems->isOn() ) mSubItems->toggle(); | 162 | if ( mSubItems->isOn() ) mSubItems->toggle(); |
162 | if ( mRefineItems->isOn() ) mRefineItems->toggle(); | 163 | if ( mRefineItems->isOn() ) mRefineItems->toggle(); |
163 | setCaption( i18n("Matching items will be added to list")); | 164 | setCaption( i18n("Matching items will be added to list")); |
164 | } else | 165 | } else |
165 | setCaption( i18n("List will be cleared before search")); | 166 | setCaption( i18n("List will be cleared before search")); |
166 | } | 167 | } |
167 | void SearchDialog::slot_sub( bool b) | 168 | void SearchDialog::slot_sub( bool b) |
168 | { | 169 | { |
169 | if ( b ) { | 170 | if ( b ) { |
170 | if ( mRefineItems->isOn() ) mRefineItems->toggle(); | 171 | if ( mRefineItems->isOn() ) mRefineItems->toggle(); |
171 | if ( mAddItems->isOn() ) mAddItems->toggle(); | 172 | if ( mAddItems->isOn() ) mAddItems->toggle(); |
172 | setCaption( i18n("Matching items will be removed from list")); | 173 | setCaption( i18n("Matching items will be removed from list")); |
173 | } else | 174 | } else |
174 | setCaption( i18n("List will be cleared before search")); | 175 | setCaption( i18n("List will be cleared before search")); |
175 | } | 176 | } |
176 | void SearchDialog::slot_refine( bool b) | 177 | void SearchDialog::slot_refine( bool b) |
177 | { | 178 | { |
178 | if ( b ) { | 179 | if ( b ) { |
179 | if ( mSubItems->isOn() ) mSubItems->toggle(); | 180 | if ( mSubItems->isOn() ) mSubItems->toggle(); |
180 | if ( mAddItems->isOn() ) mAddItems->toggle(); | 181 | if ( mAddItems->isOn() ) mAddItems->toggle(); |
181 | setCaption( i18n("Search on displayed list only")); | 182 | setCaption( i18n("Search on displayed list only")); |
182 | } else | 183 | } else |
183 | setCaption( i18n("List will be cleared before search")); | 184 | setCaption( i18n("List will be cleared before search")); |
184 | } | 185 | } |
185 | void SearchDialog::toggleCheckboxes() | 186 | void SearchDialog::toggleCheckboxes() |
186 | { | 187 | { |
187 | if ( incidenceGroup->isVisible() ) { | 188 | if ( incidenceGroup->isVisible() ) { |
188 | incidenceGroup->hide() ; | 189 | incidenceGroup->hide() ; |
189 | subjectGroup->hide() ; | 190 | subjectGroup->hide() ; |
190 | attendeeGroup->hide() ; | 191 | attendeeGroup->hide() ; |
191 | } else { | 192 | } else { |
192 | incidenceGroup->show() ; | 193 | incidenceGroup->show() ; |
193 | subjectGroup->show() ; | 194 | subjectGroup->show() ; |
194 | attendeeGroup->show() ; | 195 | attendeeGroup->show() ; |
195 | } | 196 | } |
196 | } | 197 | } |
197 | void SearchDialog::raiseAndSelect() | 198 | void SearchDialog::raiseAndSelect() |
198 | { | 199 | { |
199 | 200 | ||
200 | static int currentState = 0; | 201 | static int currentState = 0; |
201 | 202 | ||
202 | if ( !mSearchJournal->isChecked() && !mSearchTodo->isChecked() && !mSearchEvent->isChecked() ) | 203 | if ( !mSearchJournal->isChecked() && !mSearchTodo->isChecked() && !mSearchEvent->isChecked() ) |
203 | currentState = 0; | 204 | currentState = 0; |
204 | int newState = 0; | 205 | int newState = 0; |
205 | if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { | 206 | if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { |
206 | newState = VIEW_J_VIEW; | 207 | newState = VIEW_J_VIEW; |
207 | } | 208 | } |
208 | else if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { | 209 | else if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { |
209 | newState = VIEW_T_VIEW; | 210 | newState = VIEW_T_VIEW; |
210 | } | 211 | } |
211 | else { | 212 | else { |
212 | newState = VIEW_A_VIEW; | 213 | newState = VIEW_A_VIEW; |
213 | } | 214 | } |
214 | if ( newState != currentState ) { | 215 | if ( newState != currentState ) { |
215 | if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { | 216 | if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { |
216 | if ( ! mSearchJournal->isChecked() ) { | 217 | if ( ! mSearchJournal->isChecked() ) { |
217 | mSearchJournal->setChecked( true ); | 218 | mSearchJournal->setChecked( true ); |
218 | mSearchTodo->setChecked( false ); | 219 | mSearchTodo->setChecked( false ); |
219 | mSearchEvent->setChecked( false ); | 220 | mSearchEvent->setChecked( false ); |
220 | } | 221 | } |
221 | } | 222 | } |
222 | else if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { | 223 | else if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { |
223 | if ( ! mSearchTodo->isChecked() ) { | 224 | if ( ! mSearchTodo->isChecked() ) { |
224 | mSearchTodo->setChecked( true ); | 225 | mSearchTodo->setChecked( true ); |
225 | mSearchJournal->setChecked( false ); | 226 | mSearchJournal->setChecked( false ); |
226 | mSearchEvent->setChecked( false ); | 227 | mSearchEvent->setChecked( false ); |
227 | } | 228 | } |
228 | } | 229 | } |
229 | else { | 230 | else { |
230 | if ( ! mSearchEvent->isChecked() ) { | 231 | if ( ! mSearchEvent->isChecked() ) { |
231 | mSearchEvent->setChecked( true ); | 232 | mSearchEvent->setChecked( true ); |
232 | mSearchJournal->setChecked( false ); | 233 | mSearchJournal->setChecked( false ); |
233 | mSearchTodo->setChecked( false ); | 234 | mSearchTodo->setChecked( false ); |
234 | } | 235 | } |
235 | } | 236 | } |
236 | } | 237 | } |