author | tille <tille> | 2003-05-16 17:30:46 (UTC) |
---|---|---|
committer | tille <tille> | 2003-05-16 17:30:46 (UTC) |
commit | 23e56debf8c8b219c974137daad07e01f873fcad (patch) (unidiff) | |
tree | 003514e0135ca24e1778641df3b251df4e652d44 | |
parent | 076926e6c7fe5bfd52f9f42879a216885ccc2cd3 (diff) | |
download | opie-23e56debf8c8b219c974137daad07e01f873fcad.zip opie-23e56debf8c8b219c974137daad07e01f873fcad.tar.gz opie-23e56debf8c8b219c974137daad07e01f873fcad.tar.bz2 |
tr
-rw-r--r-- | core/pim/osearch/doclnkitem.cpp | 6 | ||||
-rw-r--r-- | core/pim/osearch/mainwindow.cpp | 7 |
2 files changed, 3 insertions, 10 deletions
diff --git a/core/pim/osearch/doclnkitem.cpp b/core/pim/osearch/doclnkitem.cpp index a1d0384..56eb26a 100644 --- a/core/pim/osearch/doclnkitem.cpp +++ b/core/pim/osearch/doclnkitem.cpp | |||
@@ -22,35 +22,35 @@ DocLnkItem::DocLnkItem(OListViewItem* parent, DocLnk *app) | |||
22 | : ResultItem(parent) | 22 | : ResultItem(parent) |
23 | { | 23 | { |
24 | _doc = app; | 24 | _doc = app; |
25 | setText(0, _doc->name() ); | 25 | setText(0, _doc->name() ); |
26 | setPixmap(0, _doc->pixmap() ); | 26 | setPixmap(0, _doc->pixmap() ); |
27 | } | 27 | } |
28 | 28 | ||
29 | DocLnkItem::~DocLnkItem() | 29 | DocLnkItem::~DocLnkItem() |
30 | { | 30 | { |
31 | } | 31 | } |
32 | 32 | ||
33 | QString DocLnkItem::toRichText() | 33 | QString DocLnkItem::toRichText() |
34 | { | 34 | { |
35 | QString text; | 35 | QString text; |
36 | text += "<b><h3>" + _doc->name() + "</b></h3><br>"; | 36 | text += "<b><h3>" + _doc->name() + "</b></h3><br>"; |
37 | text += _doc->comment() + "<br>"; | 37 | text += _doc->comment() + "<br>"; |
38 | text += "File: " + _doc->file() + "<br>"; | 38 | text += QObject::tr("File: ") + _doc->file() + "<br>"; |
39 | text += "Link: " + _doc->linkFile() + "<br>"; | 39 | text += QObject::tr("Link: ") + _doc->linkFile() + "<br>"; |
40 | text += "Mimetype: " + _doc->type() + "<br>"; | 40 | text += QObject::tr("Mimetype: ") + _doc->type() + "<br>"; |
41 | if ( _doc->type().contains( "text" ) ){ | 41 | if ( _doc->type().contains( "text" ) ){ |
42 | text += "<br><br><hr><br>"; | 42 | text += "<br><br><hr><br>"; |
43 | QFile f(_doc->file()); | 43 | QFile f(_doc->file()); |
44 | if ( f.open(IO_ReadOnly) ) { | 44 | if ( f.open(IO_ReadOnly) ) { |
45 | QTextStream t( &f ); | 45 | QTextStream t( &f ); |
46 | while ( !t.eof() ) | 46 | while ( !t.eof() ) |
47 | text += t.readLine() + "<br>"; | 47 | text += t.readLine() + "<br>"; |
48 | } | 48 | } |
49 | f.close(); | 49 | f.close(); |
50 | } | 50 | } |
51 | /* text += "<br><br>`"; | 51 | /* text += "<br><br>`"; |
52 | text += _doc->exec(); | 52 | text += _doc->exec(); |
53 | text += "`";*/ | 53 | text += "`";*/ |
54 | QStringList list = _doc->mimeTypes(); | 54 | QStringList list = _doc->mimeTypes(); |
55 | int i = 0; | 55 | int i = 0; |
56 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { | 56 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { |
diff --git a/core/pim/osearch/mainwindow.cpp b/core/pim/osearch/mainwindow.cpp index adce926..2936b17 100644 --- a/core/pim/osearch/mainwindow.cpp +++ b/core/pim/osearch/mainwindow.cpp | |||
@@ -113,46 +113,43 @@ void MainWindow::makeMenu() | |||
113 | QPopupMenu *searchMenu = new QPopupMenu( menuBar ); | 113 | QPopupMenu *searchMenu = new QPopupMenu( menuBar ); |
114 | // QPopupMenu *viewMenu = new QPopupMenu( menuBar ); | 114 | // QPopupMenu *viewMenu = new QPopupMenu( menuBar ); |
115 | QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); | 115 | QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); |
116 | QPopupMenu *searchOptions = new QPopupMenu( cfgMenu ); | 116 | QPopupMenu *searchOptions = new QPopupMenu( cfgMenu ); |
117 | 117 | ||
118 | setToolBarsMovable( false ); | 118 | setToolBarsMovable( false ); |
119 | toolBar->setHorizontalStretchable( true ); | 119 | toolBar->setHorizontalStretchable( true ); |
120 | menuBar->insertItem( tr( "Search" ), searchMenu ); | 120 | menuBar->insertItem( tr( "Search" ), searchMenu ); |
121 | menuBar->insertItem( tr( "Settings" ), cfgMenu ); | 121 | menuBar->insertItem( tr( "Settings" ), cfgMenu ); |
122 | 122 | ||
123 | //SETTINGS MENU | 123 | //SETTINGS MENU |
124 | cfgMenu->insertItem( tr( "Search" ), searchOptions ); | 124 | cfgMenu->insertItem( tr( "Search" ), searchOptions ); |
125 | QPopupMenu *pop; | 125 | QPopupMenu *pop; |
126 | for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){ | 126 | for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){ |
127 | pop = s->popupMenu(); | 127 | pop = s->popupMenu(); |
128 | if (pop){ | 128 | if (pop){ |
129 | qDebug("inserting settings menu for %s",s->text(0).latin1()); | ||
130 | cfgMenu->insertItem( s->text(0), pop ); | 129 | cfgMenu->insertItem( s->text(0), pop ); |
131 | //connect( pop, SIGNAL( activated(int) ), SLOT( optionChanged(int) ) ); | ||
132 | } | 130 | } |
133 | } | 131 | } |
134 | 132 | ||
135 | 133 | ||
136 | //SEARCH | 134 | //SEARCH |
137 | SearchAllAction = new QAction( tr("Search all"),QString::null, 0, this, 0 ); | 135 | SearchAllAction = new QAction( tr("Search all"),QString::null, 0, this, 0 ); |
138 | SearchAllAction->setIconSet( Resource::loadIconSet( "find" ) ); | 136 | SearchAllAction->setIconSet( Resource::loadIconSet( "find" ) ); |
139 | connect( SearchAllAction, SIGNAL(activated()), this, SLOT(searchAll()) ); | 137 | connect( SearchAllAction, SIGNAL(activated()), this, SLOT(searchAll()) ); |
140 | SearchAllAction->addTo( searchMenu ); | 138 | SearchAllAction->addTo( searchMenu ); |
141 | searchMenu->insertItem( tr( "Options" ), searchOptions ); | 139 | searchMenu->insertItem( tr( "Options" ), searchOptions ); |
142 | //connect( searchOptions, SIGNAL( activated(int) ), SLOT( optionChanged(int) ) ); | ||
143 | 140 | ||
144 | //SEARCH OPTIONS | 141 | //SEARCH OPTIONS |
145 | //actionWholeWordsOnly = new QAction( tr("Whole words only"),QString::null, 0, this, 0, true ); | 142 | //actionWholeWordsOnly = new QAction( tr("Whole words only"),QString::null, 0, this, 0, true ); |
146 | //actionWholeWordsOnly->addTo( searchOptions ); | 143 | //actionWholeWordsOnly->addTo( searchOptions ); |
147 | actionCaseSensitiv = new QAction( tr("Case sensitiv"),QString::null, 0, this, 0, true ); | 144 | actionCaseSensitiv = new QAction( tr("Case sensitiv"),QString::null, 0, this, 0, true ); |
148 | actionCaseSensitiv->addTo( searchOptions ); | 145 | actionCaseSensitiv->addTo( searchOptions ); |
149 | actionWildcards = new QAction( tr("Use wildcards"),QString::null, 0, this, 0, true ); | 146 | actionWildcards = new QAction( tr("Use wildcards"),QString::null, 0, this, 0, true ); |
150 | actionWildcards->addTo( searchOptions ); | 147 | actionWildcards->addTo( searchOptions ); |
151 | 148 | ||
152 | //SEARCH BAR | 149 | //SEARCH BAR |
153 | addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); | 150 | addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); |
154 | QLineEdit *searchEdit = new QLineEdit( searchBar, "seachEdit" ); | 151 | QLineEdit *searchEdit = new QLineEdit( searchBar, "seachEdit" ); |
155 | searchEdit->setFocus(); | 152 | searchEdit->setFocus(); |
156 | searchBar->setHorizontalStretchable( TRUE ); | 153 | searchBar->setHorizontalStretchable( TRUE ); |
157 | searchBar->setStretchableWidget( searchEdit ); | 154 | searchBar->setStretchableWidget( searchEdit ); |
158 | SearchAllAction->addTo( searchBar ); | 155 | SearchAllAction->addTo( searchBar ); |
@@ -170,44 +167,41 @@ MainWindow::~MainWindow() | |||
170 | //cfg.writeEntry( "whole_words_only", actionWholeWordsOnly->isOn() ); | 167 | //cfg.writeEntry( "whole_words_only", actionWholeWordsOnly->isOn() ); |
171 | } | 168 | } |
172 | 169 | ||
173 | void MainWindow::setCurrent(QListViewItem *item) | 170 | void MainWindow::setCurrent(QListViewItem *item) |
174 | { | 171 | { |
175 | if (!item) return; | 172 | if (!item) return; |
176 | _currentItem = (OListViewItem*)item; | 173 | _currentItem = (OListViewItem*)item; |
177 | //_currentItem = dynamic_cast<OListViewItem*>(item); | 174 | //_currentItem = dynamic_cast<OListViewItem*>(item); |
178 | if (_currentItem->rtti() == OListViewItem::Result){ | 175 | if (_currentItem->rtti() == OListViewItem::Result){ |
179 | ResultItem *res = (ResultItem*)item; | 176 | ResultItem *res = (ResultItem*)item; |
180 | // ResultItem *res = dynamic_cast<ResultItem*>(item); | 177 | // ResultItem *res = dynamic_cast<ResultItem*>(item); |
181 | richEdit->setText( res->toRichText() ); | 178 | richEdit->setText( res->toRichText() ); |
182 | QIntDict<QString> acts = res->actions(); | 179 | QIntDict<QString> acts = res->actions(); |
183 | QButton *button; | 180 | QButton *button; |
184 | for (uint i = 0; i < acts.count(); i++){ | 181 | for (uint i = 0; i < acts.count(); i++){ |
185 | button = buttonGroupActions->find( i ); | 182 | button = buttonGroupActions->find( i ); |
186 | qDebug("action %i >%s<",i,acts[i]->latin1()); | ||
187 | if (!button) { | 183 | if (!button) { |
188 | qDebug("BUTTON"); | ||
189 | button = new QPushButton( detailsFrame ); | 184 | button = new QPushButton( detailsFrame ); |
190 | buttonLayout->addWidget( button, 0 ); | 185 | buttonLayout->addWidget( button, 0 ); |
191 | buttonGroupActions->insert( button, i); | 186 | buttonGroupActions->insert( button, i); |
192 | } | 187 | } |
193 | button->setText( *acts[i] ); | 188 | button->setText( *acts[i] ); |
194 | button->show(); | 189 | button->show(); |
195 | } | 190 | } |
196 | for (uint i = acts.count(); i < _buttonCount; i++){ | 191 | for (uint i = acts.count(); i < _buttonCount; i++){ |
197 | qDebug("remove button %i of %i",i, _buttonCount); | ||
198 | button = buttonGroupActions->find( i ); | 192 | button = buttonGroupActions->find( i ); |
199 | if (button) button->hide(); | 193 | if (button) button->hide(); |
200 | } | 194 | } |
201 | _buttonCount = acts.count(); | 195 | _buttonCount = acts.count(); |
202 | detailsFrame->show(); | 196 | detailsFrame->show(); |
203 | }else detailsFrame->hide(); | 197 | }else detailsFrame->hide(); |
204 | popupTimer->start( 300, true ); | 198 | popupTimer->start( 300, true ); |
205 | } | 199 | } |
206 | 200 | ||
207 | void MainWindow::stopTimer(QListViewItem*) | 201 | void MainWindow::stopTimer(QListViewItem*) |
208 | { | 202 | { |
209 | popupTimer->stop(); | 203 | popupTimer->stop(); |
210 | } | 204 | } |
211 | 205 | ||
212 | void MainWindow::showPopup() | 206 | void MainWindow::showPopup() |
213 | { | 207 | { |
@@ -251,19 +245,18 @@ void MainWindow::searchAll() | |||
251 | s->doSearch(); | 245 | s->doSearch(); |
252 | //resultsList->repaint(); | 246 | //resultsList->repaint(); |
253 | } | 247 | } |
254 | } | 248 | } |
255 | 249 | ||
256 | void MainWindow::slotAction( int act ) | 250 | void MainWindow::slotAction( int act ) |
257 | { | 251 | { |
258 | if (_currentItem->rtti() == OListViewItem::Result){ | 252 | if (_currentItem->rtti() == OListViewItem::Result){ |
259 | ResultItem *res = (ResultItem*)_currentItem; | 253 | ResultItem *res = (ResultItem*)_currentItem; |
260 | // ResultItem *res = dynamic_cast<ResultItem*>(item); | 254 | // ResultItem *res = dynamic_cast<ResultItem*>(item); |
261 | res->action(act); | 255 | res->action(act); |
262 | } | 256 | } |
263 | } | 257 | } |
264 | 258 | ||
265 | void MainWindow::optionChanged(int i) | 259 | void MainWindow::optionChanged(int i) |
266 | { | 260 | { |
267 | qDebug("optionChanged(%i)",i); | ||
268 | searchStringChanged(); | 261 | searchStringChanged(); |
269 | } | 262 | } |