author | ar <ar> | 2004-06-02 22:20:53 (UTC) |
---|---|---|
committer | ar <ar> | 2004-06-02 22:20:53 (UTC) |
commit | 9135254f2b593741cf7b0ffd80bb8bb63986333d (patch) (unidiff) | |
tree | 98248548d823b97970b2240695c958b7ce440a9d /libopie2 | |
parent | 8fe425e226eefcd652c4cb875d68fbd886d4c42c (diff) | |
download | opie-9135254f2b593741cf7b0ffd80bb8bb63986333d.zip opie-9135254f2b593741cf7b0ffd80bb8bb63986333d.tar.gz opie-9135254f2b593741cf7b0ffd80bb8bb63986333d.tar.bz2 |
- convert to odebug framework
-rw-r--r-- | libopie2/opieui/big-screen/osplitter.cpp | 25 | ||||
-rw-r--r-- | libopie2/opieui/big-screen/owidgetstack.cpp | 5 | ||||
-rw-r--r-- | libopie2/opieui/fileselector/ofileselector.cpp | 5 | ||||
-rw-r--r-- | libopie2/opieui/olistview.cpp | 16 | ||||
-rw-r--r-- | libopie2/opieui/opopupmenu.cpp | 30 | ||||
-rw-r--r-- | libopie2/opieui/otaskbarapplet.h | 10 |
6 files changed, 50 insertions, 41 deletions
diff --git a/libopie2/opieui/big-screen/osplitter.cpp b/libopie2/opieui/big-screen/osplitter.cpp index f0287ed..f50e7f0 100644 --- a/libopie2/opieui/big-screen/osplitter.cpp +++ b/libopie2/opieui/big-screen/osplitter.cpp | |||
@@ -9,48 +9,49 @@ | |||
9 | - . .-<_> .<> Foundation; either version 2 of the License, | 9 | - . .-<_> .<> Foundation; either version 2 of the License, |
10 | ._= =} : or (at your option) any later version. | 10 | ._= =} : or (at your option) any later version. |
11 | .%`+i> _;_. | 11 | .%`+i> _;_. |
12 | .i_,=:_. -<s. This library is distributed in the hope that | 12 | .i_,=:_. -<s. This library is distributed in the hope that |
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | : .. .:, . . . without even the implied warranty of | 14 | : .. .:, . . . without even the implied warranty of |
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
17 | ..}^=.= = ; Library General Public License for more | 17 | ..}^=.= = ; Library General Public License for more |
18 | ++= -. .` .: details. | 18 | ++= -. .` .: details. |
19 | : = ...= . :.=- | 19 | : = ...= . :.=- |
20 | -. .:....=;==+<; You should have received a copy of the GNU | 20 | -. .:....=;==+<; You should have received a copy of the GNU |
21 | -_. . . )=. = Library General Public License along with | 21 | -_. . . )=. = Library General Public License along with |
22 | -- :-=` this library; see the file COPYING.LIB. | 22 | -- :-=` this library; see the file COPYING.LIB. |
23 | If not, write to the Free Software Foundation, | 23 | If not, write to the Free Software Foundation, |
24 | Inc., 59 Temple Place - Suite 330, | 24 | Inc., 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include "osplitter.h" | 29 | #include "osplitter.h" |
30 | 30 | ||
31 | /* OPIE */ | 31 | /* OPIE */ |
32 | #include <opie2/otabwidget.h> | 32 | #include <opie2/otabwidget.h> |
33 | #include <opie2/odebug.h> | ||
33 | 34 | ||
34 | /* QT */ | 35 | /* QT */ |
35 | #include <qvaluelist.h> | 36 | #include <qvaluelist.h> |
36 | #include <qvbox.h> | 37 | #include <qvbox.h> |
37 | 38 | ||
38 | using namespace Opie::Ui; | 39 | using namespace Opie::Ui; |
39 | using namespace Opie::Ui::Internal; | 40 | using namespace Opie::Ui::Internal; |
40 | 41 | ||
41 | /** | 42 | /** |
42 | * | 43 | * |
43 | * This is the constructor of OSplitter | 44 | * This is the constructor of OSplitter |
44 | * You might want to call setSizeChange to tell | 45 | * You might want to call setSizeChange to tell |
45 | * OSplitter to change its layout when a specefic | 46 | * OSplitter to change its layout when a specefic |
46 | * mark was crossed. OSplitter sets a default value. | 47 | * mark was crossed. OSplitter sets a default value. |
47 | * | 48 | * |
48 | * You cann add widget with addWidget to the OSplitter. | 49 | * You cann add widget with addWidget to the OSplitter. |
49 | * OSplitter supports also grouping of Splitters where they | 50 | * OSplitter supports also grouping of Splitters where they |
50 | * can share one OTabBar in small screen mode. This can be used | 51 | * can share one OTabBar in small screen mode. This can be used |
51 | * for email clients like vies but see the example. | 52 | * for email clients like vies but see the example. |
52 | * | 53 | * |
53 | * @param orient The orientation wether to layout horizontal or vertical | 54 | * @param orient The orientation wether to layout horizontal or vertical |
54 | * @param parent The parent of this widget | 55 | * @param parent The parent of this widget |
55 | * @param name The name passed on to QObject | 56 | * @param name The name passed on to QObject |
56 | * @param fl Additional widgets flags passed to QWidget | 57 | * @param fl Additional widgets flags passed to QWidget |
@@ -60,49 +61,49 @@ using namespace Opie::Ui::Internal; | |||
60 | OSplitter::OSplitter( Orientation orient, QWidget* parent, const char* name, WFlags fl ) | 61 | OSplitter::OSplitter( Orientation orient, QWidget* parent, const char* name, WFlags fl ) |
61 | : QFrame( parent, name, fl ) | 62 | : QFrame( parent, name, fl ) |
62 | { | 63 | { |
63 | m_orient = orient; | 64 | m_orient = orient; |
64 | m_hbox = 0; | 65 | m_hbox = 0; |
65 | m_size_policy = 330; | 66 | m_size_policy = 330; |
66 | setFontPropagation( AllChildren ); | 67 | setFontPropagation( AllChildren ); |
67 | setPalettePropagation( AllChildren ); | 68 | setPalettePropagation( AllChildren ); |
68 | 69 | ||
69 | /* start by default with the tab widget */ | 70 | /* start by default with the tab widget */ |
70 | m_tabWidget = 0; | 71 | m_tabWidget = 0; |
71 | m_parentTab = 0; | 72 | m_parentTab = 0; |
72 | changeTab(); | 73 | changeTab(); |
73 | 74 | ||
74 | } | 75 | } |
75 | 76 | ||
76 | 77 | ||
77 | /** | 78 | /** |
78 | * Destructor destructs this object and cleans up. All child | 79 | * Destructor destructs this object and cleans up. All child |
79 | * widgets will be deleted | 80 | * widgets will be deleted |
80 | * @see addWidget | 81 | * @see addWidget |
81 | */ | 82 | */ |
82 | OSplitter::~OSplitter() | 83 | OSplitter::~OSplitter() |
83 | { | 84 | { |
84 | qWarning("Deleted Splitter"); | 85 | owarn << "Deleted Splitter" << oendl; |
85 | m_splitter.setAutoDelete( true ); | 86 | m_splitter.setAutoDelete( true ); |
86 | m_splitter.clear(); | 87 | m_splitter.clear(); |
87 | 88 | ||
88 | delete m_hbox; | 89 | delete m_hbox; |
89 | delete m_tabWidget; | 90 | delete m_tabWidget; |
90 | } | 91 | } |
91 | 92 | ||
92 | 93 | ||
93 | /** | 94 | /** |
94 | * Sets the label for the Splitter. This label will be used | 95 | * Sets the label for the Splitter. This label will be used |
95 | * if a parent splitter is arranged as TabWidget but | 96 | * if a parent splitter is arranged as TabWidget but |
96 | * this splitter is in fullscreen mode. Then a tab with OSplitter::label() | 97 | * this splitter is in fullscreen mode. Then a tab with OSplitter::label() |
97 | * and iconName() gets added. | 98 | * and iconName() gets added. |
98 | * | 99 | * |
99 | * @param name The name of the Label | 100 | * @param name The name of the Label |
100 | */ | 101 | */ |
101 | void OSplitter::setLabel( const QString& name ) | 102 | void OSplitter::setLabel( const QString& name ) |
102 | { | 103 | { |
103 | m_name = name; | 104 | m_name = name; |
104 | } | 105 | } |
105 | 106 | ||
106 | /** | 107 | /** |
107 | * @see setLabel but this is for the icon retrieved by Resource | 108 | * @see setLabel but this is for the icon retrieved by Resource |
108 | * | 109 | * |
@@ -189,49 +190,49 @@ void OSplitter::addWidget( OSplitter* split ) | |||
189 | void OSplitter::removeWidget( OSplitter* split) | 190 | void OSplitter::removeWidget( OSplitter* split) |
190 | { | 191 | { |
191 | split->setTabWidget( 0 ); | 192 | split->setTabWidget( 0 ); |
192 | split->reparent( 0, 0, QPoint(0, 0) ); | 193 | split->reparent( 0, 0, QPoint(0, 0) ); |
193 | } | 194 | } |
194 | 195 | ||
195 | /** | 196 | /** |
196 | * Adds a widget to the Splitter. The widgets gets inserted | 197 | * Adds a widget to the Splitter. The widgets gets inserted |
197 | * at the end of either the Box or TabWidget. | 198 | * at the end of either the Box or TabWidget. |
198 | * Ownership gets transfered and the widgets gets reparented. | 199 | * Ownership gets transfered and the widgets gets reparented. |
199 | * Note: icon and label is only available on small screensizes | 200 | * Note: icon and label is only available on small screensizes |
200 | * if size is smaller than the mark | 201 | * if size is smaller than the mark |
201 | * Warning: No null checking of the widget is done. Only on debug | 202 | * Warning: No null checking of the widget is done. Only on debug |
202 | * a message will be outputtet | 203 | * a message will be outputtet |
203 | * | 204 | * |
204 | * @param wid The widget which will be added | 205 | * @param wid The widget which will be added |
205 | * @param icon The icon of the possible Tab | 206 | * @param icon The icon of the possible Tab |
206 | * @param label The label of the possible Tab | 207 | * @param label The label of the possible Tab |
207 | */ | 208 | */ |
208 | void OSplitter::addWidget( QWidget* wid, const QString& icon, const QString& label ) | 209 | void OSplitter::addWidget( QWidget* wid, const QString& icon, const QString& label ) |
209 | { | 210 | { |
210 | #ifdef DEBUG | 211 | #ifdef DEBUG |
211 | if (!wid ) | 212 | if (!wid ) |
212 | { | 213 | { |
213 | qWarning("Widget is not valid!"); | 214 | owarn << "Widget is not valid!" << oendl; |
214 | return; | 215 | return; |
215 | } | 216 | } |
216 | #endif | 217 | #endif |
217 | OSplitterContainer cont; | 218 | OSplitterContainer cont; |
218 | cont.widget = wid; | 219 | cont.widget = wid; |
219 | cont.icon =icon; | 220 | cont.icon =icon; |
220 | cont.name = label; | 221 | cont.name = label; |
221 | 222 | ||
222 | m_container.append( cont ); | 223 | m_container.append( cont ); |
223 | 224 | ||
224 | /* | 225 | /* |
225 | * | 226 | * |
226 | */ | 227 | */ |
227 | if (!m_splitter.isEmpty() && (m_tabWidget || m_parentTab ) ) | 228 | if (!m_splitter.isEmpty() && (m_tabWidget || m_parentTab ) ) |
228 | setTabWidget( m_parentTab ); | 229 | setTabWidget( m_parentTab ); |
229 | else | 230 | else |
230 | { | 231 | { |
231 | if (m_hbox ) | 232 | if (m_hbox ) |
232 | addToBox( cont ); | 233 | addToBox( cont ); |
233 | else | 234 | else |
234 | addToTab( cont ); | 235 | addToTab( cont ); |
235 | } | 236 | } |
236 | } | 237 | } |
237 | 238 | ||
@@ -345,68 +346,68 @@ QSize OSplitter::sizeHint()const | |||
345 | else | 346 | else |
346 | return m_tabWidget->sizeHint(); | 347 | return m_tabWidget->sizeHint(); |
347 | } | 348 | } |
348 | 349 | ||
349 | QSize OSplitter::minimumSizeHint()const | 350 | QSize OSplitter::minimumSizeHint()const |
350 | { | 351 | { |
351 | if (m_parentTab ) | 352 | if (m_parentTab ) |
352 | return QFrame::minimumSizeHint(); | 353 | return QFrame::minimumSizeHint(); |
353 | if (m_hbox) | 354 | if (m_hbox) |
354 | return m_hbox->sizeHint(); | 355 | return m_hbox->sizeHint(); |
355 | else | 356 | else |
356 | return m_tabWidget->sizeHint(); | 357 | return m_tabWidget->sizeHint(); |
357 | } | 358 | } |
358 | #endif | 359 | #endif |
359 | 360 | ||
360 | /** | 361 | /** |
361 | * @reimplemented for internal reasons | 362 | * @reimplemented for internal reasons |
362 | */ | 363 | */ |
363 | void OSplitter::resizeEvent( QResizeEvent* res ) | 364 | void OSplitter::resizeEvent( QResizeEvent* res ) |
364 | { | 365 | { |
365 | QFrame::resizeEvent( res ); | 366 | QFrame::resizeEvent( res ); |
366 | /* | 367 | /* |
367 | * | 368 | * |
368 | */ | 369 | */ |
369 | // qWarning("Old size was width = %d height = %d", res->oldSize().width(), res->oldSize().height() ); | 370 | // owarn << "Old size was width = " << res->oldSize().width() << " height = " << res->oldSize().height() << "" << oendl; |
370 | bool mode = true; | 371 | bool mode = true; |
371 | qWarning("New size is width = %d height = %d %s", res->size().width(), res->size().height(), name() ); | 372 | owarn << "New size is width = " << res->size().width() << " height = " << res->size().height() << " " << name() << "" << oendl; |
372 | if ( res->size().width() > m_size_policy && | 373 | if ( res->size().width() > m_size_policy && |
373 | m_orient == Horizontal ) | 374 | m_orient == Horizontal ) |
374 | { | 375 | { |
375 | changeHBox(); | 376 | changeHBox(); |
376 | mode = false; | 377 | mode = false; |
377 | } | 378 | } |
378 | else if ( (res->size().width() <= m_size_policy && | 379 | else if ( (res->size().width() <= m_size_policy && |
379 | m_orient == Horizontal ) || | 380 | m_orient == Horizontal ) || |
380 | (res->size().height() <= m_size_policy && | 381 | (res->size().height() <= m_size_policy && |
381 | m_orient == Vertical ) ) | 382 | m_orient == Vertical ) ) |
382 | { | 383 | { |
383 | changeTab(); | 384 | changeTab(); |
384 | } | 385 | } |
385 | else if ( res->size().height() > m_size_policy && | 386 | else if ( res->size().height() > m_size_policy && |
386 | m_orient == Vertical ) | 387 | m_orient == Vertical ) |
387 | { | 388 | { |
388 | qWarning("Changng to vbox %s", name() ); | 389 | owarn << "Changng to vbox " << name() << "" << oendl; |
389 | changeVBox(); | 390 | changeVBox(); |
390 | mode = false; | 391 | mode = false; |
391 | } | 392 | } |
392 | 393 | ||
393 | emit sizeChanged(mode, m_orient ); | 394 | emit sizeChanged(mode, m_orient ); |
394 | } | 395 | } |
395 | 396 | ||
396 | /* | 397 | /* |
397 | * Adds a container to a tab either the parent tab | 398 | * Adds a container to a tab either the parent tab |
398 | * or our own | 399 | * or our own |
399 | */ | 400 | */ |
400 | void OSplitter::addToTab( const Opie::Ui::Internal::OSplitterContainer& con ) | 401 | void OSplitter::addToTab( const Opie::Ui::Internal::OSplitterContainer& con ) |
401 | { | 402 | { |
402 | QWidget *wid = con.widget; | 403 | QWidget *wid = con.widget; |
403 | // not needed widgetstack will reparent as well wid.reparent(m_tabWidget, wid->getWFlags(), QPoint(0, 0) ); | 404 | // not needed widgetstack will reparent as well wid.reparent(m_tabWidget, wid->getWFlags(), QPoint(0, 0) ); |
404 | if (m_parentTab ) | 405 | if (m_parentTab ) |
405 | m_parentTab->addTab( wid, con.icon, con.name ); | 406 | m_parentTab->addTab( wid, con.icon, con.name ); |
406 | else | 407 | else |
407 | m_tabWidget->addTab( wid, con.icon, con.name ); | 408 | m_tabWidget->addTab( wid, con.icon, con.name ); |
408 | } | 409 | } |
409 | 410 | ||
410 | 411 | ||
411 | /* | 412 | /* |
412 | * adds a container to the box | 413 | * adds a container to the box |
@@ -423,164 +424,164 @@ void OSplitter::addToBox( const Opie::Ui::Internal::OSplitterContainer& con ) | |||
423 | */ | 424 | */ |
424 | void OSplitter::removeFromTab( QWidget* wid ) | 425 | void OSplitter::removeFromTab( QWidget* wid ) |
425 | { | 426 | { |
426 | if (m_parentTab ) | 427 | if (m_parentTab ) |
427 | m_parentTab->removePage( wid ); | 428 | m_parentTab->removePage( wid ); |
428 | else | 429 | else |
429 | m_tabWidget->removePage( wid ); | 430 | m_tabWidget->removePage( wid ); |
430 | } | 431 | } |
431 | 432 | ||
432 | /* | 433 | /* |
433 | * switches over to a OTabWidget layout | 434 | * switches over to a OTabWidget layout |
434 | * it is recursive | 435 | * it is recursive |
435 | */ | 436 | */ |
436 | void OSplitter::changeTab() | 437 | void OSplitter::changeTab() |
437 | { | 438 | { |
438 | /* if we're the owner of the tab widget */ | 439 | /* if we're the owner of the tab widget */ |
439 | if (m_tabWidget ) | 440 | if (m_tabWidget ) |
440 | { | 441 | { |
441 | raise(); | 442 | raise(); |
442 | show(); | 443 | show(); |
443 | m_tabWidget->setGeometry( frameRect() ); | 444 | m_tabWidget->setGeometry( frameRect() ); |
444 | return; | 445 | return; |
445 | } | 446 | } |
446 | 447 | ||
447 | qWarning(" New Tab Widget %s", name() ); | 448 | owarn << " New Tab Widget " << name() << "" << oendl; |
448 | /* | 449 | /* |
449 | * and add all widgets this will reparent them | 450 | * and add all widgets this will reparent them |
450 | * delete m_hbox set it to 0 | 451 | * delete m_hbox set it to 0 |
451 | * | 452 | * |
452 | */ | 453 | */ |
453 | OTabWidget *tab; | 454 | OTabWidget *tab; |
454 | if ( m_parentTab ) | 455 | if ( m_parentTab ) |
455 | { | 456 | { |
456 | hide(); | 457 | hide(); |
457 | tab = m_parentTab; | 458 | tab = m_parentTab; |
458 | /* expensive but needed cause we're called from setTabWidget and resizeEvent*/ | 459 | /* expensive but needed cause we're called from setTabWidget and resizeEvent*/ |
459 | if (!m_container.isEmpty() ) | 460 | if (!m_container.isEmpty() ) |
460 | { | 461 | { |
461 | ContainerList::Iterator it = m_container.begin(); | 462 | ContainerList::Iterator it = m_container.begin(); |
462 | for (; it != m_container.end(); ++it ) | 463 | for (; it != m_container.end(); ++it ) |
463 | m_parentTab->removePage( (*it).widget ); | 464 | m_parentTab->removePage( (*it).widget ); |
464 | } | 465 | } |
465 | } | 466 | } |
466 | else | 467 | else |
467 | tab = m_tabWidget = new OTabWidget( this ); | 468 | tab = m_tabWidget = new OTabWidget( this ); |
468 | 469 | ||
469 | connect(tab, SIGNAL(currentChanged(QWidget*) ), | 470 | connect(tab, SIGNAL(currentChanged(QWidget*) ), |
470 | this, SIGNAL(currentChanged(QWidget*) ) ); | 471 | this, SIGNAL(currentChanged(QWidget*) ) ); |
471 | 472 | ||
472 | for ( ContainerList::Iterator it = m_container.begin(); it != m_container.end(); ++it ) | 473 | for ( ContainerList::Iterator it = m_container.begin(); it != m_container.end(); ++it ) |
473 | { | 474 | { |
474 | qWarning("Widget is %s", (*it).name.latin1() ); | 475 | owarn << "Widget is " << (*it).name << "" << oendl; |
475 | addToTab( (*it) ); | 476 | addToTab( (*it) ); |
476 | } | 477 | } |
477 | 478 | ||
478 | for ( OSplitter* split = m_splitter.first(); split; split = m_splitter.next() ) | 479 | for ( OSplitter* split = m_splitter.first(); split; split = m_splitter.next() ) |
479 | { | 480 | { |
480 | split->reparent(this, 0, QPoint(0, 0) ); | 481 | split->reparent(this, 0, QPoint(0, 0) ); |
481 | split->setTabWidget( tab ); | 482 | split->setTabWidget( tab ); |
482 | } | 483 | } |
483 | 484 | ||
484 | 485 | ||
485 | delete m_hbox; | 486 | delete m_hbox; |
486 | m_hbox = 0; | 487 | m_hbox = 0; |
487 | if (!m_tabWidget ) | 488 | if (!m_tabWidget ) |
488 | return; | 489 | return; |
489 | 490 | ||
490 | m_tabWidget->setGeometry( frameRect() ); | 491 | m_tabWidget->setGeometry( frameRect() ); |
491 | m_tabWidget->show(); | 492 | m_tabWidget->show(); |
492 | 493 | ||
493 | } | 494 | } |
494 | 495 | ||
495 | /* | 496 | /* |
496 | * changes over to a box | 497 | * changes over to a box |
497 | * this is recursive as well | 498 | * this is recursive as well |
498 | */ | 499 | */ |
499 | void OSplitter::changeHBox() | 500 | void OSplitter::changeHBox() |
500 | { | 501 | { |
501 | if (m_hbox ) | 502 | if (m_hbox ) |
502 | { | 503 | { |
503 | m_hbox->setGeometry( frameRect() ); | 504 | m_hbox->setGeometry( frameRect() ); |
504 | return; | 505 | return; |
505 | } | 506 | } |
506 | 507 | ||
507 | qWarning("new HBox %s", name() ); | 508 | owarn << "new HBox " << name() << "" << oendl; |
508 | m_hbox = new QHBox( this ); | 509 | m_hbox = new QHBox( this ); |
509 | commonChangeBox(); | 510 | commonChangeBox(); |
510 | } | 511 | } |
511 | 512 | ||
512 | void OSplitter::changeVBox() | 513 | void OSplitter::changeVBox() |
513 | { | 514 | { |
514 | if (m_hbox ) | 515 | if (m_hbox ) |
515 | { | 516 | { |
516 | m_hbox->setGeometry( frameRect() ); | 517 | m_hbox->setGeometry( frameRect() ); |
517 | return; | 518 | return; |
518 | } | 519 | } |
519 | 520 | ||
520 | qWarning("New VBOX %s", name() ); | 521 | owarn << "New VBOX " << name() << "" << oendl; |
521 | m_hbox = new QVBox( this ); | 522 | m_hbox = new QVBox( this ); |
522 | 523 | ||
523 | commonChangeBox(); | 524 | commonChangeBox(); |
524 | 525 | ||
525 | } | 526 | } |
526 | 527 | ||
527 | /* | 528 | /* |
528 | * common box code | 529 | * common box code |
529 | * first remove and add children | 530 | * first remove and add children |
530 | * the other splitters | 531 | * the other splitters |
531 | * it is recursive as well due the call to setTabWidget | 532 | * it is recursive as well due the call to setTabWidget |
532 | */ | 533 | */ |
533 | void OSplitter::commonChangeBox() | 534 | void OSplitter::commonChangeBox() |
534 | { | 535 | { |
535 | qWarning(" Name of Splitters is %s", name() ); | 536 | owarn << " Name of Splitters is " << name() << "" << oendl; |
536 | 537 | ||
537 | for (ContainerList::Iterator it = m_container.begin(); it != m_container.end(); ++it ) | 538 | for (ContainerList::Iterator it = m_container.begin(); it != m_container.end(); ++it ) |
538 | { | 539 | { |
539 | /* only if parent tab.. m_tabWidgets gets deleted and would do that as well */ | 540 | /* only if parent tab.. m_tabWidgets gets deleted and would do that as well */ |
540 | if (m_parentTab ) | 541 | if (m_parentTab ) |
541 | removeFromTab( (*it).widget ); | 542 | removeFromTab( (*it).widget ); |
542 | qWarning("Adding to box %s", (*it).name.latin1() ); | 543 | owarn << "Adding to box " << (*it).name << "" << oendl; |
543 | addToBox( (*it) ); | 544 | addToBox( (*it) ); |
544 | } | 545 | } |
545 | for ( OSplitter* split = m_splitter.first(); split; split = m_splitter.next() ) | 546 | for ( OSplitter* split = m_splitter.first(); split; split = m_splitter.next() ) |
546 | { | 547 | { |
547 | /* tell them the world had changed */ | 548 | /* tell them the world had changed */ |
548 | split->setTabWidget( 0 ); | 549 | split->setTabWidget( 0 ); |
549 | OSplitterContainer con; | 550 | OSplitterContainer con; |
550 | con.widget = split; | 551 | con.widget = split; |
551 | // con.widget = split->m_tabWidget ? static_cast<QWidget*>(split->m_tabWidget) | 552 | // con.widget = split->m_tabWidget ? static_cast<QWidget*>(split->m_tabWidget) |
552 | // : static_cast<QWidget*>(split->m_hbox); | 553 | // : static_cast<QWidget*>(split->m_hbox); |
553 | addToBox( con ); | 554 | addToBox( con ); |
554 | } | 555 | } |
555 | 556 | ||
556 | 557 | ||
557 | 558 | ||
558 | if (m_parentTab ) | 559 | if (m_parentTab ) |
559 | m_parentTab->addTab(m_hbox, iconName(), label() ); | 560 | m_parentTab->addTab(m_hbox, iconName(), label() ); |
560 | else | 561 | else |
561 | { | 562 | { |
562 | qWarning(" setting Box geometry for %s", name() ); | 563 | owarn << " setting Box geometry for " << name() << "" << oendl; |
563 | m_hbox->setGeometry( frameRect() ); | 564 | m_hbox->setGeometry( frameRect() ); |
564 | m_hbox->show(); | 565 | m_hbox->show(); |
565 | delete m_tabWidget; | 566 | delete m_tabWidget; |
566 | m_tabWidget = 0; | 567 | m_tabWidget = 0; |
567 | show(); // also show this widget | 568 | show(); // also show this widget |
568 | } | 569 | } |
569 | } | 570 | } |
570 | 571 | ||
571 | /* | 572 | /* |
572 | * sets the tabwidget, removes tabs, and relayouts the widget | 573 | * sets the tabwidget, removes tabs, and relayouts the widget |
573 | */ | 574 | */ |
574 | void OSplitter::setTabWidget( OTabWidget* wid) | 575 | void OSplitter::setTabWidget( OTabWidget* wid) |
575 | { | 576 | { |
576 | /* clean up cause m_parentTab will not be available for us */ | 577 | /* clean up cause m_parentTab will not be available for us */ |
577 | if ( m_parentTab ) | 578 | if ( m_parentTab ) |
578 | { | 579 | { |
579 | if (m_hbox ) | 580 | if (m_hbox ) |
580 | m_parentTab->removePage( m_hbox ); | 581 | m_parentTab->removePage( m_hbox ); |
581 | else if (!m_container.isEmpty() ) | 582 | else if (!m_container.isEmpty() ) |
582 | { | 583 | { |
583 | ContainerList::Iterator it = m_container.begin(); | 584 | ContainerList::Iterator it = m_container.begin(); |
584 | for ( ; it != m_container.end(); ++it ) | 585 | for ( ; it != m_container.end(); ++it ) |
585 | m_parentTab->removePage( (*it).widget ); | 586 | m_parentTab->removePage( (*it).widget ); |
586 | } | 587 | } |
diff --git a/libopie2/opieui/big-screen/owidgetstack.cpp b/libopie2/opieui/big-screen/owidgetstack.cpp index a0a6355..de7f83f 100644 --- a/libopie2/opieui/big-screen/owidgetstack.cpp +++ b/libopie2/opieui/big-screen/owidgetstack.cpp | |||
@@ -7,48 +7,51 @@ | |||
7 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 7 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
8 | .="- .-=="i, .._ License as published by the Free Software | 8 | .="- .-=="i, .._ License as published by the Free Software |
9 | - . .-<_> .<> Foundation; either version 2 of the License, | 9 | - . .-<_> .<> Foundation; either version 2 of the License, |
10 | ._= =} : or (at your option) any later version. | 10 | ._= =} : or (at your option) any later version. |
11 | .%`+i> _;_. | 11 | .%`+i> _;_. |
12 | .i_,=:_. -<s. This library is distributed in the hope that | 12 | .i_,=:_. -<s. This library is distributed in the hope that |
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | : .. .:, . . . without even the implied warranty of | 14 | : .. .:, . . . without even the implied warranty of |
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
17 | ..}^=.= = ; Library General Public License for more | 17 | ..}^=.= = ; Library General Public License for more |
18 | ++= -. .` .: details. | 18 | ++= -. .` .: details. |
19 | : = ...= . :.=- | 19 | : = ...= . :.=- |
20 | -. .:....=;==+<; You should have received a copy of the GNU | 20 | -. .:....=;==+<; You should have received a copy of the GNU |
21 | -_. . . )=. = Library General Public License along with | 21 | -_. . . )=. = Library General Public License along with |
22 | -- :-=` this library; see the file COPYING.LIB. | 22 | -- :-=` this library; see the file COPYING.LIB. |
23 | If not, write to the Free Software Foundation, | 23 | If not, write to the Free Software Foundation, |
24 | Inc., 59 Temple Place - Suite 330, | 24 | Inc., 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include "owidgetstack.h" | 29 | #include "owidgetstack.h" |
30 | 30 | ||
31 | /* OPIE */ | ||
32 | #include <opie2/odebug.h> | ||
33 | |||
31 | /* QT */ | 34 | /* QT */ |
32 | #include <qapplication.h> | 35 | #include <qapplication.h> |
33 | #include <qwidgetstack.h> | 36 | #include <qwidgetstack.h> |
34 | 37 | ||
35 | namespace Opie { | 38 | namespace Opie { |
36 | namespace Ui { | 39 | namespace Ui { |
37 | const int mode_size = 330; | 40 | const int mode_size = 330; |
38 | 41 | ||
39 | 42 | ||
40 | 43 | ||
41 | /** | 44 | /** |
42 | * This is the standard widget. For simple usage see the example. Normally this widget | 45 | * This is the standard widget. For simple usage see the example. Normally this widget |
43 | * is the central widget of a QMainWindow. | 46 | * is the central widget of a QMainWindow. |
44 | * Use removeWidget before you delete a widget yourself. OWidgetStack does not | 47 | * Use removeWidget before you delete a widget yourself. OWidgetStack does not |
45 | * yet recognize removal of children. | 48 | * yet recognize removal of children. |
46 | * | 49 | * |
47 | * @param parent The parent widget. It maybe 0 but then you need to take care of deletion. | 50 | * @param parent The parent widget. It maybe 0 but then you need to take care of deletion. |
48 | * Or you use QPEApplication::showMainWidget(). | 51 | * Or you use QPEApplication::showMainWidget(). |
49 | * @param name Name will be passed on to QObject | 52 | * @param name Name will be passed on to QObject |
50 | * @param fl Additional window flags passed to QFrame. see @Qt::WFlags | 53 | * @param fl Additional window flags passed to QFrame. see @Qt::WFlags |
51 | */ | 54 | */ |
52 | OWidgetStack::OWidgetStack( QWidget* parent, const char* name, WFlags fl) | 55 | OWidgetStack::OWidgetStack( QWidget* parent, const char* name, WFlags fl) |
53 | : QFrame( parent, name, fl ) | 56 | : QFrame( parent, name, fl ) |
54 | { | 57 | { |
@@ -286,49 +289,49 @@ void OWidgetStack::raiseWidget( QWidget* wid) { | |||
286 | * Note that this method does not use visibleWIdget but remembers | 289 | * Note that this method does not use visibleWIdget but remembers |
287 | * the last raisedWidget | 290 | * the last raisedWidget |
288 | */ | 291 | */ |
289 | void OWidgetStack::hideWidget( int id) { | 292 | void OWidgetStack::hideWidget( int id) { |
290 | /* hiding our main widget wouldn't be smart */ | 293 | /* hiding our main widget wouldn't be smart */ |
291 | if ( m_mode == BigScreen && m_last != m_mWidget ) | 294 | if ( m_mode == BigScreen && m_last != m_mWidget ) |
292 | m_last->hide(); | 295 | m_last->hide(); |
293 | raiseWidget( id ); | 296 | raiseWidget( id ); |
294 | } | 297 | } |
295 | 298 | ||
296 | /** | 299 | /** |
297 | * This is overloaded and only differs in the parameters | 300 | * This is overloaded and only differs in the parameters |
298 | * it takes. | 301 | * it takes. |
299 | */ | 302 | */ |
300 | void OWidgetStack::hideWidget( QWidget* wid) { | 303 | void OWidgetStack::hideWidget( QWidget* wid) { |
301 | /* still not smart */ | 304 | /* still not smart */ |
302 | if ( m_mode == BigScreen && m_last != m_mWidget ) | 305 | if ( m_mode == BigScreen && m_last != m_mWidget ) |
303 | m_last->hide(); | 306 | m_last->hide(); |
304 | 307 | ||
305 | raiseWidget( wid ); | 308 | raiseWidget( wid ); |
306 | } | 309 | } |
307 | 310 | ||
308 | 311 | ||
309 | bool OWidgetStack::eventFilter( QObject* obj, QEvent* e) { | 312 | bool OWidgetStack::eventFilter( QObject* obj, QEvent* e) { |
310 | qWarning(" %s %s", obj->name(), obj->className() ); | 313 | owarn << " " << obj->name() << " " << obj->className() << "" << oendl; |
311 | if ( e->type() == QEvent::Resize ) { | 314 | if ( e->type() == QEvent::Resize ) { |
312 | QResizeEvent *res = static_cast<QResizeEvent*>( e ); | 315 | QResizeEvent *res = static_cast<QResizeEvent*>( e ); |
313 | QSize size = res->size(); | 316 | QSize size = res->size(); |
314 | if ( size.width() >= mode_size ) | 317 | if ( size.width() >= mode_size ) |
315 | switchTop(); | 318 | switchTop(); |
316 | else | 319 | else |
317 | switchStack(); | 320 | switchStack(); |
318 | } | 321 | } |
319 | return false; | 322 | return false; |
320 | } | 323 | } |
321 | 324 | ||
322 | 325 | ||
323 | /** | 326 | /** |
324 | * @internal_resons | 327 | * @internal_resons |
325 | */ | 328 | */ |
326 | void OWidgetStack::resizeEvent( QResizeEvent* ev ) { | 329 | void OWidgetStack::resizeEvent( QResizeEvent* ev ) { |
327 | QFrame::resizeEvent( ev ); | 330 | QFrame::resizeEvent( ev ); |
328 | if (m_mode == SmallScreen ) | 331 | if (m_mode == SmallScreen ) |
329 | m_stack->setGeometry( frameRect() ); | 332 | m_stack->setGeometry( frameRect() ); |
330 | else | 333 | else |
331 | if (m_mWidget ) | 334 | if (m_mWidget ) |
332 | m_mWidget->setGeometry( frameRect() ); | 335 | m_mWidget->setGeometry( frameRect() ); |
333 | 336 | ||
334 | } | 337 | } |
diff --git a/libopie2/opieui/fileselector/ofileselector.cpp b/libopie2/opieui/fileselector/ofileselector.cpp index a9ec8c4..1f6ca05 100644 --- a/libopie2/opieui/fileselector/ofileselector.cpp +++ b/libopie2/opieui/fileselector/ofileselector.cpp | |||
@@ -15,48 +15,49 @@ | |||
15 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
18 | ..}^=.= = ; Library General Public License for more | 18 | ..}^=.= = ; Library General Public License for more |
19 | ++= -. .` .: details. | 19 | ++= -. .` .: details. |
20 | : = ...= . :.=- | 20 | : = ...= . :.=- |
21 | -. .:....=;==+<; You should have received a copy of the GNU | 21 | -. .:....=;==+<; You should have received a copy of the GNU |
22 | -_. . . )=. = Library General Public License along with | 22 | -_. . . )=. = Library General Public License along with |
23 | -- :-=` this library; see the file COPYING.LIB. | 23 | -- :-=` this library; see the file COPYING.LIB. |
24 | If not, write to the Free Software Foundation, | 24 | If not, write to the Free Software Foundation, |
25 | Inc., 59 Temple Place - Suite 330, | 25 | Inc., 59 Temple Place - Suite 330, |
26 | Boston, MA 02111-1307, USA. | 26 | Boston, MA 02111-1307, USA. |
27 | 27 | ||
28 | */ | 28 | */ |
29 | 29 | ||
30 | /* hacky but we need to get FileSelector::filter */ | 30 | /* hacky but we need to get FileSelector::filter */ |
31 | #define private public | 31 | #define private public |
32 | #include <qpe/fileselector.h> | 32 | #include <qpe/fileselector.h> |
33 | #undef private | 33 | #undef private |
34 | 34 | ||
35 | #include "ofileselector_p.h" | 35 | #include "ofileselector_p.h" |
36 | 36 | ||
37 | /* OPIE */ | 37 | /* OPIE */ |
38 | #include <opie2/ofileselector.h> | 38 | #include <opie2/ofileselector.h> |
39 | #include <opie2/odebug.h> | ||
39 | 40 | ||
40 | #include <qpe/qpeapplication.h> | 41 | #include <qpe/qpeapplication.h> |
41 | #include <qpe/mimetype.h> | 42 | #include <qpe/mimetype.h> |
42 | #include <qpe/resource.h> | 43 | #include <qpe/resource.h> |
43 | #include <qpe/storage.h> | 44 | #include <qpe/storage.h> |
44 | 45 | ||
45 | /* QT */ | 46 | /* QT */ |
46 | #include <qcombobox.h> | 47 | #include <qcombobox.h> |
47 | #include <qdir.h> | 48 | #include <qdir.h> |
48 | #include <qhbox.h> | 49 | #include <qhbox.h> |
49 | #include <qheader.h> | 50 | #include <qheader.h> |
50 | #include <qlabel.h> | 51 | #include <qlabel.h> |
51 | #include <qlayout.h> | 52 | #include <qlayout.h> |
52 | #include <qlineedit.h> | 53 | #include <qlineedit.h> |
53 | #include <qlistview.h> | 54 | #include <qlistview.h> |
54 | #include <qpopupmenu.h> | 55 | #include <qpopupmenu.h> |
55 | #include <qwidgetstack.h> | 56 | #include <qwidgetstack.h> |
56 | #include <qregexp.h> | 57 | #include <qregexp.h> |
57 | #include <qobjectlist.h> | 58 | #include <qobjectlist.h> |
58 | 59 | ||
59 | using namespace Opie::Ui::Internal; | 60 | using namespace Opie::Ui::Internal; |
60 | 61 | ||
61 | namespace Opie { | 62 | namespace Opie { |
62 | namespace Ui { | 63 | namespace Ui { |
@@ -525,77 +526,77 @@ bool OFileViewFileListView::eventFilter (QObject *o, QEvent *e) | |||
525 | } | 526 | } |
526 | 527 | ||
527 | void OFileViewFileListView::connectSlots() | 528 | void OFileViewFileListView::connectSlots() |
528 | { | 529 | { |
529 | connect(m_view, SIGNAL(clicked(QListViewItem*) ), | 530 | connect(m_view, SIGNAL(clicked(QListViewItem*) ), |
530 | this, SLOT(slotCurrentChanged(QListViewItem*) ) ); | 531 | this, SLOT(slotCurrentChanged(QListViewItem*) ) ); |
531 | connect(m_view, SIGNAL(mouseButtonClicked(int,QListViewItem*,const QPoint&,int) ), | 532 | connect(m_view, SIGNAL(mouseButtonClicked(int,QListViewItem*,const QPoint&,int) ), |
532 | this, SLOT(slotClicked(int,QListViewItem*,const QPoint&,int) ) ); | 533 | this, SLOT(slotClicked(int,QListViewItem*,const QPoint&,int) ) ); |
533 | } | 534 | } |
534 | 535 | ||
535 | void OFileViewFileListView::slotCurrentChanged( QListViewItem* item) | 536 | void OFileViewFileListView::slotCurrentChanged( QListViewItem* item) |
536 | { | 537 | { |
537 | if (!item) | 538 | if (!item) |
538 | return; | 539 | return; |
539 | #if 0 | 540 | #if 0 |
540 | 541 | ||
541 | OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); | 542 | OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); |
542 | 543 | ||
543 | if (!sel->isDir() ) | 544 | if (!sel->isDir() ) |
544 | { | 545 | { |
545 | selector()->m_lneEdit->setText( sel->text(1) ); | 546 | selector()->m_lneEdit->setText( sel->text(1) ); |
546 | // if in fileselector mode we will emit selected | 547 | // if in fileselector mode we will emit selected |
547 | if ( selector()->mode() == OFileSelector::FileSelector ) | 548 | if ( selector()->mode() == OFileSelector::FileSelector ) |
548 | { | 549 | { |
549 | qWarning("slot Current Changed"); | 550 | owarn << "slot Current Changed" << oendl; |
550 | QStringList str = QStringList::split("->", sel->text(1) ); | 551 | QStringList str = QStringList::split("->", sel->text(1) ); |
551 | QString path = sel->directory() + "/" + str[0].stripWhiteSpace(); | 552 | QString path = sel->directory() + "/" + str[0].stripWhiteSpace(); |
552 | emit selector()->fileSelected( path ); | 553 | emit selector()->fileSelected( path ); |
553 | DocLnk lnk( path ); | 554 | DocLnk lnk( path ); |
554 | emit selector()->fileSelected( lnk ); | 555 | emit selector()->fileSelected( lnk ); |
555 | } | 556 | } |
556 | } | 557 | } |
557 | #endif | 558 | #endif |
558 | } | 559 | } |
559 | 560 | ||
560 | void OFileViewFileListView::slotClicked(int button , QListViewItem* item, const QPoint&, int ) | 561 | void OFileViewFileListView::slotClicked(int button , QListViewItem* item, const QPoint&, int ) |
561 | { | 562 | { |
562 | if (!item || ( button != Qt::LeftButton) ) | 563 | if (!item || ( button != Qt::LeftButton) ) |
563 | return; | 564 | return; |
564 | 565 | ||
565 | OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); | 566 | OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); |
566 | if (!sel->isLocked() ) | 567 | if (!sel->isLocked() ) |
567 | { | 568 | { |
568 | QStringList str = QStringList::split("->", sel->text(1) ); | 569 | QStringList str = QStringList::split("->", sel->text(1) ); |
569 | if (sel->isDir() ) | 570 | if (sel->isDir() ) |
570 | { | 571 | { |
571 | m_currentDir = sel->directory() + "/" + str[0].stripWhiteSpace(); | 572 | m_currentDir = sel->directory() + "/" + str[0].stripWhiteSpace(); |
572 | emit selector()->dirSelected( m_currentDir ); | 573 | emit selector()->dirSelected( m_currentDir ); |
573 | reread( m_all ); | 574 | reread( m_all ); |
574 | } | 575 | } |
575 | else | 576 | else |
576 | { // file | 577 | { // file |
577 | qWarning("slot Clicked"); | 578 | owarn << "slot Clicked" << oendl; |
578 | selector()->m_lneEdit->setText( str[0].stripWhiteSpace() ); | 579 | selector()->m_lneEdit->setText( str[0].stripWhiteSpace() ); |
579 | QString path = sel->directory() + "/" + str[0].stripWhiteSpace(); | 580 | QString path = sel->directory() + "/" + str[0].stripWhiteSpace(); |
580 | emit selector()->fileSelected( path ); | 581 | emit selector()->fileSelected( path ); |
581 | DocLnk lnk( path ); | 582 | DocLnk lnk( path ); |
582 | emit selector()->fileSelected( lnk ); | 583 | emit selector()->fileSelected( lnk ); |
583 | } | 584 | } |
584 | } // not locked | 585 | } // not locked |
585 | } | 586 | } |
586 | 587 | ||
587 | void OFileViewFileListView::addFile( QFileInfo* info, bool symlink ) | 588 | void OFileViewFileListView::addFile( QFileInfo* info, bool symlink ) |
588 | { | 589 | { |
589 | MimeType type( info->absFilePath() ); | 590 | MimeType type( info->absFilePath() ); |
590 | if (!compliesMime( type.id() ) ) | 591 | if (!compliesMime( type.id() ) ) |
591 | return; | 592 | return; |
592 | 593 | ||
593 | QPixmap pix = type.pixmap(); | 594 | QPixmap pix = type.pixmap(); |
594 | QString dir, name; bool locked; | 595 | QString dir, name; bool locked; |
595 | if ( pix.isNull() ) | 596 | if ( pix.isNull() ) |
596 | { | 597 | { |
597 | QWMatrix matrix; | 598 | QWMatrix matrix; |
598 | QPixmap pixer(Resource::loadPixmap("UnknownDocument") ); | 599 | QPixmap pixer(Resource::loadPixmap("UnknownDocument") ); |
599 | matrix.scale( .4, .4 ); | 600 | matrix.scale( .4, .4 ); |
600 | pix = pixer.xForm( matrix ); | 601 | pix = pixer.xForm( matrix ); |
601 | } | 602 | } |
diff --git a/libopie2/opieui/olistview.cpp b/libopie2/opieui/olistview.cpp index d7c92fd..0b3bdea 100644 --- a/libopie2/opieui/olistview.cpp +++ b/libopie2/opieui/olistview.cpp | |||
@@ -166,49 +166,49 @@ void OListView::serializeTo( QDataStream& s ) const | |||
166 | for ( int i = 0; i < items; ++i ) | 166 | for ( int i = 0; i < items; ++i ) |
167 | { | 167 | { |
168 | s << *static_cast<OListViewItem*>( item ); | 168 | s << *static_cast<OListViewItem*>( item ); |
169 | item = item->nextSibling(); | 169 | item = item->nextSibling(); |
170 | } | 170 | } |
171 | 171 | ||
172 | odebug << "OListview stored." << oendl; | 172 | odebug << "OListview stored." << oendl; |
173 | } | 173 | } |
174 | 174 | ||
175 | void OListView::serializeFrom( QDataStream& s ) | 175 | void OListView::serializeFrom( QDataStream& s ) |
176 | { | 176 | { |
177 | #warning Caution... the binary format is still under construction... | 177 | #warning Caution... the binary format is still under construction... |
178 | odebug << "loading OListView..." << oendl; | 178 | odebug << "loading OListView..." << oendl; |
179 | 179 | ||
180 | int cols; | 180 | int cols; |
181 | s >> cols; | 181 | s >> cols; |
182 | odebug << "read number of columns = " << cols << oendl; | 182 | odebug << "read number of columns = " << cols << oendl; |
183 | 183 | ||
184 | while ( columns() < cols ) addColumn( QString::null ); | 184 | while ( columns() < cols ) addColumn( QString::null ); |
185 | 185 | ||
186 | for ( int i = 0; i < cols; ++i ) | 186 | for ( int i = 0; i < cols; ++i ) |
187 | { | 187 | { |
188 | QString coltext; | 188 | QString coltext; |
189 | s >> coltext; | 189 | s >> coltext; |
190 | qDebug( "read text '%s' for column %d", (const char*) coltext, i ); | 190 | odebug << "read text '" << coltext << "' for column " << i << "" << oendl; |
191 | setColumnText( i, coltext ); | 191 | setColumnText( i, coltext ); |
192 | } | 192 | } |
193 | 193 | ||
194 | int items; | 194 | int items; |
195 | s >> items; | 195 | s >> items; |
196 | odebug << "read number of items = " << items << oendl; | 196 | odebug << "read number of items = " << items << oendl; |
197 | 197 | ||
198 | for ( int i = 0; i < items; ++i ) | 198 | for ( int i = 0; i < items; ++i ) |
199 | { | 199 | { |
200 | OListViewItem* item = childFactory(); | 200 | OListViewItem* item = childFactory(); |
201 | s >> *item; | 201 | s >> *item; |
202 | } | 202 | } |
203 | 203 | ||
204 | odebug << "OListView loaded." << oendl; | 204 | odebug << "OListView loaded." << oendl; |
205 | 205 | ||
206 | } | 206 | } |
207 | 207 | ||
208 | 208 | ||
209 | void OListView::expand() | 209 | void OListView::expand() |
210 | { | 210 | { |
211 | odebug << "OListView::expand" << oendl; | 211 | odebug << "OListView::expand" << oendl; |
212 | 212 | ||
213 | QListViewItemIterator it( this ); | 213 | QListViewItemIterator it( this ); |
214 | while ( it.current() ) { | 214 | while ( it.current() ) { |
@@ -421,55 +421,55 @@ void OListViewItem::serializeTo( QDataStream& s ) const | |||
421 | } | 421 | } |
422 | 422 | ||
423 | // store number of items and the items itself | 423 | // store number of items and the items itself |
424 | s << items; | 424 | s << items; |
425 | item = firstChild(); | 425 | item = firstChild(); |
426 | for ( int i = 0; i < items; ++i ) | 426 | for ( int i = 0; i < items; ++i ) |
427 | { | 427 | { |
428 | s << *static_cast<OListViewItem*>( item ); | 428 | s << *static_cast<OListViewItem*>( item ); |
429 | item = item->nextSibling(); | 429 | item = item->nextSibling(); |
430 | } | 430 | } |
431 | 431 | ||
432 | odebug << "OListviewItem stored." << oendl; | 432 | odebug << "OListviewItem stored." << oendl; |
433 | } | 433 | } |
434 | 434 | ||
435 | 435 | ||
436 | void OListViewItem::serializeFrom( QDataStream& s ) | 436 | void OListViewItem::serializeFrom( QDataStream& s ) |
437 | { | 437 | { |
438 | #warning Caution... the binary format is still under construction... | 438 | #warning Caution... the binary format is still under construction... |
439 | odebug << "loading OListViewItem..." << oendl; | 439 | odebug << "loading OListViewItem..." << oendl; |
440 | 440 | ||
441 | for ( int i = 0; i < listView()->columns(); ++i ) | 441 | for ( int i = 0; i < listView()->columns(); ++i ) |
442 | { | 442 | { |
443 | QString coltext; | 443 | QString coltext; |
444 | s >> coltext; | 444 | s >> coltext; |
445 | qDebug( "read text '%s' for column %d", (const char*) coltext, i ); | 445 | odebug << "read text '" << coltext << "' for column " << i << "" << oendl; |
446 | setText( i, coltext ); | 446 | setText( i, coltext ); |
447 | } | 447 | } |
448 | 448 | ||
449 | int items; | 449 | int items; |
450 | s >> items; | 450 | s >> items; |
451 | qDebug( "read number of items = %d", items ); | 451 | odebug << "read number of items = " << items << "" << oendl; |
452 | 452 | ||
453 | for ( int i = 0; i < items; ++i ) | 453 | for ( int i = 0; i < items; ++i ) |
454 | { | 454 | { |
455 | OListViewItem* item = childFactory(); | 455 | OListViewItem* item = childFactory(); |
456 | s >> (*item); | 456 | s >> (*item); |
457 | } | 457 | } |
458 | 458 | ||
459 | odebug << "OListViewItem loaded." << oendl; | 459 | odebug << "OListViewItem loaded." << oendl; |
460 | } | 460 | } |
461 | 461 | ||
462 | 462 | ||
463 | QDataStream& operator<<( QDataStream& s, const OListViewItem& lvi ) | 463 | QDataStream& operator<<( QDataStream& s, const OListViewItem& lvi ) |
464 | { | 464 | { |
465 | lvi.serializeTo( s ); | 465 | lvi.serializeTo( s ); |
466 | } | 466 | } |
467 | 467 | ||
468 | 468 | ||
469 | QDataStream& operator>>( QDataStream& s, OListViewItem& lvi ) | 469 | QDataStream& operator>>( QDataStream& s, OListViewItem& lvi ) |
470 | { | 470 | { |
471 | lvi.serializeFrom( s ); | 471 | lvi.serializeFrom( s ); |
472 | } | 472 | } |
473 | #endif // QT_NO_DATASTREAM | 473 | #endif // QT_NO_DATASTREAM |
474 | 474 | ||
475 | 475 | ||
@@ -594,82 +594,82 @@ void OCheckListItem::paintCell(QPainter *p, const QColorGroup &cg, int column, i | |||
594 | p->setPen( pen ); | 594 | p->setPen( pen ); |
595 | p->drawLine( width-1, 0, width-1, height() ); | 595 | p->drawLine( width-1, 0, width-1, height() ); |
596 | } | 596 | } |
597 | 597 | ||
598 | 598 | ||
599 | /*====================================================================================== | 599 | /*====================================================================================== |
600 | * ONamedListView | 600 | * ONamedListView |
601 | *======================================================================================*/ | 601 | *======================================================================================*/ |
602 | 602 | ||
603 | ONamedListView::ONamedListView( QWidget *parent, const char *name ) | 603 | ONamedListView::ONamedListView( QWidget *parent, const char *name ) |
604 | :OListView( parent, name ) | 604 | :OListView( parent, name ) |
605 | { | 605 | { |
606 | } | 606 | } |
607 | 607 | ||
608 | 608 | ||
609 | ONamedListView::~ONamedListView() | 609 | ONamedListView::~ONamedListView() |
610 | { | 610 | { |
611 | } | 611 | } |
612 | 612 | ||
613 | 613 | ||
614 | void ONamedListView::addColumns( const QStringList& columns ) | 614 | void ONamedListView::addColumns( const QStringList& columns ) |
615 | { | 615 | { |
616 | for ( QStringList::ConstIterator it = columns.begin(); it != columns.end(); ++it ) | 616 | for ( QStringList::ConstIterator it = columns.begin(); it != columns.end(); ++it ) |
617 | { | 617 | { |
618 | qDebug( "adding column %s", (const char*) *it ); | 618 | odebug << "adding column " << *it << "" << oendl; |
619 | addColumn( *it ); | 619 | addColumn( *it ); |
620 | } | 620 | } |
621 | } | 621 | } |
622 | 622 | ||
623 | 623 | ||
624 | int ONamedListView::findColumn( const QString& text ) const | 624 | int ONamedListView::findColumn( const QString& text ) const |
625 | { | 625 | { |
626 | //FIXME: If used excessively, this will slow down performance of updates | 626 | //FIXME: If used excessively, this will slow down performance of updates |
627 | //FIXME: because of the linear search over all column texts. | 627 | //FIXME: because of the linear search over all column texts. |
628 | //FIXME: I will optimize later by using a hash map. | 628 | //FIXME: I will optimize later by using a hash map. |
629 | for ( int i = 0; i < columns(); ++i ) | 629 | for ( int i = 0; i < columns(); ++i ) |
630 | if ( columnText( i ) == text ) | 630 | if ( columnText( i ) == text ) |
631 | return i; | 631 | return i; |
632 | return -1; | 632 | return -1; |
633 | } | 633 | } |
634 | 634 | ||
635 | 635 | ||
636 | ONamedListViewItem* ONamedListView::find( int column, const QString& text, int recurse ) const | 636 | ONamedListViewItem* ONamedListView::find( int column, const QString& text, int recurse ) const |
637 | { | 637 | { |
638 | return find( (ONamedListViewItem*) firstChild(), column, text, recurse ); | 638 | return find( (ONamedListViewItem*) firstChild(), column, text, recurse ); |
639 | } | 639 | } |
640 | 640 | ||
641 | 641 | ||
642 | ONamedListViewItem* ONamedListView::find( ONamedListViewItem* item, int column, const QString& text, int recurse ) const | 642 | ONamedListViewItem* ONamedListView::find( ONamedListViewItem* item, int column, const QString& text, int recurse ) const |
643 | { | 643 | { |
644 | ONamedListViewItem* result; | 644 | ONamedListViewItem* result; |
645 | while ( item && item->text( column ) != text ) | 645 | while ( item && item->text( column ) != text ) |
646 | { | 646 | { |
647 | qDebug( "checked %s", (const char*) item->text( column ) ); | 647 | odebug << "checked " << item->text( column ) << "" << oendl; |
648 | 648 | ||
649 | if ( recurse < 0 || recurse > 0 ) | 649 | if ( recurse < 0 || recurse > 0 ) |
650 | { | 650 | { |
651 | qDebug( "recursion is %d - recursing into...", recurse ); | 651 | odebug << "recursion is " << recurse << " - recursing into..." << oendl; |
652 | result = find( (ONamedListViewItem*) item->firstChild(), column, text, recurse-1 ); | 652 | result = find( (ONamedListViewItem*) item->firstChild(), column, text, recurse-1 ); |
653 | if ( result ) return result; | 653 | if ( result ) return result; |
654 | } | 654 | } |
655 | 655 | ||
656 | 656 | ||
657 | item = (ONamedListViewItem*) item->itemBelow(); | 657 | item = (ONamedListViewItem*) item->itemBelow(); |
658 | } | 658 | } |
659 | if ( item && item->text( column ) == text ) | 659 | if ( item && item->text( column ) == text ) |
660 | return item; | 660 | return item; |
661 | else | 661 | else |
662 | return 0; | 662 | return 0; |
663 | } | 663 | } |
664 | 664 | ||
665 | 665 | ||
666 | ONamedListViewItem* ONamedListView::find( const QString& column, const QString& text, int recurse ) const | 666 | ONamedListViewItem* ONamedListView::find( const QString& column, const QString& text, int recurse ) const |
667 | { | 667 | { |
668 | int col = findColumn( column ); | 668 | int col = findColumn( column ); |
669 | if ( col != -1 ) | 669 | if ( col != -1 ) |
670 | return find( (ONamedListViewItem*) firstChild(), col, text, recurse ); | 670 | return find( (ONamedListViewItem*) firstChild(), col, text, recurse ); |
671 | else | 671 | else |
672 | return 0; | 672 | return 0; |
673 | } | 673 | } |
674 | 674 | ||
675 | 675 | ||
@@ -704,61 +704,61 @@ ONamedListViewItem::ONamedListViewItem( QListViewItem* parent, const QStringList | |||
704 | ONamedListViewItem::ONamedListViewItem( QListView* parent, QListViewItem* after, const QStringList& texts ) | 704 | ONamedListViewItem::ONamedListViewItem( QListView* parent, QListViewItem* after, const QStringList& texts ) |
705 | :OListViewItem( parent, after ) | 705 | :OListViewItem( parent, after ) |
706 | { | 706 | { |
707 | setText( texts ); | 707 | setText( texts ); |
708 | } | 708 | } |
709 | 709 | ||
710 | 710 | ||
711 | ONamedListViewItem::ONamedListViewItem( QListViewItem* parent, QListViewItem* after, const QStringList& texts ) | 711 | ONamedListViewItem::ONamedListViewItem( QListViewItem* parent, QListViewItem* after, const QStringList& texts ) |
712 | :OListViewItem( parent, after ) | 712 | :OListViewItem( parent, after ) |
713 | { | 713 | { |
714 | setText( texts ); | 714 | setText( texts ); |
715 | } | 715 | } |
716 | 716 | ||
717 | 717 | ||
718 | ONamedListViewItem::~ONamedListViewItem() | 718 | ONamedListViewItem::~ONamedListViewItem() |
719 | { | 719 | { |
720 | } | 720 | } |
721 | 721 | ||
722 | 722 | ||
723 | void ONamedListViewItem::setText( const QStringList& texts ) | 723 | void ONamedListViewItem::setText( const QStringList& texts ) |
724 | { | 724 | { |
725 | int col = 0; | 725 | int col = 0; |
726 | for ( QStringList::ConstIterator it = texts.begin(); it != texts.end(); ++it ) | 726 | for ( QStringList::ConstIterator it = texts.begin(); it != texts.end(); ++it ) |
727 | { | 727 | { |
728 | qDebug( "setting column %d = text %s", col, (const char*) *it ); | 728 | odebug << "setting column " << col << " = text " << *it << "" << oendl; |
729 | OListViewItem::setText( col++, *it ); | 729 | OListViewItem::setText( col++, *it ); |
730 | } | 730 | } |
731 | 731 | ||
732 | } | 732 | } |
733 | 733 | ||
734 | 734 | ||
735 | void ONamedListViewItem::setText( const QString& column, const QString& text ) | 735 | void ONamedListViewItem::setText( const QString& column, const QString& text ) |
736 | { | 736 | { |
737 | //FIXME: If used excessively, this will slow down performance of updates | 737 | //FIXME: If used excessively, this will slow down performance of updates |
738 | //FIXME: because of the linear search over all column texts. | 738 | //FIXME: because of the linear search over all column texts. |
739 | //FIXME: I will optimize later by using a hash map. | 739 | //FIXME: I will optimize later by using a hash map. |
740 | int col = ( (ONamedListView*) listView() )->findColumn( column ); | 740 | int col = ( (ONamedListView*) listView() )->findColumn( column ); |
741 | if ( col != -1 ) | 741 | if ( col != -1 ) |
742 | OListViewItem::setText( col, text ); | 742 | OListViewItem::setText( col, text ); |
743 | else | 743 | else |
744 | qWarning( "ONamedListViewItem::setText(): Warning! Columntext '%s' not found.", (const char*) column ); | 744 | owarn << "ONamedListViewItem::setText(): Warning! Columntext '" << column << "' not found." << oendl; |
745 | } | 745 | } |
746 | 746 | ||
747 | 747 | ||
748 | ONamedListViewItem* ONamedListViewItem::find( int column, const QString& text, int recurse ) const | 748 | ONamedListViewItem* ONamedListViewItem::find( int column, const QString& text, int recurse ) const |
749 | { | 749 | { |
750 | return ( (ONamedListView*) listView() )->find( (ONamedListViewItem*) firstChild(), column, text, recurse ); | 750 | return ( (ONamedListView*) listView() )->find( (ONamedListViewItem*) firstChild(), column, text, recurse ); |
751 | } | 751 | } |
752 | 752 | ||
753 | 753 | ||
754 | ONamedListViewItem* ONamedListViewItem::find( const QString& column, const QString& text, int recurse ) const | 754 | ONamedListViewItem* ONamedListViewItem::find( const QString& column, const QString& text, int recurse ) const |
755 | { | 755 | { |
756 | int col = ( (ONamedListView*) listView() )->findColumn( column ); | 756 | int col = ( (ONamedListView*) listView() )->findColumn( column ); |
757 | if ( col != -1 ) | 757 | if ( col != -1 ) |
758 | return ( (ONamedListView*) listView() )->find( (ONamedListViewItem*) firstChild(), col, text, recurse ); | 758 | return ( (ONamedListView*) listView() )->find( (ONamedListViewItem*) firstChild(), col, text, recurse ); |
759 | else | 759 | else |
760 | return 0; | 760 | return 0; |
761 | } | 761 | } |
762 | 762 | ||
763 | } | 763 | } |
764 | } | 764 | } |
diff --git a/libopie2/opieui/opopupmenu.cpp b/libopie2/opieui/opopupmenu.cpp index 3ab8490..50c613f 100644 --- a/libopie2/opieui/opopupmenu.cpp +++ b/libopie2/opieui/opopupmenu.cpp | |||
@@ -1,52 +1,52 @@ | |||
1 | /* This file is part of the KDE libraries | 1 | /* This file is part of the KDE libraries |
2 | Copyright (C) 2000 Daniel M. Duley <mosfet@kde.org> | 2 | Copyright (C) 2000 Daniel M. Duley <mosfet@kde.org> |
3 | Copyright (C) 2002 Hamish Rodda <meddie@yoyo.its.monash.edu.au> | 3 | Copyright (C) 2002 Hamish Rodda <meddie@yoyo.its.monash.edu.au> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License version 2 as published by the Free Software Foundation. | 7 | License version 2 as published by the Free Software Foundation. |
8 | 8 | ||
9 | This library is distributed in the hope that it will be useful, | 9 | This library is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | Library General Public License for more details. | 12 | Library General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU Library General Public License | 14 | You should have received a copy of the GNU Library General Public License |
15 | along with this library; see the file COPYING.LIB. If not, write to | 15 | along with this library; see the file COPYING.LIB. If not, write to |
16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
17 | Boston, MA 02111-1307, USA. | 17 | Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | /* QT */ | 20 | /* OPIE */ |
21 | #include <opie2/opopupmenu.h> | ||
22 | #include <opie2/oconfig.h> | ||
23 | #include <opie2/odebug.h> | ||
21 | 24 | ||
25 | /* QT */ | ||
22 | #include <qdrawutil.h> | 26 | #include <qdrawutil.h> |
23 | #include <qtimer.h> | 27 | #include <qtimer.h> |
24 | 28 | ||
25 | /* OPIE */ | ||
26 | |||
27 | #include <opie2/opopupmenu.h> | ||
28 | #include <opie2/oconfig.h> | ||
29 | 29 | ||
30 | using namespace Opie::Core; | 30 | using namespace Opie::Core; |
31 | using namespace Opie::Ui; | 31 | using namespace Opie::Ui; |
32 | 32 | ||
33 | OPopupTitle::OPopupTitle(QWidget *parent, const char *name) | 33 | OPopupTitle::OPopupTitle(QWidget *parent, const char *name) |
34 | : QWidget(parent, name) | 34 | : QWidget(parent, name) |
35 | { | 35 | { |
36 | setMinimumSize(16, fontMetrics().height()+8); | 36 | setMinimumSize(16, fontMetrics().height()+8); |
37 | } | 37 | } |
38 | 38 | ||
39 | OPopupTitle::OPopupTitle(OPixmapEffect::GradientType /* gradient */, | 39 | OPopupTitle::OPopupTitle(OPixmapEffect::GradientType /* gradient */, |
40 | const QColor &/* color */, const QColor &/* textColor */, | 40 | const QColor &/* color */, const QColor &/* textColor */, |
41 | QWidget *parent, const char *name) | 41 | QWidget *parent, const char *name) |
42 | : QWidget(parent, name) | 42 | : QWidget(parent, name) |
43 | { | 43 | { |
44 | setMinimumSize(16, fontMetrics().height()+8); | 44 | setMinimumSize(16, fontMetrics().height()+8); |
45 | } | 45 | } |
46 | 46 | ||
47 | OPopupTitle::OPopupTitle(const OPixmap & /* background */, const QColor &/* color */, | 47 | OPopupTitle::OPopupTitle(const OPixmap & /* background */, const QColor &/* color */, |
48 | const QColor &/* textColor */, QWidget *parent, | 48 | const QColor &/* textColor */, QWidget *parent, |
49 | const char *name) | 49 | const char *name) |
50 | : QWidget(parent, name) | 50 | : QWidget(parent, name) |
51 | { | 51 | { |
52 | setMinimumSize(16, fontMetrics().height()+8); | 52 | setMinimumSize(16, fontMetrics().height()+8); |
@@ -111,178 +111,178 @@ void OPopupTitle::paintEvent(QPaintEvent *) | |||
111 | p.drawText(0, 0, width(), height(), | 111 | p.drawText(0, 0, width(), height(), |
112 | AlignCenter | SingleLine, titleStr); | 112 | AlignCenter | SingleLine, titleStr); |
113 | } | 113 | } |
114 | } | 114 | } |
115 | 115 | ||
116 | p.setPen(palette().active().highlight()); | 116 | p.setPen(palette().active().highlight()); |
117 | p.drawLine(0, 0, r.right(), 0); | 117 | p.drawLine(0, 0, r.right(), 0); |
118 | } | 118 | } |
119 | 119 | ||
120 | QSize OPopupTitle::sizeHint() const | 120 | QSize OPopupTitle::sizeHint() const |
121 | { | 121 | { |
122 | return(minimumSize()); | 122 | return(minimumSize()); |
123 | } | 123 | } |
124 | 124 | ||
125 | class OPopupMenu::OPopupMenuPrivate | 125 | class OPopupMenu::OPopupMenuPrivate |
126 | { | 126 | { |
127 | public: | 127 | public: |
128 | OPopupMenuPrivate () | 128 | OPopupMenuPrivate () |
129 | : noMatches(false) | 129 | : noMatches(false) |
130 | , shortcuts(false) | 130 | , shortcuts(false) |
131 | , autoExec(false) | 131 | , autoExec(false) |
132 | , lastHitIndex(-1) | 132 | , lastHitIndex(-1) |
133 | , m_ctxMenu(0) | 133 | , m_ctxMenu(0) |
134 | {} | 134 | {} |
135 | 135 | ||
136 | ~OPopupMenuPrivate () | 136 | ~OPopupMenuPrivate () |
137 | { | 137 | { |
138 | delete m_ctxMenu; | 138 | delete m_ctxMenu; |
139 | } | 139 | } |
140 | 140 | ||
141 | QString m_lastTitle; | 141 | QString m_lastTitle; |
142 | 142 | ||
143 | // variables for keyboard navigation | 143 | // variables for keyboard navigation |
144 | QTimer clearTimer; | 144 | QTimer clearTimer; |
145 | 145 | ||
146 | bool noMatches : 1; | 146 | bool noMatches : 1; |
147 | bool shortcuts : 1; | 147 | bool shortcuts : 1; |
148 | bool autoExec : 1; | 148 | bool autoExec : 1; |
149 | 149 | ||
150 | QString keySeq; | 150 | QString keySeq; |
151 | QString originalText; | 151 | QString originalText; |
152 | 152 | ||
153 | int lastHitIndex; | 153 | int lastHitIndex; |
154 | 154 | ||
155 | // support for RMB menus on menus | 155 | // support for RMB menus on menus |
156 | QPopupMenu* m_ctxMenu; | 156 | QPopupMenu* m_ctxMenu; |
157 | static bool s_continueCtxMenuShow; | 157 | static bool s_continueCtxMenuShow; |
158 | static int s_highlightedItem; | 158 | static int s_highlightedItem; |
159 | static OPopupMenu* s_contextedMenu; | 159 | static OPopupMenu* s_contextedMenu; |
160 | }; | 160 | }; |
161 | 161 | ||
162 | int OPopupMenu::OPopupMenuPrivate::s_highlightedItem(-1); | 162 | int OPopupMenu::OPopupMenuPrivate::s_highlightedItem(-1); |
163 | OPopupMenu* OPopupMenu::OPopupMenuPrivate::s_contextedMenu(0); | 163 | OPopupMenu* OPopupMenu::OPopupMenuPrivate::s_contextedMenu(0); |
164 | bool OPopupMenu::OPopupMenuPrivate::s_continueCtxMenuShow(true); | 164 | bool OPopupMenu::OPopupMenuPrivate::s_continueCtxMenuShow(true); |
165 | 165 | ||
166 | OPopupMenu::OPopupMenu(QWidget *parent, const char *name) | 166 | OPopupMenu::OPopupMenu(QWidget *parent, const char *name) |
167 | : QPopupMenu(parent, name) | 167 | : QPopupMenu(parent, name) |
168 | { | 168 | { |
169 | d = new OPopupMenuPrivate; | 169 | d = new OPopupMenuPrivate; |
170 | resetKeyboardVars(); | 170 | resetKeyboardVars(); |
171 | connect(&(d->clearTimer), SIGNAL(timeout()), SLOT(resetKeyboardVars())); | 171 | connect(&(d->clearTimer), SIGNAL(timeout()), SLOT(resetKeyboardVars())); |
172 | } | 172 | } |
173 | 173 | ||
174 | OPopupMenu::~OPopupMenu() | 174 | OPopupMenu::~OPopupMenu() |
175 | { | 175 | { |
176 | if (OPopupMenuPrivate::s_contextedMenu == this) | 176 | if (OPopupMenuPrivate::s_contextedMenu == this) |
177 | { | 177 | { |
178 | OPopupMenuPrivate::s_contextedMenu = 0; | 178 | OPopupMenuPrivate::s_contextedMenu = 0; |
179 | OPopupMenuPrivate::s_highlightedItem = -1; | 179 | OPopupMenuPrivate::s_highlightedItem = -1; |
180 | } | 180 | } |
181 | 181 | ||
182 | delete d; | 182 | delete d; |
183 | } | 183 | } |
184 | 184 | ||
185 | int OPopupMenu::insertTitle(const QString &text, int id, int index) | 185 | int OPopupMenu::insertTitle(const QString &text, int id, int index) |
186 | { | 186 | { |
187 | OPopupTitle *titleItem = new OPopupTitle(); | 187 | OPopupTitle *titleItem = new OPopupTitle(); |
188 | titleItem->setTitle(text); | 188 | titleItem->setTitle(text); |
189 | int ret = insertItem(titleItem, id, index); | 189 | int ret = insertItem(titleItem, id, index); |
190 | setItemEnabled(id, false); | 190 | setItemEnabled(id, false); |
191 | return ret; | 191 | return ret; |
192 | } | 192 | } |
193 | 193 | ||
194 | int OPopupMenu::insertTitle(const QPixmap &icon, const QString &text, int id, | 194 | int OPopupMenu::insertTitle(const QPixmap &icon, const QString &text, int id, |
195 | int index) | 195 | int index) |
196 | { | 196 | { |
197 | OPopupTitle *titleItem = new OPopupTitle(); | 197 | OPopupTitle *titleItem = new OPopupTitle(); |
198 | titleItem->setTitle(text, &icon); | 198 | titleItem->setTitle(text, &icon); |
199 | int ret = insertItem(titleItem, id, index); | 199 | int ret = insertItem(titleItem, id, index); |
200 | setItemEnabled(id, false); | 200 | setItemEnabled(id, false); |
201 | return ret; | 201 | return ret; |
202 | } | 202 | } |
203 | 203 | ||
204 | void OPopupMenu::changeTitle(int id, const QString &text) | 204 | void OPopupMenu::changeTitle(int id, const QString &text) |
205 | { | 205 | { |
206 | QMenuItem *item = findItem(id); | 206 | QMenuItem *item = findItem(id); |
207 | if(item){ | 207 | if(item){ |
208 | if(item->widget()) | 208 | if(item->widget()) |
209 | ((OPopupTitle *)item->widget())->setTitle(text); | 209 | ((OPopupTitle *)item->widget())->setTitle(text); |
210 | #ifndef NDEBUG | 210 | #ifndef NDEBUG |
211 | else | 211 | else |
212 | qWarning( "KPopupMenu: changeTitle() called with non-title id %d", id ); | 212 | owarn << "KPopupMenu: changeTitle() called with non-title id " << id << "" << oendl; |
213 | #endif | 213 | #endif |
214 | } | 214 | } |
215 | #ifndef NDEBUG | 215 | #ifndef NDEBUG |
216 | else | 216 | else |
217 | qWarning( "KPopupMenu: changeTitle() called with invalid id %d", id ); | 217 | owarn << "KPopupMenu: changeTitle() called with invalid id " << id << "" << oendl; |
218 | #endif | 218 | #endif |
219 | } | 219 | } |
220 | 220 | ||
221 | void OPopupMenu::changeTitle(int id, const QPixmap &icon, const QString &text) | 221 | void OPopupMenu::changeTitle(int id, const QPixmap &icon, const QString &text) |
222 | { | 222 | { |
223 | QMenuItem *item = findItem(id); | 223 | QMenuItem *item = findItem(id); |
224 | if(item){ | 224 | if(item){ |
225 | if(item->widget()) | 225 | if(item->widget()) |
226 | ((OPopupTitle *)item->widget())->setTitle(text, &icon); | 226 | ((OPopupTitle *)item->widget())->setTitle(text, &icon); |
227 | #ifndef NDEBUG | 227 | #ifndef NDEBUG |
228 | else | 228 | else |
229 | qWarning( "KPopupMenu: changeTitle() called with non-title id %d", id ); | 229 | owarn << "KPopupMenu: changeTitle() called with non-title id " << id << "" << oendl; |
230 | #endif | 230 | #endif |
231 | } | 231 | } |
232 | #ifndef NDEBUG | 232 | #ifndef NDEBUG |
233 | else | 233 | else |
234 | qWarning( "KPopupMenu: changeTitle() called with invalid id %d", id ); | 234 | owarn << "KPopupMenu: changeTitle() called with invalid id " << id << "" << oendl; |
235 | #endif | 235 | #endif |
236 | } | 236 | } |
237 | 237 | ||
238 | QString OPopupMenu::title(int id) const | 238 | QString OPopupMenu::title(int id) const |
239 | { | 239 | { |
240 | if(id == -1) // obsolete | 240 | if(id == -1) // obsolete |
241 | return(d->m_lastTitle); | 241 | return(d->m_lastTitle); |
242 | QMenuItem *item = findItem(id); | 242 | QMenuItem *item = findItem(id); |
243 | if(item){ | 243 | if(item){ |
244 | if(item->widget()) | 244 | if(item->widget()) |
245 | return(((OPopupTitle *)item->widget())->title()); | 245 | return(((OPopupTitle *)item->widget())->title()); |
246 | else | 246 | else |
247 | qWarning("OPopupMenu: title() called with non-title id %d.", id); | 247 | owarn << "OPopupMenu: title() called with non-title id " << id << "." << oendl; |
248 | } | 248 | } |
249 | else | 249 | else |
250 | qWarning("OPopupMenu: title() called with invalid id %d.", id); | 250 | owarn << "OPopupMenu: title() called with invalid id " << id << "." << oendl; |
251 | return(QString::null); | 251 | return(QString::null); |
252 | } | 252 | } |
253 | 253 | ||
254 | QPixmap OPopupMenu::titlePixmap(int id) const | 254 | QPixmap OPopupMenu::titlePixmap(int id) const |
255 | { | 255 | { |
256 | QMenuItem *item = findItem(id); | 256 | QMenuItem *item = findItem(id); |
257 | if(item){ | 257 | if(item){ |
258 | if(item->widget()) | 258 | if(item->widget()) |
259 | return(((OPopupTitle *)item->widget())->icon()); | 259 | return(((OPopupTitle *)item->widget())->icon()); |
260 | else | 260 | else |
261 | qWarning("KPopupMenu: titlePixmap() called with non-title id %d.", id); | 261 | owarn << "KPopupMenu: titlePixmap() called with non-title id " << id << "." << oendl; |
262 | } | 262 | } |
263 | else | 263 | else |
264 | qWarning("KPopupMenu: titlePixmap() called with invalid id %d.", id); | 264 | owarn << "KPopupMenu: titlePixmap() called with invalid id " << id << "." << oendl; |
265 | QPixmap tmp; | 265 | QPixmap tmp; |
266 | return(tmp); | 266 | return(tmp); |
267 | } | 267 | } |
268 | 268 | ||
269 | /** | 269 | /** |
270 | * This is re-implemented for keyboard navigation. | 270 | * This is re-implemented for keyboard navigation. |
271 | */ | 271 | */ |
272 | void OPopupMenu::closeEvent(QCloseEvent*e) | 272 | void OPopupMenu::closeEvent(QCloseEvent*e) |
273 | { | 273 | { |
274 | if (d->shortcuts) | 274 | if (d->shortcuts) |
275 | resetKeyboardVars(); | 275 | resetKeyboardVars(); |
276 | QPopupMenu::closeEvent(e); | 276 | QPopupMenu::closeEvent(e); |
277 | } | 277 | } |
278 | 278 | ||
279 | void OPopupMenu::keyPressEvent(QKeyEvent* e) | 279 | void OPopupMenu::keyPressEvent(QKeyEvent* e) |
280 | { | 280 | { |
281 | if (!d->shortcuts) { | 281 | if (!d->shortcuts) { |
282 | // continue event processing by Qpopup | 282 | // continue event processing by Qpopup |
283 | //e->ignore(); | 283 | //e->ignore(); |
284 | QPopupMenu::keyPressEvent(e); | 284 | QPopupMenu::keyPressEvent(e); |
285 | return; | 285 | return; |
286 | } | 286 | } |
287 | 287 | ||
288 | int i = 0; | 288 | int i = 0; |
diff --git a/libopie2/opieui/otaskbarapplet.h b/libopie2/opieui/otaskbarapplet.h index 77cc461..75c07d1 100644 --- a/libopie2/opieui/otaskbarapplet.h +++ b/libopie2/opieui/otaskbarapplet.h | |||
@@ -11,85 +11,89 @@ | |||
11 | .="- .-=="i, .._ License as published by the Free Software | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | - . .-<_> .<> Foundation; either version 2 of the License, | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ._= =} : or (at your option) any later version. | 13 | ._= =} : or (at your option) any later version. |
14 | .%`+i> _;_. | 14 | .%`+i> _;_. |
15 | .i_,=:_. -<s. This program is distributed in the hope that | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | : .. .:, . . . without even the implied warranty of | 17 | : .. .:, . . . without even the implied warranty of |
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | 20 | ..}^=.= = ; Library General Public License for more |
21 | ++= -. .` .: details. | 21 | ++= -. .` .: details. |
22 | : = ...= . :.=- | 22 | : = ...= . :.=- |
23 | -. .:....=;==+<; You should have received a copy of the GNU | 23 | -. .:....=;==+<; You should have received a copy of the GNU |
24 | -_. . . )=. = Library General Public License along with | 24 | -_. . . )=. = Library General Public License along with |
25 | -- :-=` this library; see the file COPYING.LIB. | 25 | -- :-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | 29 | ||
30 | */ | 30 | */ |
31 | 31 | ||
32 | #ifndef OTASKBARAPPLET_H | 32 | #ifndef OTASKBARAPPLET_H |
33 | #define OTASKBARAPPLET_H | 33 | #define OTASKBARAPPLET_H |
34 | 34 | ||
35 | /* OPIE */ | ||
36 | #include <opie2/odebug.h> | ||
37 | |||
35 | #include <qpe/taskbarappletinterface.h> | 38 | #include <qpe/taskbarappletinterface.h> |
36 | #include <qpe/qcom.h> | 39 | #include <qpe/qcom.h> |
37 | 40 | ||
41 | /* QT */ | ||
38 | #include <qwidget.h> | 42 | #include <qwidget.h> |
39 | 43 | ||
40 | class QMouseEvent; | 44 | class QMouseEvent; |
41 | 45 | ||
42 | namespace Opie { | 46 | namespace Opie { |
43 | namespace Ui { | 47 | namespace Ui { |
44 | namespace Internal { | 48 | namespace Internal { |
45 | /*====================================================================================== | 49 | /*====================================================================================== |
46 | * OTaskbarAppletWrapper | 50 | * OTaskbarAppletWrapper |
47 | *======================================================================================*/ | 51 | *======================================================================================*/ |
48 | 52 | ||
49 | class OTaskbarAppletWrapperPrivate; | 53 | class OTaskbarAppletWrapperPrivate; |
50 | template<class T> class OTaskbarAppletWrapper : public TaskbarAppletInterface | 54 | template<class T> class OTaskbarAppletWrapper : public TaskbarAppletInterface |
51 | { | 55 | { |
52 | public: | 56 | public: |
53 | OTaskbarAppletWrapper():_applet( 0 ) | 57 | OTaskbarAppletWrapper():_applet( 0 ) |
54 | { | 58 | { |
55 | } | 59 | } |
56 | 60 | ||
57 | virtual ~OTaskbarAppletWrapper() | 61 | virtual ~OTaskbarAppletWrapper() |
58 | { | 62 | { |
59 | delete _applet; | 63 | delete _applet; |
60 | } | 64 | } |
61 | 65 | ||
62 | QRESULT queryInterface( const QUuid& uuid, QUnknownInterface** iface ) | 66 | QRESULT queryInterface( const QUuid& uuid, QUnknownInterface** iface ) |
63 | { | 67 | { |
64 | qDebug( "OTaskbarAppletWrapper::queryInterface()" ); | 68 | odebug << "OTaskbarAppletWrapper::queryInterface()" << oendl; |
65 | *iface = 0; | 69 | *iface = 0; |
66 | if ( uuid == IID_QUnknown ) | 70 | if ( uuid == IID_QUnknown ) |
67 | *iface = this; | 71 | *iface = this; |
68 | else if ( uuid == IID_TaskbarApplet ) | 72 | else if ( uuid == IID_TaskbarApplet ) |
69 | *iface = this; | 73 | *iface = this; |
70 | else | 74 | else |
71 | return QS_FALSE; | 75 | return QS_FALSE; |
72 | 76 | ||
73 | if ( *iface ) (*iface)->addRef(); | 77 | if ( *iface ) (*iface)->addRef(); |
74 | return QS_OK; | 78 | return QS_OK; |
75 | } | 79 | } |
76 | 80 | ||
77 | Q_REFCOUNT | 81 | Q_REFCOUNT |
78 | 82 | ||
79 | virtual T* applet( QWidget* parent ) | 83 | virtual T* applet( QWidget* parent ) |
80 | { | 84 | { |
81 | if ( !_applet ) _applet = new T( parent ); | 85 | if ( !_applet ) _applet = new T( parent ); |
82 | return _applet; | 86 | return _applet; |
83 | } | 87 | } |
84 | 88 | ||
85 | virtual int position() const | 89 | virtual int position() const |
86 | { | 90 | { |
87 | return T::position(); | 91 | return T::position(); |
88 | } | 92 | } |
89 | 93 | ||
90 | private: | 94 | private: |
91 | T* _applet; | 95 | T* _applet; |
92 | OTaskbarAppletWrapperPrivate *d; | 96 | OTaskbarAppletWrapperPrivate *d; |
93 | }; | 97 | }; |
94 | 98 | ||
95 | } | 99 | } |