summaryrefslogtreecommitdiffabout
path: root/korganizer/searchdialog.cpp
Unidiff
Diffstat (limited to 'korganizer/searchdialog.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/searchdialog.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/korganizer/searchdialog.cpp b/korganizer/searchdialog.cpp
index cef59a2..678e1bd 100644
--- a/korganizer/searchdialog.cpp
+++ b/korganizer/searchdialog.cpp
@@ -5,80 +5,82 @@
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or 8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version. 9 (at your option) any later version.
10 10
11 This program is distributed in the hope that it will be useful, 11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24 24
25#include <qlayout.h> 25#include <qlayout.h>
26#include <qcheckbox.h> 26#include <qcheckbox.h>
27#include <qgroupbox.h> 27#include <qgroupbox.h>
28#include <qlabel.h> 28#include <qlabel.h>
29#include <qlistview.h>
29#include <qwhatsthis.h> 30#include <qwhatsthis.h>
30#include <qlineedit.h> 31#include <qlineedit.h>
31#include <qpushbutton.h> 32#include <qpushbutton.h>
32 33
33#include <klocale.h> 34#include <klocale.h>
34#include <kmessagebox.h> 35#include <kmessagebox.h>
35 36
36#include <libkdepim/kdateedit.h> 37#include <libkdepim/kdateedit.h>
37 38
38#include "koglobals.h" 39#include "koglobals.h"
39#include "koprefs.h" 40#include "koprefs.h"
41#include "klineedit.h"
40 42
41#include "calendarview.h" 43#include "calendarview.h"
42#include "koviewmanager.h" 44#include "koviewmanager.h"
43#include "searchdialog.h" 45#include "searchdialog.h"
44 46
45SearchDialog::SearchDialog(Calendar *calendar,CalendarView *parent) 47SearchDialog::SearchDialog(Calendar *calendar,CalendarView *parent)
46 : QVBox( 0 ) 48 : QVBox( 0 )
47 49
48{ 50{
49 mCalendar = calendar; 51 mCalendar = calendar;
50 QFrame *topFrame = new QFrame( this ) ;//plainPage(); 52 QFrame *topFrame = new QFrame( this ) ;//plainPage();
51 QVBoxLayout *layout = new QVBoxLayout(topFrame,KDialog::marginHint(),KDialog::spacingHint()); 53 QVBoxLayout *layout = new QVBoxLayout(topFrame,KDialog::marginHint(),KDialog::spacingHint());
52 54
53 // Search expression 55 // Search expression
54 QHBoxLayout *subLayout = new QHBoxLayout(); 56 QHBoxLayout *subLayout = new QHBoxLayout();
55 layout->addLayout(subLayout); 57 layout->addLayout(subLayout);
56 searchLabel = new QLabel(topFrame); 58 searchLabel = new QLabel(topFrame);
57 searchLabel->setText(i18n("Search for:")); 59 searchLabel->setText(i18n("Search for:"));
58 subLayout->addWidget(searchLabel); 60 subLayout->addWidget(searchLabel);
59 61
60 searchEdit = new QLineEdit(topFrame); 62 searchEdit = new KLineEdit(topFrame);
61 subLayout->addWidget(searchEdit); 63 subLayout->addWidget(searchEdit);
62 QPushButton *OkButton = new QPushButton( i18n("&Find"), topFrame ); 64 QPushButton *OkButton = new QPushButton( i18n("&Find"), topFrame );
63 //OkButton->setDefault( true ); 65 //OkButton->setDefault( true );
64 connect(OkButton,SIGNAL(clicked()),SLOT(doSearch())); 66 connect(OkButton,SIGNAL(clicked()),SLOT(doSearch()));
65 subLayout->addWidget(OkButton); 67 subLayout->addWidget(OkButton);
66 searchEdit->setText("*"); // Find all events by default 68 searchEdit->setText("*"); // Find all events by default
67 searchEdit->setFocus(); 69 searchEdit->setFocus();
68 connect(searchEdit, SIGNAL(textChanged ( const QString & )),this,SLOT(searchTextChanged( const QString & ))); 70 connect(searchEdit, SIGNAL(textChanged ( const QString & )),this,SLOT(searchTextChanged( const QString & )));
69 connect(searchEdit, SIGNAL( returnPressed () ),this,SLOT(doSearch())); 71 connect(searchEdit, SIGNAL( returnPressed () ),this,SLOT(doSearch()));
70 // Subjects to search 72 // Subjects to search
71 // QGroupBox *subjectGroup = new QGroupBox(1,Vertical,i18n("Search In"), 73 // QGroupBox *subjectGroup = new QGroupBox(1,Vertical,i18n("Search In"),
72 // topFrame); 74 // topFrame);
73 75
74 QHBox *incidenceGroup = new QHBox( topFrame ); 76 QHBox *incidenceGroup = new QHBox( topFrame );
75 layout->addWidget(incidenceGroup); 77 layout->addWidget(incidenceGroup);
76 78
77 mSearchEvent = new QCheckBox(i18n("Events"),incidenceGroup); 79 mSearchEvent = new QCheckBox(i18n("Events"),incidenceGroup);
78 mSearchEvent->setChecked(true); 80 mSearchEvent->setChecked(true);
79 mSearchTodo = new QCheckBox(i18n("Todos"),incidenceGroup); 81 mSearchTodo = new QCheckBox(i18n("Todos"),incidenceGroup);
80 mSearchJournal = new QCheckBox(i18n("Journals"),incidenceGroup); 82 mSearchJournal = new QCheckBox(i18n("Journals"),incidenceGroup);
81 83
82 QHBox *subjectGroup = new QHBox( topFrame ); 84 QHBox *subjectGroup = new QHBox( topFrame );
83 layout->addWidget(subjectGroup); 85 layout->addWidget(subjectGroup);
84 86
@@ -93,60 +95,65 @@ SearchDialog::SearchDialog(Calendar *calendar,CalendarView *parent)
93 mSearchAName = new QCheckBox(i18n("Name"),attendeeGroup ); 95 mSearchAName = new QCheckBox(i18n("Name"),attendeeGroup );
94 mSearchAEmail = new QCheckBox(i18n("Email"), attendeeGroup ); 96 mSearchAEmail = new QCheckBox(i18n("Email"), attendeeGroup );
95 // Date range 97 // Date range
96 // QGroupBox *rangeGroup = new QGroupBox(1,Horizontal,i18n("Date Range"), 98 // QGroupBox *rangeGroup = new QGroupBox(1,Horizontal,i18n("Date Range"),
97 // topFrame); 99 // topFrame);
98 // layout->addWidget(rangeGroup); 100 // layout->addWidget(rangeGroup);
99 101
100 QWidget *rangeWidget = new QWidget(topFrame); 102 QWidget *rangeWidget = new QWidget(topFrame);
101 QHBoxLayout *rangeLayout = new QHBoxLayout(rangeWidget,0,KDialog::spacingHint()); 103 QHBoxLayout *rangeLayout = new QHBoxLayout(rangeWidget,0,KDialog::spacingHint());
102 rangeLayout->addWidget(new QLabel(i18n("From:"),rangeWidget)); 104 rangeLayout->addWidget(new QLabel(i18n("From:"),rangeWidget));
103 mStartDate = new KDateEdit(rangeWidget); 105 mStartDate = new KDateEdit(rangeWidget);
104 rangeLayout->addWidget(mStartDate); 106 rangeLayout->addWidget(mStartDate);
105 rangeLayout->addWidget(new QLabel(i18n("To:"),rangeWidget)); 107 rangeLayout->addWidget(new QLabel(i18n("To:"),rangeWidget));
106 mEndDate = new KDateEdit(rangeWidget); 108 mEndDate = new KDateEdit(rangeWidget);
107 mEndDate->setDate(QDate::currentDate().addDays(365)); 109 mEndDate->setDate(QDate::currentDate().addDays(365));
108 rangeLayout->addWidget(mEndDate); 110 rangeLayout->addWidget(mEndDate);
109 QToolButton *wt = QWhatsThis::whatsThisButton ( rangeWidget ); 111 QToolButton *wt = QWhatsThis::whatsThisButton ( rangeWidget );
110 rangeLayout->addWidget( (QWidget*)wt ); 112 rangeLayout->addWidget( (QWidget*)wt );
111 layout->addWidget(rangeWidget); 113 layout->addWidget(rangeWidget);
112 // Results list view 114 // Results list view
113 listView = new KOListView(mCalendar,topFrame); 115 listView = new KOListView(mCalendar,topFrame);
114 layout->addWidget(listView); 116 layout->addWidget(listView);
115 117
116 listView->readSettings(KOGlobals::config(),"SearchListView Layout"); 118 listView->readSettings(KOGlobals::config(),"SearchListView Layout");
119 connect(searchEdit,SIGNAL(scrollDOWN()),SLOT(setFocusToList()));
117 120
118 setCaption( i18n("KO/Pi Find: ")); 121 setCaption( i18n("KO/Pi Find: "));
119#ifdef DESKTOP_VERSION 122#ifdef DESKTOP_VERSION
120 OkButton = new QPushButton( i18n("Close"), this ); 123 OkButton = new QPushButton( i18n("Close"), this );
121 connect(OkButton,SIGNAL(clicked()),SLOT(hide())); 124 connect(OkButton,SIGNAL(clicked()),SLOT(hide()));
122#endif 125#endif
123} 126}
124 127
125SearchDialog::~SearchDialog() 128SearchDialog::~SearchDialog()
126{ 129{
127 130
128} 131}
132void SearchDialog::setFocusToList()
133{
134 listView->resetFocus();
135}
129void SearchDialog::accept() 136void SearchDialog::accept()
130{ 137{
131 doSearch(); 138 doSearch();
132} 139}
133void SearchDialog::updateList() 140void SearchDialog::updateList()
134{ 141{
135 //listView->updateList(); 142 //listView->updateList();
136 if ( isVisible() ) { 143 if ( isVisible() ) {
137 updateView(); 144 updateView();
138 //qDebug("SearchDialog::updated "); 145 //qDebug("SearchDialog::updated ");
139 } 146 }
140 else { 147 else {
141 listView->clear(); 148 listView->clear();
142 //qDebug("SearchDialog::cleared "); 149 //qDebug("SearchDialog::cleared ");
143 150
144 } 151 }
145} 152}
146void SearchDialog::searchTextChanged( const QString &_text ) 153void SearchDialog::searchTextChanged( const QString &_text )
147{ 154{
148#if 0 155#if 0
149 enableButton( KDialogBase::User1, !_text.isEmpty() ); 156 enableButton( KDialogBase::User1, !_text.isEmpty() );
150#endif 157#endif
151} 158}
152 159