Diffstat (limited to 'core/pim/osearch/mainwindow.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/pim/osearch/mainwindow.cpp | 42 |
1 files changed, 39 insertions, 3 deletions
diff --git a/core/pim/osearch/mainwindow.cpp b/core/pim/osearch/mainwindow.cpp index 07403a1..55302cb 100644 --- a/core/pim/osearch/mainwindow.cpp +++ b/core/pim/osearch/mainwindow.cpp | |||
@@ -39,37 +39,58 @@ | |||
39 | #include <opie/owait.h> | 39 | #include <opie/owait.h> |
40 | 40 | ||
41 | #include "olistview.h" | 41 | #include "olistview.h" |
42 | #include "olistviewitem.h" | 42 | #include "olistviewitem.h" |
43 | #include "resultitem.h" | 43 | #include "resultitem.h" |
44 | #include "adresssearch.h" | 44 | #include "adresssearch.h" |
45 | #include "todosearch.h" | 45 | #include "todosearch.h" |
46 | #include "datebooksearch.h" | 46 | #include "datebooksearch.h" |
47 | #include "applnksearch.h" | 47 | #include "applnksearch.h" |
48 | #include "doclnksearch.h" | 48 | #include "doclnksearch.h" |
49 | #include "mainwindow.h" | 49 | #include "mainwindow.h" |
50 | 50 | ||
51 | static const char* const image1_data[] = { | ||
52 | "14 14 3 1", | ||
53 | ". c None", | ||
54 | "# c #000000", | ||
55 | "a c #ff0000", | ||
56 | "..............", | ||
57 | "..##.......###", | ||
58 | ".#aa#....##aa#", | ||
59 | "#aaaa#.##aaaa#", | ||
60 | ".##aaa#aaaaa##", | ||
61 | "...#aaaaaaa#..", | ||
62 | "....#aaaaa#...", | ||
63 | "...#aaaaa#....", | ||
64 | "..#aaaaaaa#...", | ||
65 | ".#aaaaaaaaa#..", | ||
66 | "#aaaa###aaaa#.", | ||
67 | "#aaa#..##aaa#.", | ||
68 | "#aaa#...#aa#..", | ||
69 | ".###.....##..."}; | ||
70 | |||
71 | |||
51 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : | 72 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : |
52 | QMainWindow( parent, name, f ), _currentItem(0) | 73 | QMainWindow( parent, name, f ), _currentItem(0) |
53 | { | 74 | { |
54 | setCaption( tr("OSearch") ); | 75 | setCaption( tr("OSearch") ); |
55 | 76 | ||
56 | setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); | 77 | setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); |
57 | 78 | ||
58 | QFrame *mainFrame = new QFrame( this, "mainFrame" ); | 79 | QFrame *mainFrame = new QFrame( this, "mainFrame" ); |
59 | mainFrame->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); | 80 | mainFrame->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); |
60 | 81 | ||
61 | mainLayout = new QVBoxLayout( mainFrame ); | 82 | mainLayout = new QVBoxLayout( mainFrame ); |
62 | mainLayout->setSpacing( 0 ); | 83 | mainLayout->setSpacing( 0 ); |
63 | mainLayout->setMargin( 0 ); | 84 | mainLayout->setMargin( 3 ); |
64 | 85 | ||
65 | resultsList = new OListView( mainFrame ); | 86 | resultsList = new OListView( mainFrame ); |
66 | resultsList->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); | 87 | resultsList->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); |
67 | mainLayout->addWidget( resultsList ); | 88 | mainLayout->addWidget( resultsList ); |
68 | 89 | ||
69 | detailsFrame = new QFrame( mainFrame, "detailsFrame" ); | 90 | detailsFrame = new QFrame( mainFrame, "detailsFrame" ); |
70 | QVBoxLayout *detailsLayout = new QVBoxLayout( detailsFrame ); | 91 | QVBoxLayout *detailsLayout = new QVBoxLayout( detailsFrame ); |
71 | richEdit = new QTextView( detailsFrame ); | 92 | richEdit = new QTextView( detailsFrame ); |
72 | QWhatsThis::add( richEdit, tr("The details of the current result") ); | 93 | QWhatsThis::add( richEdit, tr("The details of the current result") ); |
73 | richEdit->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); | 94 | richEdit->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); |
74 | detailsLayout->addWidget( richEdit ); | 95 | detailsLayout->addWidget( richEdit ); |
75 | 96 | ||
@@ -145,33 +166,48 @@ void MainWindow::makeMenu() | |||
145 | SearchAllAction->addTo( searchMenu ); | 166 | SearchAllAction->addTo( searchMenu ); |
146 | searchMenu->insertItem( tr( "Options" ), searchOptions ); | 167 | searchMenu->insertItem( tr( "Options" ), searchOptions ); |
147 | 168 | ||
148 | //SEARCH OPTIONS | 169 | //SEARCH OPTIONS |
149 | //actionWholeWordsOnly = new QAction( tr("Whole words only"),QString::null, 0, this, 0, true ); | 170 | //actionWholeWordsOnly = new QAction( tr("Whole words only"),QString::null, 0, this, 0, true ); |
150 | //actionWholeWordsOnly->addTo( searchOptions ); | 171 | //actionWholeWordsOnly->addTo( searchOptions ); |
151 | actionCaseSensitiv = new QAction( tr("Case sensitiv"),QString::null, 0, this, 0, true ); | 172 | actionCaseSensitiv = new QAction( tr("Case sensitiv"),QString::null, 0, this, 0, true ); |
152 | actionCaseSensitiv->addTo( searchOptions ); | 173 | actionCaseSensitiv->addTo( searchOptions ); |
153 | actionWildcards = new QAction( tr("Use wildcards"),QString::null, 0, this, 0, true ); | 174 | actionWildcards = new QAction( tr("Use wildcards"),QString::null, 0, this, 0, true ); |
154 | actionWildcards->addTo( searchOptions ); | 175 | actionWildcards->addTo( searchOptions ); |
155 | 176 | ||
156 | //SEARCH BAR | 177 | //SEARCH BAR |
178 | LabelEnterText = new QLabel( searchBar, "Label" ); | ||
179 | LabelEnterText->setAutoMask( FALSE ); | ||
180 | LabelEnterText->setText( tr( "Search for: " ) ); | ||
181 | |||
157 | addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); | 182 | addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); |
158 | QLineEdit *searchEdit = new QLineEdit( searchBar, "seachEdit" ); | 183 | QLineEdit *searchEdit = new QLineEdit( searchBar, "seachEdit" ); |
159 | QWhatsThis::add( searchEdit, tr("Enter your search terms here") ); | 184 | QWhatsThis::add( searchEdit, tr("Enter your search terms here") ); |
160 | searchEdit->setFocus(); | 185 | searchEdit->setFocus(); |
161 | searchBar->setHorizontalStretchable( TRUE ); | 186 | searchBar->setHorizontalStretchable( TRUE ); |
162 | searchBar->setStretchableWidget( searchEdit ); | 187 | searchBar->setStretchableWidget( searchEdit ); |
188 | |||
189 | //Search button | ||
163 | SearchAllAction->addTo( searchBar ); | 190 | SearchAllAction->addTo( searchBar ); |
164 | connect( searchEdit, SIGNAL( textChanged( const QString & ) ), | 191 | |
165 | this, SLOT( setSearch( const QString & ) ) ); | 192 | //image ripped of off opie-login/loginwindow.cpp |
193 | QPixmap image1( ( const char** ) image1_data ); | ||
194 | |||
195 | //Clear text | ||
196 | ClearSearchText = new QToolButton( searchBar, "ClearSearchText"); | ||
197 | ClearSearchText->setText( tr( "" ) ); | ||
198 | ClearSearchText->setPixmap( image1 ); | ||
199 | |||
200 | connect( searchEdit, SIGNAL( textChanged( const QString & ) ),this, SLOT( setSearch( const QString & ) ) ); | ||
201 | connect( ClearSearchText, SIGNAL( clicked() ), searchEdit, SLOT( clear() ) ); | ||
166 | 202 | ||
167 | } | 203 | } |
168 | 204 | ||
169 | MainWindow::~MainWindow() | 205 | MainWindow::~MainWindow() |
170 | { | 206 | { |
171 | Config cfg( "osearch", Config::User ); | 207 | Config cfg( "osearch", Config::User ); |
172 | cfg.setGroup( "search_settings" ); | 208 | cfg.setGroup( "search_settings" ); |
173 | cfg.writeEntry( "caseSensitiv", actionCaseSensitiv->isOn() ); | 209 | cfg.writeEntry( "caseSensitiv", actionCaseSensitiv->isOn() ); |
174 | cfg.writeEntry( "wildcards", actionWildcards->isOn() ); | 210 | cfg.writeEntry( "wildcards", actionWildcards->isOn() ); |
175 | //cfg.writeEntry( "whole_words_only", actionWholeWordsOnly->isOn() ); | 211 | //cfg.writeEntry( "whole_words_only", actionWholeWordsOnly->isOn() ); |
176 | } | 212 | } |
177 | 213 | ||