summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/fileselector/ofileselector.cpp81
-rw-r--r--libopie2/opieui/fileselector/ofileselector.h46
-rw-r--r--libopie2/opieui/otabwidget.cpp66
-rw-r--r--libopie2/opieui/otabwidget.h52
-rw-r--r--libopie2/opieui/owait.cpp50
-rw-r--r--libopie2/opieui/owait.h47
6 files changed, 163 insertions, 179 deletions
diff --git a/libopie2/opieui/fileselector/ofileselector.cpp b/libopie2/opieui/fileselector/ofileselector.cpp
index 8b53038..f3e7501 100644
--- a/libopie2/opieui/fileselector/ofileselector.cpp
+++ b/libopie2/opieui/fileselector/ofileselector.cpp
@@ -1,91 +1,92 @@
1
2/* 1/*
3               =. This file is part of the OPIE Project 2                 This file is part of the Opie Project
4             .=l. Copyright (C) 2002,2003 Holger Freyther <zecke@handhelds.org> 3
5           .>+-= 4 Copyright (C) 2002,2003 Holger Freyther <zecke@handhelds.org>
6 _;:,     .>    :=|. This library is free software; you can 5 =.
7.> <`_,   >  .   <= redistribute it and/or modify it under 6 .=l.
8:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 7           .>+-=
9.="- .-=="i,     .._ License as published by the Free Software 8 _;:,     .>    :=|. This program is free software; you can
10 - .   .-<_>     .<> Foundation; either version 2 of the License, 9.> <`_,   >  .   <= redistribute it and/or modify it under
11     ._= =}       : or (at your option) any later version. 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
12    .%`+i>       _;_. 11.="- .-=="i,     .._ License as published by the Free Software
13    .i_,=:_.      -<s. This library is distributed in the hope that 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     ._= =}       : or (at your option) any later version.
15    : ..    .:,     . . . without even the implied warranty of 14    .%`+i>       _;_.
16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    .i_,=:_.      -<s. This program is distributed in the hope that
17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
18..}^=.=       =       ; Library General Public License for more 17 : ..    .:,     . . . without even the implied warranty of
19++=   -.     .`     .: details. 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
20 :     =  ...= . :.=- 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
21 -.   .:....=;==+<; You should have received a copy of the GNU 20..}^=.=       =       ; Library General Public License for more
22  -_. . .   )=.  = Library General Public License along with 21++=   -.     .`     .: details.
23    --        :-=` this library; see the file COPYING.LIB. 22 :     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
24 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
25 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
27
28*/ 29*/
29 30
30/* hacky but we need to get FileSelector::filter */ 31/* hacky but we need to get FileSelector::filter */
31#define private public 32#define private public
32#include <qpe/fileselector.h> 33#include <qpe/fileselector.h>
33#undef private 34#undef private
34 35
35#include "ofileselector_p.h" 36#include "ofileselector_p.h"
36 37
37/* OPIE */ 38/* OPIE */
38#include <opie2/ofileselector.h>
39#include <opie2/odebug.h> 39#include <opie2/odebug.h>
40#include <opie2/ofileselector.h>
41#include <opie2/oresource.h>
40 42
41#include <qpe/qpeapplication.h> 43#include <qpe/qpeapplication.h>
42#include <qpe/mimetype.h> 44#include <qpe/mimetype.h>
43#include <qpe/resource.h>
44#include <qpe/storage.h> 45#include <qpe/storage.h>
45 46
46/* QT */ 47/* QT */
47#include <qcombobox.h> 48#include <qcombobox.h>
48#include <qdir.h> 49#include <qdir.h>
49#include <qhbox.h> 50#include <qhbox.h>
50#include <qheader.h> 51#include <qheader.h>
51#include <qlabel.h> 52#include <qlabel.h>
52#include <qlayout.h> 53#include <qlayout.h>
53#include <qlineedit.h> 54#include <qlineedit.h>
54#include <qlistview.h> 55#include <qlistview.h>
55#include <qpopupmenu.h> 56#include <qpopupmenu.h>
56#include <qwidgetstack.h> 57#include <qwidgetstack.h>
57#include <qregexp.h> 58#include <qregexp.h>
58#include <qobjectlist.h> 59#include <qobjectlist.h>
59 60
60using namespace Opie::Ui::Internal; 61using namespace Opie::Ui::Internal;
61 62
62namespace Opie { 63namespace Opie {
63namespace Ui { 64namespace Ui {
64namespace Internal { 65namespace Internal {
65/* 66/*
66 * Create a path by adding a '/'/QDir::seperator in between 67 * Create a path by adding a '/'/QDir::seperator in between
67 * base and ending, but only if base is not empty 68 * base and ending, but only if base is not empty
68 */ 69 */
69static inline QString createNewPath(const QString& base, const QString &ending) { 70static inline QString createNewPath(const QString& base, const QString &ending) {
70 return base == QString::fromLatin1("/") ? 71 return base == QString::fromLatin1("/") ?
71 base + ending : base + "/" + ending; 72 base + ending : base + "/" + ending;
72} 73}
73 74
74 75
75OFileViewInterface::OFileViewInterface( OFileSelector* _selector ) 76OFileViewInterface::OFileViewInterface( OFileSelector* _selector )
76 : m_selector( _selector ) 77 : m_selector( _selector )
77{ 78{
78 selector()->registerView( this ); 79 selector()->registerView( this );
79} 80}
80 81
81OFileViewInterface::~OFileViewInterface() 82OFileViewInterface::~OFileViewInterface()
82{} 83{}
83 84
84QString OFileViewInterface::name()const 85QString OFileViewInterface::name()const
85{ 86{
86 return m_name; 87 return m_name;
87} 88}
88 89
89void OFileViewInterface::setName( const QString& name ) 90void OFileViewInterface::setName( const QString& name )
90{ 91{
91 m_name = name; 92 m_name = name;
@@ -289,137 +290,130 @@ QString OFileSelectorItem::key( int id, bool )const
289{ 290{
290 QString ke; 291 QString ke;
291 292
292 /* 293 /*
293 * id = 0 ||id == 1 : Sort By Name but Directories at Top 294 * id = 0 ||id == 1 : Sort By Name but Directories at Top
294 * id = 2 : Sort By Size: Prepend '0' to the key 295 * id = 2 : Sort By Size: Prepend '0' to the key
295 */ 296 */
296 if( id == 0 || id == 1 ) 297 if( id == 0 || id == 1 )
297 { // name 298 { // name
298 if( m_isDir ) 299 if( m_isDir )
299 { 300 {
300 ke.append("0" ); 301 ke.append("0" );
301 ke.append( text(1) ); 302 ke.append( text(1) );
302 } 303 }
303 else 304 else
304 { 305 {
305 ke.append("1" ); 306 ke.append("1" );
306 ke.append( text(1) ); 307 ke.append( text(1) );
307 } 308 }
308 return ke; 309 return ke;
309 }else if(id == 2) { 310 }else if(id == 2) {
310 return text(2).rightJustify(20, '0'); 311 return text(2).rightJustify(20, '0');
311 }else 312 }else
312 return text( id ); 313 return text( id );
313 314
314} 315}
315 316
316OFileViewFileListView::OFileViewFileListView( QWidget* parent, const QString& startDir, OFileSelector* sel) 317OFileViewFileListView::OFileViewFileListView( QWidget* parent, const QString& startDir, OFileSelector* sel)
317 :QWidget( parent ), m_sel( sel ) 318 :QWidget( parent ), m_sel( sel )
318{ 319{
319 m_all = false; 320 m_all = false;
320 QVBoxLayout* lay = new QVBoxLayout( this ); 321 QVBoxLayout* lay = new QVBoxLayout( this );
321 m_currentDir = startDir; 322 m_currentDir = startDir;
322 323
323 /* 324 /*
324 * now we add a special bar 325 * now we add a special bar
325 * One Button For Up 326 * One Button For Up
326 * Home 327 * Home
327 * Doc 328 * Doc
328 * And a dropdown menu with FileSystems 329 * And a dropdown menu with FileSystems
329 * FUTURE: one to change dir with lineedit 330 * FUTURE: one to change dir with lineedit
330 * Bookmarks 331 * Bookmarks
331 * Create Dir 332 * Create Dir
332 */ 333 */
333 QHBox* box = new QHBox(this ); 334 QHBox* box = new QHBox(this );
334 box->setBackgroundMode( PaletteButton ); 335 box->setBackgroundMode( PaletteButton );
335 box->setSpacing( 0 ); 336 box->setSpacing( 0 );
336 337
337 QPixmap pic;
338 QToolButton *btn = new QToolButton( box ); 338 QToolButton *btn = new QToolButton( box );
339 btn->setUsesBigPixmap( true ); 339 btn->setUsesBigPixmap( true );
340 pic.convertFromImage( Resource::loadImage( "up" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); 340 btn->setPixmap( Opie::Core::OResource::loadPixmap( "up", Opie::Core::OResource::SmallIcon ) );
341 btn->setPixmap( pic );
342 connect(btn, SIGNAL(clicked() ), 341 connect(btn, SIGNAL(clicked() ),
343 this, SLOT( cdUP() ) ); 342 this, SLOT( cdUP() ) );
344 343
345 btn = new QToolButton( box ); 344 btn = new QToolButton( box );
346 btn->setUsesBigPixmap( true ); 345 btn->setUsesBigPixmap( true );
347 pic.convertFromImage( Resource::loadImage( "home" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); 346 btn->setPixmap( Opie::Core::OResource::loadPixmap( "home", Opie::Core::OResource::SmallIcon ) );
348 btn->setPixmap( pic );
349 connect(btn, SIGNAL(clicked() ), 347 connect(btn, SIGNAL(clicked() ),
350 this, SLOT( cdHome() ) ); 348 this, SLOT( cdHome() ) );
351 349
352 btn = new QToolButton( box ); 350 btn = new QToolButton( box );
353 btn->setUsesBigPixmap( true ); 351 btn->setUsesBigPixmap( true );
354 pic.convertFromImage( Resource::loadImage( "DocsIcon" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); 352 btn->setPixmap( Opie::Core::OResource::loadPixmap( "DocsIcon", Opie::Core::OResource::SmallIcon ) );
355 btn->setPixmap( pic );
356 connect(btn, SIGNAL(clicked() ), 353 connect(btn, SIGNAL(clicked() ),
357 this, SLOT(cdDoc() ) ); 354 this, SLOT(cdDoc() ) );
358 355
359 m_btnNew = new QToolButton( box ); 356 m_btnNew = new QToolButton( box );
360 m_btnNew->setUsesBigPixmap( true ); 357 m_btnNew->setUsesBigPixmap( true );
361 pic.convertFromImage( Resource::loadImage( "new" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); 358 m_btnNew->setPixmap( Opie::Core::OResource::loadPixmap( "new", Opie::Core::OResource::SmallIcon ) );
362 m_btnNew->setPixmap( pic );
363 connect(m_btnNew, SIGNAL(clicked() ), 359 connect(m_btnNew, SIGNAL(clicked() ),
364 this, SLOT(slotNew() ) ); 360 this, SLOT(slotNew() ) );
365 361
366 362
367 m_btnClose = new QToolButton( box ); 363 m_btnClose = new QToolButton( box );
368 m_btnClose->setUsesBigPixmap( true ); 364 m_btnClose->setUsesBigPixmap( true );
369 pic.convertFromImage( Resource::loadImage( "close" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); 365 m_btnClose->setPixmap( Opie::Core::OResource::loadPixmap( "close", Opie::Core::OResource::SmallIcon ) );
370 m_btnClose->setPixmap( pic );
371 connect(m_btnClose, SIGNAL(clicked() ), 366 connect(m_btnClose, SIGNAL(clicked() ),
372 selector(), SIGNAL(closeMe() ) ); 367 selector(), SIGNAL(closeMe() ) );
373 368
374 btn = new QToolButton( box ); 369 btn = new QToolButton( box );
375 btn->setUsesBigPixmap( true ); 370 btn->setUsesBigPixmap( true );
376 pic.convertFromImage( Resource::loadImage( "cardmon/pcmcia" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); 371 btn->setPixmap( Opie::Core::OResource::loadPixmap( "cardmon/pcmcia", Opie::Core::OResource::SmallIcon ) );
377 btn->setPixmap( pic );
378 372
379 m_fsButton = btn; 373 m_fsButton = btn;
380 /* let's fill device parts */ 374 /* let's fill device parts */
381 QPopupMenu* pop = new QPopupMenu(this); 375 QPopupMenu* pop = new QPopupMenu(this);
382 connect(pop, SIGNAL( activated(int) ), 376 connect(pop, SIGNAL( activated(int) ),
383 this, SLOT(slotFSActivated(int) ) ); 377 this, SLOT(slotFSActivated(int) ) );
384 378
385 StorageInfo storage; 379 StorageInfo storage;
386 const QList<FileSystem> &fs = storage.fileSystems(); 380 const QList<FileSystem> &fs = storage.fileSystems();
387 QListIterator<FileSystem> it(fs); 381 QListIterator<FileSystem> it(fs);
388 for ( ; it.current(); ++it ) 382 for ( ; it.current(); ++it )
389 { 383 {
390 const QString disk = (*it)->name(); 384 const QString disk = (*it)->name();
391 const QString path = (*it)->path(); 385 const QString path = (*it)->path();
392 m_dev.insert( disk, path ); 386 m_dev.insert( disk, path );
393 pop->insertItem( disk ); 387 pop->insertItem( disk );
394 } 388 }
395 m_fsPop = pop; 389 m_fsPop = pop;
396 390
397 connect(btn,SIGNAL(pressed()),this,SLOT(slotFSpressed())); 391 connect(btn,SIGNAL(pressed()),this,SLOT(slotFSpressed()));
398 392
399 lay->addWidget( box ); 393 lay->addWidget( box );
400 394
401 m_view = new QListView( this ); 395 m_view = new QListView( this );
402 396
403 m_view->installEventFilter(this); 397 m_view->installEventFilter(this);
404 398
405 QPEApplication::setStylusOperation( m_view->viewport(), 399 QPEApplication::setStylusOperation( m_view->viewport(),
406 QPEApplication::RightOnHold); 400 QPEApplication::RightOnHold);
407 m_view->addColumn(" " ); 401 m_view->addColumn(" " );
408 m_view->addColumn(tr("Name"), 135 ); 402 m_view->addColumn(tr("Name"), 135 );
409 m_view->addColumn(tr("Size"), -1 ); 403 m_view->addColumn(tr("Size"), -1 );
410 m_view->addColumn(tr("Date"), 60 ); 404 m_view->addColumn(tr("Date"), 60 );
411 m_view->addColumn(tr("Mime Type"), -1 ); 405 m_view->addColumn(tr("Mime Type"), -1 );
412 406
413 407
414 m_view->setSorting( 1 ); 408 m_view->setSorting( 1 );
415 m_view->setAllColumnsShowFocus( TRUE ); 409 m_view->setAllColumnsShowFocus( TRUE );
416 410
417 lay->addWidget( m_view, 1000 ); 411 lay->addWidget( m_view, 1000 );
418 connectSlots(); 412 connectSlots();
419} 413}
420 414
421void OFileViewFileListView::slotFSpressed() 415void OFileViewFileListView::slotFSpressed()
422{ 416{
423 m_fsPop->exec(QPoint( QCursor::pos().x(), QCursor::pos().y())); 417 m_fsPop->exec(QPoint( QCursor::pos().x(), QCursor::pos().y()));
424 m_fsButton->setDown(false); 418 m_fsButton->setDown(false);
425} 419}
@@ -594,133 +588,134 @@ void OFileViewFileListView::slotCurrentChanged( QListViewItem* item)
594 QStringList str = QStringList::split("->", sel->text(1) ); 588 QStringList str = QStringList::split("->", sel->text(1) );
595 QString path = createNewPath(sel->directory(),str[0].stripWhiteSpace()); 589 QString path = createNewPath(sel->directory(),str[0].stripWhiteSpace());
596 emit selector()->fileSelected( path ); 590 emit selector()->fileSelected( path );
597 DocLnk lnk( path ); 591 DocLnk lnk( path );
598 emit selector()->fileSelected( lnk ); 592 emit selector()->fileSelected( lnk );
599 } 593 }
600 } 594 }
601#endif 595#endif
602} 596}
603 597
604void OFileViewFileListView::slotClicked(int button , QListViewItem* item, const QPoint&, int ) 598void OFileViewFileListView::slotClicked(int button , QListViewItem* item, const QPoint&, int )
605{ 599{
606 if (!item || ( button != Qt::LeftButton) ) 600 if (!item || ( button != Qt::LeftButton) )
607 return; 601 return;
608 602
609 OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); 603 OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item);
610 if (!sel->isLocked() ) 604 if (!sel->isLocked() )
611 { 605 {
612 QStringList str = QStringList::split("->", sel->text(1) ); 606 QStringList str = QStringList::split("->", sel->text(1) );
613 if (sel->isDir() ) 607 if (sel->isDir() )
614 { 608 {
615 m_currentDir = createNewPath(sel->directory(),str[0].stripWhiteSpace()); 609 m_currentDir = createNewPath(sel->directory(),str[0].stripWhiteSpace());
616 emit selector()->dirSelected( m_currentDir ); 610 emit selector()->dirSelected( m_currentDir );
617 reread( m_all ); 611 reread( m_all );
618 } 612 }
619 else 613 else
620 { // file 614 { // file
621 odebug << "slot Clicked" << oendl; 615 odebug << "slot Clicked" << oendl;
622 selector()->m_lneEdit->setText( str[0].stripWhiteSpace() ); 616 selector()->m_lneEdit->setText( str[0].stripWhiteSpace() );
623 QString path = createNewPath(sel->directory(),str[0].stripWhiteSpace()); 617 QString path = createNewPath(sel->directory(),str[0].stripWhiteSpace());
624 emit selector()->fileSelected( path ); 618 emit selector()->fileSelected( path );
625 DocLnk lnk( path ); 619 DocLnk lnk( path );
626 emit selector()->fileSelected( lnk ); 620 emit selector()->fileSelected( lnk );
627 } 621 }
628 } // not locked 622 } // not locked
629} 623}
630 624
631void OFileViewFileListView::addFile( QFileInfo* info, bool symlink ) 625void OFileViewFileListView::addFile( QFileInfo* info, bool symlink )
632{ 626{
633 MimeType type( info->absFilePath() ); 627 MimeType type( info->absFilePath() );
634 if (!compliesMime( type.id() ) ) 628 if (!compliesMime( type.id() ) )
635 return; 629 return;
636 630
637 QPixmap pix = type.pixmap(); 631 QPixmap pix = type.pixmap();
638 QString dir, name; bool locked; 632 QString dir, name; bool locked;
639 if ( pix.isNull() ) 633 if ( pix.isNull() )
640 { 634 {
641 QWMatrix matrix; 635 QWMatrix matrix;
642 QPixmap pixer(Resource::loadPixmap("UnknownDocument") ); 636 QPixmap pixer( Opie::Core::OResource::loadPixmap( "UnknownDocument" ) );
643 matrix.scale( .4, .4 ); 637 matrix.scale( .4, .4 );
644 pix = pixer.xForm( matrix ); 638 pix = pixer.xForm( matrix );
645 } 639 }
646 dir = info->dirPath( true ); 640 dir = info->dirPath( true );
647 locked = false; 641 locked = false;
648 if ( symlink ) 642 if ( symlink )
649 name = info->fileName() + " -> " + createNewPath(info->dirPath(),info->readLink()); 643 name = info->fileName() + " -> " + createNewPath(info->dirPath(),info->readLink());
650 else 644 else
651 { 645 {
652 name = info->fileName(); 646 name = info->fileName();
653 if ( ( (selector()->mode() == OFileSelector::Open)&& !info->isReadable() ) || 647 if ( ( (selector()->mode() == OFileSelector::Open)&& !info->isReadable() ) ||
654 ( (selector()->mode() == OFileSelector::Save)&& !info->isWritable() ) ) 648 ( (selector()->mode() == OFileSelector::Save)&& !info->isWritable() ) )
655 { 649 {
656 locked = true; pix = Resource::loadPixmap("locked"); 650 locked = true;
651 pix = Opie::Core::OResource::loadPixmap( "locked" );
657 } 652 }
658 } 653 }
659 (void)new OFileSelectorItem( m_view, pix, name, 654 (void)new OFileSelectorItem( m_view, pix, name,
660 info->lastModified().toString(), QString::number( info->size() ), 655 info->lastModified().toString(), QString::number( info->size() ),
661 dir, locked ); 656 dir, locked );
662} 657}
663 658
664void OFileViewFileListView::addDir( QFileInfo* info, bool symlink ) 659void OFileViewFileListView::addDir( QFileInfo* info, bool symlink )
665{ 660{
666 bool locked = false; QString name; QPixmap pix; 661 bool locked = false; QString name; QPixmap pix;
667 662
668 if ( ( ( selector()->mode() == OFileSelector::Open ) && !info->isReadable() ) || 663 if ( ( ( selector()->mode() == OFileSelector::Open ) && !info->isReadable() ) ||
669 ( ( selector()->mode() == OFileSelector::Save ) && !info->isWritable() ) ) 664 ( ( selector()->mode() == OFileSelector::Save ) && !info->isWritable() ) )
670 { 665 {
671 locked = true; 666 locked = true;
672 if ( symlink ) 667 if ( symlink )
673 pix = Resource::loadPixmap( "opie/symlink" ); 668 pix = Opie::Core::OResource::loadPixmap( "opie/symlink" );
674 else 669 else
675 pix = Resource::loadPixmap( "lockedfolder" ); 670 pix = Opie::Core::OResource::loadPixmap( "lockedfolder" );
676 } 671 }
677 else 672 else
678 pix = symlink ? Resource::loadPixmap( "opie/symlink") : Resource::loadPixmap("folder"); 673 pix = symlink ? Opie::Core::OResource::loadPixmap( "opie/symlink" ) : Opie::Core::OResource::loadPixmap( "folder" );
679 674
680 name = symlink ? info->fileName() + " -> " + createNewPath(info->dirPath(true),info->readLink()) : 675 name = symlink ? info->fileName() + " -> " + createNewPath(info->dirPath(true),info->readLink()) :
681 info->fileName(); 676 info->fileName();
682 677
683 (void)new OFileSelectorItem( m_view, pix, name, 678 (void)new OFileSelectorItem( m_view, pix, name,
684 info->lastModified().toString(), 679 info->lastModified().toString(),
685 QString::number( info->size() ), 680 QString::number( info->size() ),
686 info->dirPath( true ), locked, true ); 681 info->dirPath( true ), locked, true );
687 682
688 683
689} 684}
690 685
691void OFileViewFileListView::addSymlink( QFileInfo* , bool ) 686void OFileViewFileListView::addSymlink( QFileInfo* , bool )
692{ 687{
693} 688}
694 689
695void OFileViewFileListView::cdUP() 690void OFileViewFileListView::cdUP()
696{ 691{
697 QDir dir( m_currentDir ); 692 QDir dir( m_currentDir );
698 dir.cdUp(); 693 dir.cdUp();
699 694
700 if (!dir.exists() ) 695 if (!dir.exists() )
701 m_currentDir = "/"; 696 m_currentDir = "/";
702 else 697 else
703 m_currentDir = dir.absPath(); 698 m_currentDir = dir.absPath();
704 699
705 emit selector()->dirSelected( m_currentDir ); 700 emit selector()->dirSelected( m_currentDir );
706 reread( m_all ); 701 reread( m_all );
707} 702}
708 703
709void OFileViewFileListView::cdHome() 704void OFileViewFileListView::cdHome()
710{ 705{
711 m_currentDir = QDir::homeDirPath(); 706 m_currentDir = QDir::homeDirPath();
712 emit selector()->dirSelected( m_currentDir ); 707 emit selector()->dirSelected( m_currentDir );
713 reread( m_all ); 708 reread( m_all );
714} 709}
715 710
716void OFileViewFileListView::cdDoc() 711void OFileViewFileListView::cdDoc()
717{ 712{
718 m_currentDir = QPEApplication::documentDir(); 713 m_currentDir = QPEApplication::documentDir();
719 emit selector()->dirSelected( m_currentDir ); 714 emit selector()->dirSelected( m_currentDir );
720 reread( m_all ); 715 reread( m_all );
721} 716}
722 717
723void OFileViewFileListView::changeDir( const QString& dir ) 718void OFileViewFileListView::changeDir( const QString& dir )
724{ 719{
725 m_currentDir = dir; 720 m_currentDir = dir;
726 emit selector()->dirSelected( m_currentDir ); 721 emit selector()->dirSelected( m_currentDir );
diff --git a/libopie2/opieui/fileselector/ofileselector.h b/libopie2/opieui/fileselector/ofileselector.h
index d166afd..f32e3ed 100644
--- a/libopie2/opieui/fileselector/ofileselector.h
+++ b/libopie2/opieui/fileselector/ofileselector.h
@@ -1,74 +1,76 @@
1/* 1/*
2               =. This file is part of the OPIE Project 2                 This file is part of the Opie Project
3             .=l. Copyright (C) 2002,2003 Holger Freyther <zecke@handhelds.org> 3
4           .>+-= 4 Copyright (C) 2002,2003 Holger Freyther <zecke@handhelds.org>
5 _;:,     .>    :=|. This library is free software; you can 5 =.
6.> <`_,   >  .   <= redistribute it and/or modify it under 6 .=l.
7:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 7           .>+-=
8.="- .-=="i,     .._ License as published by the Free Software 8 _;:,     .>    :=|. This program is free software; you can
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9.> <`_,   >  .   <= redistribute it and/or modify it under
10     ._= =}       : or (at your option) any later version. 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11    .%`+i>       _;_. 11.="- .-=="i,     .._ License as published by the Free Software
12    .i_,=:_.      -<s. This library is distributed in the hope that 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     ._= =}       : or (at your option) any later version.
14    : ..    .:,     . . . without even the implied warranty of 14    .%`+i>       _;_.
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    .i_,=:_.      -<s. This program is distributed in the hope that
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17..}^=.=       =       ; Library General Public License for more 17 : ..    .:,     . . . without even the implied warranty of
18++=   -.     .`     .: details. 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19 :     =  ...= . :.=- 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20 -.   .:....=;==+<; You should have received a copy of the GNU 20..}^=.=       =       ; Library General Public License for more
21  -_. . .   )=.  = Library General Public License along with 21++=   -.     .`     .: details.
22    --        :-=` this library; see the file COPYING.LIB. 22 :     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
26
27*/ 29*/
28 30
29/* 31/*
30 This is based on code and ideas of 32 This is based on code and ideas of
31 L. J. Potter ljp@llornkcor.com 33 L. J. Potter ljp@llornkcor.com
32 Thanks a lot 34 Thanks a lot
33*/ 35*/
34 36
35#ifndef OFILESELECTOR_H 37#ifndef OFILESELECTOR_H
36#define OFILESELECTOR_H 38#define OFILESELECTOR_H
37 39
38/* OPIE */ 40/* OPIE */
39#include <qpe/applnk.h> 41#include <qpe/applnk.h>
40 42
41/* QT */ 43/* QT */
42#include <qlist.h> 44#include <qlist.h>
43#include <qwidget.h> 45#include <qwidget.h>
44#include <qmap.h> 46#include <qmap.h>
45#include <qvaluelist.h> 47#include <qvaluelist.h>
46#include <qstringlist.h> 48#include <qstringlist.h>
47#include <qlist.h> 49#include <qlist.h>
48 50
49class QLineEdit; 51class QLineEdit;
50class QComboBox; 52class QComboBox;
51class QWidgetStack; 53class QWidgetStack;
52class QHBox; 54class QHBox;
53 55
54typedef QMap<QString, QStringList> MimeTypes; 56typedef QMap<QString, QStringList> MimeTypes;
55 57
56namespace Opie { 58namespace Opie {
57namespace Ui { 59namespace Ui {
58 60
59namespace Internal { 61namespace Internal {
60class OFileViewInterface; 62class OFileViewInterface;
61class OFileViewFileListView; 63class OFileViewFileListView;
62} 64}
63 65
64 66
65/** 67/**
66 * @short a dropin replacement for the FileSelector 68 * @short a dropin replacement for the FileSelector
67 * 69 *
68 * This class is first used insert the OFileDialog. 70 * This class is first used insert the OFileDialog.
69 * It supports multiple view and mimetype filtering for now. 71 * It supports multiple view and mimetype filtering for now.
70 * 72 *
71 * @see OFileDialog 73 * @see OFileDialog
72 * @see FileSelector 74 * @see FileSelector
73 * @author zecke 75 * @author zecke
74 * @version 0.1 76 * @version 0.1
diff --git a/libopie2/opieui/otabwidget.cpp b/libopie2/opieui/otabwidget.cpp
index 8d7806c..7333f5e 100644
--- a/libopie2/opieui/otabwidget.cpp
+++ b/libopie2/opieui/otabwidget.cpp
@@ -1,231 +1,231 @@
1/* 1/*
2 This file is part of the Opie Project 2                 This file is part of the Opie Project
3 3
4 Copyright (c) 2002, 2005 Dan Williams <drw@handhelds.org> 4 Copyright (C) 2002, 2005 Dan Williams <drw@handhelds.org>
5 =. 5 =.
6 .=l. 6 .=l.
7 .>+-= 7           .>+-=
8_;:, .> :=|. This program is free software; you can 8 _;:,     .>    :=|. This program is free software; you can
9.> <`_, > . <= redistribute it and/or modify it under 9.> <`_,   >  .   <= redistribute it and/or modify it under
10:`=1 )Y*s>-.-- : the terms of the GNU Library General Public 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
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
30*/ 29*/
31 30
32#include <opie2/otabwidget.h> 31#include <opie2/otabwidget.h>
33 32
34/* OPIE */ 33/* OPIE */
34#include <opie2/oresource.h>
35#include <opie2/otabbar.h>
36
35#include <qpe/applnk.h> 37#include <qpe/applnk.h>
36#include <qpe/config.h> 38#include <qpe/config.h>
37#include <qpe/resource.h>
38#include <opie2/otabbar.h>
39 39
40/* QT */ 40/* QT */
41#include <qcombobox.h> 41#include <qcombobox.h>
42#include <qwidgetstack.h> 42#include <qwidgetstack.h>
43 43
44using namespace Opie::Ui; 44using namespace Opie::Ui;
45 45
46OTabWidget::OTabWidget( QWidget *parent, const char *name, TabStyle s, TabPosition p ) 46OTabWidget::OTabWidget( QWidget *parent, const char *name, TabStyle s, TabPosition p )
47 : QWidget( parent, name ) 47 : QWidget( parent, name )
48 , m_currTab( 0l ) 48 , m_currTab( 0l )
49 , m_tabBarStyle( Global ) 49 , m_tabBarStyle( Global )
50 , m_tabBarPosition( Top ) 50 , m_tabBarPosition( Top )
51 , m_usingTabs( true ) 51 , m_usingTabs( true )
52 , m_tabBar( 0l ) 52 , m_tabBar( 0l )
53 , m_tabList( 0l ) 53 , m_tabList( 0l )
54{ 54{
55 if ( s == Global ) 55 if ( s == Global )
56 { 56 {
57 // Read Opie global settings for style and position 57 // Read Opie global settings for style and position
58 Config config( "qpe" ); 58 Config config( "qpe" );
59 config.setGroup( "Appearance" ); 59 config.setGroup( "Appearance" );
60 60
61 // Style 61 // Style
62 s = ( TabStyle ) config.readNumEntry( "TabStyle", (int) IconTab ); 62 s = ( TabStyle ) config.readNumEntry( "TabStyle", (int) IconTab );
63 if ( s <= Global || s > IconList) 63 if ( s <= Global || s > IconList)
64 s = IconTab; 64 s = IconTab;
65 65
66 // Position 66 // Position
67 ( config.readEntry( "TabPosition", "Top" ) == "Bottom" ) ? p = Bottom 67 ( config.readEntry( "TabPosition", "Top" ) == "Bottom" ) ? p = Bottom
68 : p = Top; 68 : p = Top;
69 } 69 }
70 70
71 // Initialize widget stack for tab widgets 71 // Initialize widget stack for tab widgets
72 m_widgetStack = new QWidgetStack( this ); 72 m_widgetStack = new QWidgetStack( this );
73 m_widgetStack->setFrameStyle( QFrame::NoFrame ); 73 m_widgetStack->setFrameStyle( QFrame::NoFrame );
74 m_widgetStack->setLineWidth( style().defaultFrameWidth() ); 74 m_widgetStack->setLineWidth( style().defaultFrameWidth() );
75 75
76 // Set initial selector control style and position 76 // Set initial selector control style and position
77 setTabStyle( s ); 77 setTabStyle( s );
78 setTabPosition( p ); 78 setTabPosition( p );
79} 79}
80 80
81OTabWidget::~OTabWidget() 81OTabWidget::~OTabWidget()
82{ 82{
83 m_tabs.setAutoDelete( true ); 83 m_tabs.setAutoDelete( true );
84 m_tabs.clear(); 84 m_tabs.clear();
85} 85}
86 86
87void OTabWidget::addTab( QWidget *child, const QString &icon, const QString &label ) 87void OTabWidget::addTab( QWidget *child, const QString &icon, const QString &label )
88{ 88{
89 int tabid = -1; 89 int tabid = -1;
90 90
91 if ( m_usingTabs ) 91 if ( m_usingTabs )
92 { 92 {
93 // Create new tab in tab bar 93 // Create new tab in tab bar
94 QTab *tab = new QTab(); 94 QTab *tab = new QTab();
95 95
96 // Set label (and icon if necessary) 96 // Set label (and icon if necessary)
97 if ( m_tabBarStyle == IconTab ) 97 if ( m_tabBarStyle == IconTab )
98 { 98 {
99 tab->label = QString::null; 99 tab->label = QString::null;
100 tab->iconset = new QIconSet( loadSmooth( icon ) ); 100 tab->iconset = new QIconSet( Opie::Core::OResource::loadPixmap( icon, Opie::Core::OResource::SmallIcon ) );
101 } 101 }
102 else 102 else
103 tab->label = label; 103 tab->label = label;
104 104
105 tabid = m_tabBar->addTab( tab ); 105 tabid = m_tabBar->addTab( tab );
106 } 106 }
107 else 107 else
108 { 108 {
109 // Insert entry (with icon if necessary) into drop down list 109 // Insert entry (with icon if necessary) into drop down list
110 if ( m_tabBarStyle == IconList ) 110 if ( m_tabBarStyle == IconList )
111 m_tabList->insertItem( loadSmooth( icon ), label, -1 ); 111 m_tabList->insertItem( Opie::Core::OResource::loadPixmap( icon, Opie::Core::OResource::SmallIcon ), label, -1 );
112 else 112 else
113 m_tabList->insertItem( label ); 113 m_tabList->insertItem( label );
114 } 114 }
115 115
116 // Add widget to stack 116 // Add widget to stack
117 m_widgetStack->addWidget( child, tabid ); 117 m_widgetStack->addWidget( child, tabid );
118 m_widgetStack->raiseWidget( child ); 118 m_widgetStack->raiseWidget( child );
119 m_widgetStack->setFrameStyle( QFrame::StyledPanel | QFrame::Raised ); 119 m_widgetStack->setFrameStyle( QFrame::StyledPanel | QFrame::Raised );
120 120
121 // Keep track of tab information 121 // Keep track of tab information
122 OTabInfo *tabinfo = new OTabInfo( tabid, child, icon, label ); 122 OTabInfo *tabinfo = new OTabInfo( tabid, child, icon, label );
123 m_tabs.append( tabinfo ); 123 m_tabs.append( tabinfo );
124 124
125 // Make newly added tab the current one displayed 125 // Make newly added tab the current one displayed
126 selectTab( tabinfo ); 126 selectTab( tabinfo );
127} 127}
128 128
129void OTabWidget::removePage( QWidget *childwidget ) 129void OTabWidget::removePage( QWidget *childwidget )
130{ 130{
131 if ( childwidget ) 131 if ( childwidget )
132 { 132 {
133 // Find tab information for desired widget 133 // Find tab information for desired widget
134 OTabInfo *tab = m_tabs.first(); 134 OTabInfo *tab = m_tabs.first();
135 while ( tab && tab->control() != childwidget ) 135 while ( tab && tab->control() != childwidget )
136 tab = m_tabs.next(); 136 tab = m_tabs.next();
137 137
138 if ( tab && tab->control() == childwidget ) 138 if ( tab && tab->control() == childwidget )
139 { 139 {
140 if ( m_usingTabs ) 140 if ( m_usingTabs )
141 { 141 {
142 // Remove tab from tab bar 142 // Remove tab from tab bar
143 m_tabBar->setTabEnabled( tab->id(), false ); 143 m_tabBar->setTabEnabled( tab->id(), false );
144 m_tabBar->removeTab( m_tabBar->tab( tab->id() ) ); 144 m_tabBar->removeTab( m_tabBar->tab( tab->id() ) );
145 } 145 }
146 else 146 else
147 { 147 {
148 // Remove entry from drop down list 148 // Remove entry from drop down list
149 int i = 0; 149 int i = 0;
150 while ( i < m_tabList->count() && m_tabList->text( i ) != tab->label() ) 150 while ( i < m_tabList->count() && m_tabList->text( i ) != tab->label() )
151 i++; 151 i++;
152 if ( m_tabList->text( i ) == tab->label() ) 152 if ( m_tabList->text( i ) == tab->label() )
153 m_tabList->removeItem( i ); 153 m_tabList->removeItem( i );
154 } 154 }
155 155
156 // Remove widget from stack 156 // Remove widget from stack
157 m_widgetStack->removeWidget( childwidget ); 157 m_widgetStack->removeWidget( childwidget );
158 158
159 // Get rid of tab information 159 // Get rid of tab information
160 m_tabs.remove( tab ); 160 m_tabs.remove( tab );
161 delete tab; 161 delete tab;
162 162
163 // Reset current tab 163 // Reset current tab
164 m_currTab = m_tabs.current(); 164 m_currTab = m_tabs.current();
165 if ( !m_currTab ) 165 if ( !m_currTab )
166 m_widgetStack->setFrameStyle( QFrame::NoFrame ); 166 m_widgetStack->setFrameStyle( QFrame::NoFrame );
167 167
168 // Redraw widget 168 // Redraw widget
169 setUpLayout(); 169 setUpLayout();
170 } 170 }
171 } 171 }
172} 172}
173 173
174void OTabWidget::changeTab( QWidget *widget, const QString &iconset, const QString &label) 174void OTabWidget::changeTab( QWidget *widget, const QString &iconset, const QString &label)
175{ 175{
176 // Find tab information for desired widget 176 // Find tab information for desired widget
177 OTabInfo *currtab = m_tabs.first(); 177 OTabInfo *currtab = m_tabs.first();
178 while ( currtab && currtab->control() != widget ) 178 while ( currtab && currtab->control() != widget )
179 currtab = m_tabs.next(); 179 currtab = m_tabs.next();
180 180
181 if ( currtab && currtab->control() == widget ) 181 if ( currtab && currtab->control() == widget )
182 { 182 {
183 QPixmap icon( loadSmooth( iconset ) ); 183 QPixmap icon( Opie::Core::OResource::loadPixmap( iconset, Opie::Core::OResource::SmallIcon ) );
184 184
185 if ( m_usingTabs ) 185 if ( m_usingTabs )
186 { 186 {
187 // Update tab label and icon (if necessary) 187 // Update tab label and icon (if necessary)
188 QTab *tab = m_tabBar->tab( currtab->id() ); 188 QTab *tab = m_tabBar->tab( currtab->id() );
189 tab->setText( label ); 189 tab->setText( label );
190 if ( m_tabBarStyle == IconTab ) 190 if ( m_tabBarStyle == IconTab )
191 tab->setIconSet( icon ); 191 tab->setIconSet( icon );
192 } 192 }
193 else 193 else
194 { 194 {
195 // Update entry label and icon (if necessary) 195 // Update entry label and icon (if necessary)
196 int i = 0; 196 int i = 0;
197 while ( i < m_tabList->count() && m_tabList->text( i ) != currtab->label() ) 197 while ( i < m_tabList->count() && m_tabList->text( i ) != currtab->label() )
198 i++; 198 i++;
199 if ( i < m_tabList->count() && m_tabList->text( i ) == currtab->label() ) 199 if ( i < m_tabList->count() && m_tabList->text( i ) == currtab->label() )
200 { 200 {
201 if ( m_tabBarStyle == IconList ) 201 if ( m_tabBarStyle == IconList )
202 m_tabList->changeItem( icon, label, i ); 202 m_tabList->changeItem( icon, label, i );
203 else 203 else
204 m_tabList->changeItem( label, i ); 204 m_tabList->changeItem( label, i );
205 } 205 }
206 } 206 }
207 207
208 // Update tab information 208 // Update tab information
209 currtab->setLabel( label ); 209 currtab->setLabel( label );
210 currtab->setIcon( iconset ); 210 currtab->setIcon( iconset );
211 211
212 // Redraw widget 212 // Redraw widget
213 setUpLayout(); 213 setUpLayout();
214 } 214 }
215} 215}
216 216
217void OTabWidget::setCurrentTab( QWidget *childwidget ) 217void OTabWidget::setCurrentTab( QWidget *childwidget )
218{ 218{
219 OTabInfo *currtab = m_tabs.first(); 219 OTabInfo *currtab = m_tabs.first();
220 while ( currtab && currtab->control() != childwidget ) 220 while ( currtab && currtab->control() != childwidget )
221 { 221 {
222 currtab = m_tabs.next(); 222 currtab = m_tabs.next();
223 } 223 }
224 if ( currtab && currtab->control() == childwidget ) 224 if ( currtab && currtab->control() == childwidget )
225 { 225 {
226 selectTab( currtab ); 226 selectTab( currtab );
227 } 227 }
228} 228}
229 229
230void OTabWidget::setCurrentTab( const QString &tabname ) 230void OTabWidget::setCurrentTab( const QString &tabname )
231{ 231{
@@ -253,170 +253,164 @@ void OTabWidget::setCurrentTab(int tabindex)
253 } 253 }
254} 254}
255 255
256 256
257OTabWidget::TabStyle OTabWidget::tabStyle() const 257OTabWidget::TabStyle OTabWidget::tabStyle() const
258{ 258{
259 return m_tabBarStyle; 259 return m_tabBarStyle;
260} 260}
261 261
262void OTabWidget::setTabStyle( TabStyle s ) 262void OTabWidget::setTabStyle( TabStyle s )
263{ 263{
264 // Get out if new and current styles are the same 264 // Get out if new and current styles are the same
265 if ( s == m_tabBarStyle ) 265 if ( s == m_tabBarStyle )
266 return; 266 return;
267 267
268 // Delete current selector control 268 // Delete current selector control
269 if ( m_usingTabs ) 269 if ( m_usingTabs )
270 { 270 {
271 delete m_tabBar; 271 delete m_tabBar;
272 m_tabBar = 0l; 272 m_tabBar = 0l;
273 } 273 }
274 else 274 else
275 { 275 {
276 delete m_tabList; 276 delete m_tabList;
277 m_tabList = 0l; 277 m_tabList = 0l;
278 } 278 }
279 279
280 // Set new style information 280 // Set new style information
281 m_tabBarStyle = s; 281 m_tabBarStyle = s;
282 m_usingTabs = ( m_tabBarStyle == TextTab || m_tabBarStyle == IconTab ); 282 m_usingTabs = ( m_tabBarStyle == TextTab || m_tabBarStyle == IconTab );
283 283
284 // Create new selector control and populate with tab information 284 // Create new selector control and populate with tab information
285 if ( m_usingTabs ) 285 if ( m_usingTabs )
286 { 286 {
287 // Create new tab bar selector 287 // Create new tab bar selector
288 m_tabBar = new OTabBar( this ); 288 m_tabBar = new OTabBar( this );
289 connect( m_tabBar, SIGNAL(selected(int)), this, SLOT(slotTabBarSelected(int)) ); 289 connect( m_tabBar, SIGNAL(selected(int)), this, SLOT(slotTabBarSelected(int)) );
290 290
291 // Add all current tabs to tab bar 291 // Add all current tabs to tab bar
292 for ( OTabInfo *tabinfo = m_tabs.first(); tabinfo; tabinfo = m_tabs.next() ) 292 for ( OTabInfo *tabinfo = m_tabs.first(); tabinfo; tabinfo = m_tabs.next() )
293 { 293 {
294 // Create new tab in tab bar 294 // Create new tab in tab bar
295 QTab *tab = new QTab(); 295 QTab *tab = new QTab();
296 296
297 // Set label (and icon if necessary) 297 // Set label (and icon if necessary)
298 if ( m_tabBarStyle == IconTab ) 298 if ( m_tabBarStyle == IconTab )
299 { 299 {
300 tab->label = QString::null; 300 tab->label = QString::null;
301 tab->iconset = new QIconSet( loadSmooth( tabinfo->icon() ) ); 301 tab->iconset = new QIconSet( Opie::Core::OResource::loadPixmap( tabinfo->icon(), Opie::Core::OResource::SmallIcon ) );
302 } 302 }
303 else 303 else
304 tab->label = tabinfo->label(); 304 tab->label = tabinfo->label();
305 305
306 // Add tab and save its Id 306 // Add tab and save its Id
307 int tabid = m_tabBar->addTab( tab ); 307 int tabid = m_tabBar->addTab( tab );
308 tabinfo->setId( tabid ); 308 tabinfo->setId( tabid );
309 } 309 }
310 } 310 }
311 else 311 else
312 { 312 {
313 // Create new drop down list selector 313 // Create new drop down list selector
314 m_tabList = new QComboBox( false, this ); 314 m_tabList = new QComboBox( false, this );
315 connect( m_tabList, SIGNAL(activated(int)), this, SLOT(slotTabListSelected(int)) ); 315 connect( m_tabList, SIGNAL(activated(int)), this, SLOT(slotTabListSelected(int)) );
316 316
317 // Add all current tabs to drop down list 317 // Add all current tabs to drop down list
318 for ( OTabInfo *tabinfo = m_tabs.first(); tabinfo; tabinfo = m_tabs.next() ) 318 for ( OTabInfo *tabinfo = m_tabs.first(); tabinfo; tabinfo = m_tabs.next() )
319 { 319 {
320 if ( m_tabBarStyle == IconList ) 320 if ( m_tabBarStyle == IconList )
321 m_tabList->insertItem( loadSmooth( tabinfo->icon() ), tabinfo->label() ); 321 m_tabList->insertItem( Opie::Core::OResource::loadPixmap( tabinfo->icon(), Opie::Core::OResource::SmallIcon ),
322 tabinfo->label() );
322 else 323 else
323 m_tabList->insertItem( tabinfo->label() ); 324 m_tabList->insertItem( tabinfo->label() );
324 } 325 }
325 } 326 }
326 327
327 // Redraw widget 328 // Redraw widget
328 setUpLayout(); 329 setUpLayout();
329} 330}
330 331
331OTabWidget::TabPosition OTabWidget::tabPosition() const 332OTabWidget::TabPosition OTabWidget::tabPosition() const
332{ 333{
333 return m_tabBarPosition; 334 return m_tabBarPosition;
334} 335}
335 336
336void OTabWidget::setTabPosition( TabPosition p ) 337void OTabWidget::setTabPosition( TabPosition p )
337{ 338{
338 m_tabBarPosition = p; 339 m_tabBarPosition = p;
339 340
340 // If using the tab bar selector, set its shape 341 // If using the tab bar selector, set its shape
341 if ( m_usingTabs ) 342 if ( m_usingTabs )
342 { 343 {
343 ( m_tabBarPosition == Top ) ? m_tabBar->setShape( QTabBar::RoundedAbove ) 344 ( m_tabBarPosition == Top ) ? m_tabBar->setShape( QTabBar::RoundedAbove )
344 : m_tabBar->setShape( QTabBar::RoundedBelow ); 345 : m_tabBar->setShape( QTabBar::RoundedBelow );
345 } 346 }
346 347
347 // Redraw widget 348 // Redraw widget
348 setUpLayout(); 349 setUpLayout();
349} 350}
350 351
351void OTabWidget::slotTabBarSelected( int id ) 352void OTabWidget::slotTabBarSelected( int id )
352{ 353{
353 OTabInfo *newtab = m_tabs.first(); 354 OTabInfo *newtab = m_tabs.first();
354 while ( newtab && newtab->id() != id ) 355 while ( newtab && newtab->id() != id )
355 newtab = m_tabs.next(); 356 newtab = m_tabs.next();
356 357
357 if ( newtab && newtab->id() == id ) 358 if ( newtab && newtab->id() == id )
358 selectTab( newtab ); 359 selectTab( newtab );
359} 360}
360 361
361void OTabWidget::slotTabListSelected( int index ) 362void OTabWidget::slotTabListSelected( int index )
362{ 363{
363 OTabInfo *newtab = m_tabs.at( index ); 364 OTabInfo *newtab = m_tabs.at( index );
364 if ( newtab ) 365 if ( newtab )
365 selectTab( newtab ); 366 selectTab( newtab );
366} 367}
367 368
368QPixmap OTabWidget::loadSmooth( const QString &name )
369{
370 QPixmap p;
371 p.convertFromImage( Resource::loadImage( name ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
372 return p;
373}
374
375void OTabWidget::selectTab( OTabInfo *tab ) 369void OTabWidget::selectTab( OTabInfo *tab )
376{ 370{
377 if ( m_tabBarStyle == IconTab ) 371 if ( m_tabBarStyle == IconTab )
378 { 372 {
379 // Remove text label from currently selected tab 373 // Remove text label from currently selected tab
380 if ( m_currTab ) 374 if ( m_currTab )
381 { 375 {
382 m_tabBar->tab( m_currTab->id() )->setText( QString::null ); 376 m_tabBar->tab( m_currTab->id() )->setText( QString::null );
383 //setUpLayout(); 377 //setUpLayout();
384 } 378 }
385 379
386 // Set text label for newly selected tab 380 // Set text label for newly selected tab
387 m_tabBar->tab( tab->id() )->setText( tab->label() ); 381 m_tabBar->tab( tab->id() )->setText( tab->label() );
388 m_tabBar->setCurrentTab( tab->id() ); 382 m_tabBar->setCurrentTab( tab->id() );
389 383
390 setUpLayout(); 384 setUpLayout();
391 385
392 QSize t; 386 QSize t;
393 387
394 t = m_tabBar->sizeHint(); 388 t = m_tabBar->sizeHint();
395 if ( t.width() > width() ) 389 if ( t.width() > width() )
396 t.setWidth( width() ); 390 t.setWidth( width() );
397 int lw = m_widgetStack->lineWidth(); 391 int lw = m_widgetStack->lineWidth();
398 if ( m_tabBarPosition == Bottom ) 392 if ( m_tabBarPosition == Bottom )
399 m_tabBar->setGeometry( QMAX(0, lw-2), height() - t.height() - lw, t.width(), t.height() ); 393 m_tabBar->setGeometry( QMAX(0, lw-2), height() - t.height() - lw, t.width(), t.height() );
400 else 394 else
401 m_tabBar->setGeometry( QMAX(0, lw-2), 0, t.width(), t.height() ); 395 m_tabBar->setGeometry( QMAX(0, lw-2), 0, t.width(), t.height() );
402 } 396 }
403 else if ( m_tabBarStyle == TextTab ) 397 else if ( m_tabBarStyle == TextTab )
404 { 398 {
405 m_tabBar->setCurrentTab( tab->id() ); 399 m_tabBar->setCurrentTab( tab->id() );
406 } 400 }
407 401
408 m_widgetStack->raiseWidget( tab->control() ); 402 m_widgetStack->raiseWidget( tab->control() );
409 403
410 emit currentChanged( tab->control() ); 404 emit currentChanged( tab->control() );
411 405
412 m_currTab = tab; 406 m_currTab = tab;
413} 407}
414 408
415void OTabWidget::setUpLayout() 409void OTabWidget::setUpLayout()
416{ 410{
417 if ( m_usingTabs ) 411 if ( m_usingTabs )
418 { 412 {
419 m_tabBar->update(); 413 m_tabBar->update();
420 m_tabBar->layoutTabs(); 414 m_tabBar->layoutTabs();
421 } 415 }
422} 416}
diff --git a/libopie2/opieui/otabwidget.h b/libopie2/opieui/otabwidget.h
index e925592..3af8fac 100644
--- a/libopie2/opieui/otabwidget.h
+++ b/libopie2/opieui/otabwidget.h
@@ -1,76 +1,76 @@
1/* 1/*
2 This file is part of the Opie Project 2                 This file is part of the Opie Project
3 Copyright (C) 2002, 2005 Dan Williams <drw@handhelds.org> 3
4 Copyright (C) 2002, 2005 Dan Williams <drw@handhelds.org>
4 =. 5 =.
5 .=l. 6 .=l.
6 .>+-= 7           .>+-=
7_;:, .> :=|. This program is free software; you can 8 _;:,     .>    :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under 9.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software 11.="- .-=="i,     .._ License as published by the Free Software
11- . .-<_> .<> Foundation; either version 2 of the License, 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version. 13     ._= =}       : or (at your option) any later version.
13 .%`+i> _;_. 14    .%`+i>       _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that 15    .i_,=:_.      -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of 17 : ..    .:,     . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more 20..}^=.=       =       ; Library General Public License for more
20++= -. .` .: details. 21++=   -.     .`     .: details.
21: = ...= . :.=- 22 :     =  ...= . :.=-
22-. .:....=;==+<; You should have received a copy of the GNU 23 -.   .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with 24  -_. . .   )=.  = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB. 25    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
28
29*/ 29*/
30 30
31#ifndef OTABWIDGET_H 31#ifndef OTABWIDGET_H
32#define OTABWIDGET_H 32#define OTABWIDGET_H
33 33
34/* OPIE */ 34/* OPIE */
35#include <opie2/otabinfo.h> 35#include <opie2/otabinfo.h>
36 36
37/* QT */ 37/* QT */
38#include <qwidget.h> 38#include <qwidget.h>
39#include <qlist.h> 39#include <qlist.h>
40 40
41 41
42class QComboBox; 42class QComboBox;
43class QPixmap; 43class QPixmap;
44class QTabBar; 44class QTabBar;
45class QWidgetStack; 45class QWidgetStack;
46 46
47namespace Opie { 47namespace Opie {
48namespace Ui { 48namespace Ui {
49 49
50class OTabBar; 50class OTabBar;
51 51
52/** 52/**
53 * @class OTabWidget 53 * @class OTabWidget
54 * @brief The OTabWidget class provides a stack of widgets. 54 * @brief The OTabWidget class provides a stack of widgets.
55 * 55 *
56 * OTabWidget is a derivation of TrollTech's QTabWidget which provides 56 * OTabWidget is a derivation of TrollTech's QTabWidget which provides
57 * a stack of widgets. Widgets can be selected using either a tab bar or 57 * a stack of widgets. Widgets can be selected using either a tab bar or
58 * drop down list box. 58 * drop down list box.
59 * 59 *
60 * The normal way to use OTabWidget is to do the following in the 60 * The normal way to use OTabWidget is to do the following in the
61 * constructor: 61 * constructor:
62 * - Create a OTabWidget. 62 * - Create a OTabWidget.
63 * - Create a QWidget for each of the pages in the control, insert 63 * - Create a QWidget for each of the pages in the control, insert
64 * children into it, set up geometry management for it, and use addTab() 64 * children into it, set up geometry management for it, and use addTab()
65 * to add the widget. 65 * to add the widget.
66 */ 66 */
67class OTabWidget : public QWidget 67class OTabWidget : public QWidget
68{ 68{
69 Q_OBJECT 69 Q_OBJECT
70 70
71 public: 71 public:
72/** 72/**
73 * @enum TabStyle 73 * @enum TabStyle
74 * @brief Defines how the widget selection control is displayed. 74 * @brief Defines how the widget selection control is displayed.
75 * 75 *
76 * Valid values: 76 * Valid values:
@@ -186,102 +186,94 @@ class OTabWidget : public QWidget
186 void setCurrentTab( const QString & ); 186 void setCurrentTab( const QString & );
187 187
188/** 188/**
189 * @fn setCurrentTab( int ) 189 * @fn setCurrentTab( int )
190 * @brief Selects and brings to top the desired widget, by using id. 190 * @brief Selects and brings to top the desired widget, by using id.
191 * 191 *
192 * @param tab id for widget to select. 192 * @param tab id for widget to select.
193 */ 193 */
194 void setCurrentTab(int); 194 void setCurrentTab(int);
195 195
196/** 196/**
197 * @fn currentTab( ) 197 * @fn currentTab( )
198 * @brief returns current tab id. 198 * @brief returns current tab id.
199 */ 199 */
200 // ### make const 200 // ### make const
201 int currentTab()/* const */; 201 int currentTab()/* const */;
202/** 202/**
203 * @brief returns the current page of the active tab 203 * @brief returns the current page of the active tab
204 * 204 *
205 * @since 1.2 205 * @since 1.2
206 */ 206 */
207 QWidget* currentWidget()const; 207 QWidget* currentWidget()const;
208 208
209protected: 209protected:
210 210
211/** 211/**
212 * @fn resizeEvent( QResizeEvent * ) 212 * @fn resizeEvent( QResizeEvent * )
213 * @brief Reimplemented for internal purposes. 213 * @brief Reimplemented for internal purposes.
214 */ 214 */
215 void resizeEvent( QResizeEvent * ); 215 void resizeEvent( QResizeEvent * );
216 216
217private: 217private:
218 OTabInfoList m_tabs; // List of information for tabs 218 OTabInfoList m_tabs; // List of information for tabs
219 OTabInfo *m_currTab; // Current tab displayed 219 OTabInfo *m_currTab; // Current tab displayed
220 TabStyle m_tabBarStyle; // Current style of control 220 TabStyle m_tabBarStyle; // Current style of control
221 TabPosition m_tabBarPosition; // Position of selector control 221 TabPosition m_tabBarPosition; // Position of selector control
222 bool m_usingTabs; // Indicates whether style is either TextTab or IconTab 222 bool m_usingTabs; // Indicates whether style is either TextTab or IconTab
223 // (saves from having to always check for these 2 values) 223 // (saves from having to always check for these 2 values)
224 224
225 // UI components 225 // UI components
226 OTabBar *m_tabBar; 226 OTabBar *m_tabBar;
227 QComboBox *m_tabList; 227 QComboBox *m_tabList;
228 QWidgetStack *m_widgetStack; 228 QWidgetStack *m_widgetStack;
229 229
230 class Private; 230 class Private;
231 Private* d; 231 Private* d;
232 232
233/** 233/**
234 * @fn loadSmooth( const QString &name )
235 * @brief Loads icon for widget.
236 *
237 * @param name Name of icon image file.
238 */
239 QPixmap loadSmooth( const QString & );
240
241/**
242 * @fn selectTab( OTabInfo *tab ) 234 * @fn selectTab( OTabInfo *tab )
243 * @brief Internal function to select desired widget. 235 * @brief Internal function to select desired widget.
244 * 236 *
245 * @param tab Pointer to data for widget. 237 * @param tab Pointer to data for widget.
246 */ 238 */
247 void selectTab( OTabInfo * ); 239 void selectTab( OTabInfo * );
248 240
249/** 241/**
250 * @fn setUpLayout() 242 * @fn setUpLayout()
251 * @brief Internal function to adjust layout. 243 * @brief Internal function to adjust layout.
252 */ 244 */
253 void setUpLayout(); 245 void setUpLayout();
254 246
255 247
256 signals: 248 signals:
257/** 249/**
258 * @fn currentChanged( QWidget *widget ) 250 * @fn currentChanged( QWidget *widget )
259 * @brief This signal is emitted whenever the widget has changed. 251 * @brief This signal is emitted whenever the widget has changed.
260 * 252 *
261 * @param widget Pointer to new current widget. 253 * @param widget Pointer to new current widget.
262 */ 254 */
263 void currentChanged( QWidget * ); 255 void currentChanged( QWidget * );
264 256
265 private slots: 257 private slots:
266 258
267/** 259/**
268 * @fn slotTabBarSelected( int id ) 260 * @fn slotTabBarSelected( int id )
269 * @brief Slot which is called when a tab is selected. 261 * @brief Slot which is called when a tab is selected.
270 * 262 *
271 * @param id ID of widget selected. 263 * @param id ID of widget selected.
272 */ 264 */
273 void slotTabBarSelected( int ); 265 void slotTabBarSelected( int );
274 266
275/** 267/**
276 * @fn slotTabListSelected( int index ) 268 * @fn slotTabListSelected( int index )
277 * @brief Slot which is called when a drop down selection is made. 269 * @brief Slot which is called when a drop down selection is made.
278 * 270 *
279 * @param id Index of widget selected. 271 * @param id Index of widget selected.
280 */ 272 */
281 void slotTabListSelected( int ); 273 void slotTabListSelected( int );
282}; 274};
283 275
284} 276}
285} 277}
286 278
287#endif 279#endif
diff --git a/libopie2/opieui/owait.cpp b/libopie2/opieui/owait.cpp
index ec1f25a..5f89ad2 100644
--- a/libopie2/opieui/owait.cpp
+++ b/libopie2/opieui/owait.cpp
@@ -1,113 +1,115 @@
1/* 1/*
2                This file is part of the Opie Project 2                 This file is part of the Opie Project
3              Copyright (C) 2003 Maximilian Reiss <harlekin@handhelds.org> 3
4 Copyright (C) 2003 Maximilian Reiss <harlekin@handhelds.org>
4 =. 5 =.
5 .=l. 6 .=l.
6           .>+-= 7           .>+-=
7 _;:,     .>    :=|. This program is free software; you can 8 _;:,     .>    :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under 9.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software 11.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version. 13     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_. 14    .%`+i>       _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that 15    .i_,=:_.      -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of 17    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more 20..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details. 21++=   -.     .`     .: details.
21 :     =  ...= . :.=- 22 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 23 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 24  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 25    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
28
29*/ 29*/
30 30
31#include "owait.h" 31#include "owait.h"
32 32
33/* OPIE */ 33/* OPIE */
34#include <opie2/oresource.h>
35
36
34#include <qpe/qpeapplication.h> 37#include <qpe/qpeapplication.h>
35#include <qpe/resource.h>
36 38
37/* QT */ 39/* QT */
38#include <qlayout.h> 40#include <qlayout.h>
39#include <qpainter.h> 41#include <qpainter.h>
40 42
41using namespace Opie::Ui; 43using namespace Opie::Ui;
42 44
43static int frame = 0; 45static int frame = 0;
44 46
45/** 47/**
46 * This will construct a modal dialog. 48 * This will construct a modal dialog.
47 * 49 *
48 * The default timer length is 10. 50 * The default timer length is 10.
49 * 51 *
50 * @param parent The parent of the widget 52 * @param parent The parent of the widget
51 * @param msg The name of the object 53 * @param msg The name of the object
52 * @param dispIcon Display Icon? 54 * @param dispIcon Display Icon?
53 */ 55 */
54OWait::OWait( QWidget *parent, const char* msg, bool dispIcon ) 56OWait::OWait( QWidget *parent, const char* msg, bool dispIcon )
55 :QDialog( parent, msg, TRUE, WStyle_Customize ) 57 :QDialog( parent, msg, TRUE, WStyle_Customize )
56{ 58{
57 59
58 Q_UNUSED( dispIcon ) 60 Q_UNUSED( dispIcon )
59 61
60 QHBoxLayout * hbox = new QHBoxLayout( this ); 62 QHBoxLayout * hbox = new QHBoxLayout( this );
61 63
62 m_lb = new QLabel( this ); 64 m_lb = new QLabel( this );
63 m_lb->setBackgroundMode ( NoBackground ); 65 m_lb->setBackgroundMode ( NoBackground );
64 66
65 hbox->addWidget( m_lb ); 67 hbox->addWidget( m_lb );
66 hbox->activate(); 68 hbox->activate();
67 69
68 m_pix = Resource::loadPixmap( "BigBusy" ); 70 m_pix = Opie::Core::OResource::loadPixmap( "BigBusy" );
69 m_aniSize = m_pix.height(); 71 m_aniSize = m_pix.height();
70 resize( m_aniSize, m_aniSize ); 72 resize( m_aniSize, m_aniSize );
71 73
72 m_timerLength = 10; 74 m_timerLength = 10;
73 75
74 m_waitTimer = new QTimer( this ); 76 m_waitTimer = new QTimer( this );
75 connect( m_waitTimer, SIGNAL( timeout() ), this, SLOT( hide() ) ); 77 connect( m_waitTimer, SIGNAL( timeout() ), this, SLOT( hide() ) );
76} 78}
77 79
78void OWait::timerEvent( QTimerEvent * ) 80void OWait::timerEvent( QTimerEvent * )
79{ 81{
80 frame = ( ++frame ) % 4; 82 frame = ( ++frame ) % 4;
81 repaint(); 83 repaint();
82} 84}
83 85
84void OWait::paintEvent( QPaintEvent * ) 86void OWait::paintEvent( QPaintEvent * )
85{ 87{
86 QPainter p( m_lb ); 88 QPainter p( m_lb );
87 p.drawPixmap( 0, 0, m_pix, m_aniSize * frame, 0, m_aniSize, m_aniSize ); 89 p.drawPixmap( 0, 0, m_pix, m_aniSize * frame, 0, m_aniSize, m_aniSize );
88} 90}
89 91
90void OWait::show() 92void OWait::show()
91{ 93{
92 94
93 move( ( ( qApp->desktop() ->width() ) / 2 ) - ( m_aniSize / 2 ), ( ( qApp->desktop() ->height() ) / 2 ) - ( m_aniSize / 2 ) ); 95 move( ( ( qApp->desktop() ->width() ) / 2 ) - ( m_aniSize / 2 ), ( ( qApp->desktop() ->height() ) / 2 ) - ( m_aniSize / 2 ) );
94 startTimer( 300 ); 96 startTimer( 300 );
95 m_waitTimer->start( m_timerLength * 1000, true ); 97 m_waitTimer->start( m_timerLength * 1000, true );
96 QDialog::show(); 98 QDialog::show();
97} 99}
98 100
99void OWait::hide() 101void OWait::hide()
100{ 102{
101 killTimers(); 103 killTimers();
102 m_waitTimer->stop(); 104 m_waitTimer->stop();
103 frame = 0; 105 frame = 0;
104 QDialog::hide(); 106 QDialog::hide();
105} 107}
106 108
107void OWait::setTimerLength( int length ) 109void OWait::setTimerLength( int length )
108{ 110{
109 m_timerLength = length; 111 m_timerLength = length;
110} 112}
111 113
112OWait::~OWait() 114OWait::~OWait()
113{} 115{}
diff --git a/libopie2/opieui/owait.h b/libopie2/opieui/owait.h
index 03c33e4..0036bb1 100644
--- a/libopie2/opieui/owait.h
+++ b/libopie2/opieui/owait.h
@@ -1,90 +1,89 @@
1/* 1/*
2                This file is part of the Opie Project 2                 This file is part of the Opie Project
3              Copyright (C) 2003 Maximilian Reiss <harlekin@handhelds.org> 3
4 Copyright (C) 2003 Maximilian Reiss <harlekin@handhelds.org>
4 =. 5 =.
5 .=l. 6 .=l.
6           .>+-= 7           .>+-=
7 _;:,     .>    :=|. This program is free software; you can 8 _;:,     .>    :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under 9.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software 11.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version. 13     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_. 14    .%`+i>       _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that 15    .i_,=:_.      -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of 17 : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more 20..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details. 21++=   -.     .`     .: details.
21 :     =  ...= . :.=- 22 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 23 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 24  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 25    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
28
29*/ 29*/
30 30
31#ifndef OWAIT_H 31#ifndef OWAIT_H
32#define OWAIT_H 32#define OWAIT_H
33 33
34/* QT */ 34/* QT */
35#include <qdialog.h> 35#include <qdialog.h>
36#include <qlabel.h> 36#include <qlabel.h>
37#include <qpixmap.h> 37#include <qpixmap.h>
38#include <qtimer.h> 38#include <qtimer.h>
39 39
40 40
41namespace Opie { 41namespace Opie {
42namespace Ui { 42namespace Ui {
43/** 43/**
44 * This class displays a animated waiting icon in the middle of the screen. 44 * This class displays a animated waiting icon in the middle of the screen.
45 * 45 *
46 * @short modal hour glass dialog 46 * @short modal hour glass dialog
47 * @see QDialog 47 * @see QDialog
48 * @author Maximilian Reiß 48 * @author Maximilian Rei� */
49 */
50class OWait : public QDialog 49class OWait : public QDialog
51{ 50{
52 Q_OBJECT 51 Q_OBJECT
53 52
54 public: 53 public:
55 OWait( QWidget *parent = 0, const char* name = 0, bool dispIcon = TRUE ); 54 OWait( QWidget *parent = 0, const char* name = 0, bool dispIcon = TRUE );
56 ~OWait(); 55 ~OWait();
57 56
58 /** 57 /**
59 * reimplemented for control reasons 58 * reimplemented for control reasons
60 */ 59 */
61 void show(); 60 void show();
62 61
63 /** 62 /**
64 * Set the time before the icon will be automaticly hidden 63 * Set the time before the icon will be automaticly hidden
65 * The timer will be started once the widget will be shown. 64 * The timer will be started once the widget will be shown.
66 * @param length - time in seconds 65 * @param length - time in seconds
67 */ 66 */
68 void setTimerLength( int length ); 67 void setTimerLength( int length );
69 68
70 public slots: 69 public slots:
71 /** 70 /**
72 * reimplemented for control reasons 71 * reimplemented for control reasons
73 */ 72 */
74 void hide(); 73 void hide();
75 74
76 private: 75 private:
77 void timerEvent( QTimerEvent * ); 76 void timerEvent( QTimerEvent * );
78 void paintEvent( QPaintEvent * ); 77 void paintEvent( QPaintEvent * );
79 78
80 QPixmap m_pix; 79 QPixmap m_pix;
81 QLabel *m_lb; 80 QLabel *m_lb;
82 QTimer *m_waitTimer; 81 QTimer *m_waitTimer;
83 int m_timerLength; 82 int m_timerLength;
84 int m_aniSize; 83 int m_aniSize;
85 class Private; 84 class Private;
86 Private *d; 85 Private *d;
87}; 86};
88} 87}
89} 88}
90#endif 89#endif