summaryrefslogtreecommitdiff
authorzecke <zecke>2002-09-29 16:53:10 (UTC)
committer zecke <zecke>2002-09-29 16:53:10 (UTC)
commit33ebc68a530393697724428f0e0db3a4807f3a9e (patch) (unidiff)
treef13affe84a0a4fce01c642c18b6b3c3f42d68e6b
parent3e8ee39d31b43f01524670df6cb048efc2194b9a (diff)
downloadopie-33ebc68a530393697724428f0e0db3a4807f3a9e.zip
opie-33ebc68a530393697724428f0e0db3a4807f3a9e.tar.gz
opie-33ebc68a530393697724428f0e0db3a4807f3a9e.tar.bz2
Add the possibility to hide/show the TypeCombo/CategorySelect
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--library/fileselector.cpp20
-rw-r--r--library/fileselector.h2
2 files changed, 22 insertions, 0 deletions
diff --git a/library/fileselector.cpp b/library/fileselector.cpp
index 382012f..7ff09b4 100644
--- a/library/fileselector.cpp
+++ b/library/fileselector.cpp
@@ -311,24 +311,25 @@ FileSelector::FileSelector( const QString &f, QWidget *parent, const char *name,
311 QPEMenuToolFocusManager::manager()->addWidget( tb ); 311 QPEMenuToolFocusManager::manager()->addWidget( tb );
312 312
313 view = new FileSelectorView( this, "fileview" ); 313 view = new FileSelectorView( this, "fileview" );
314 QPEApplication::setStylusOperation( view->viewport(), QPEApplication::RightOnHold ); 314 QPEApplication::setStylusOperation( view->viewport(), QPEApplication::RightOnHold );
315 connect( view, SIGNAL( mouseButtonClicked( int, QListViewItem *, const QPoint &, int ) ), 315 connect( view, SIGNAL( mouseButtonClicked( int, QListViewItem *, const QPoint &, int ) ),
316 this, SLOT( fileClicked( int, QListViewItem *, const QPoint &, int ) ) ); 316 this, SLOT( fileClicked( int, QListViewItem *, const QPoint &, int ) ) );
317 connect( view, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint &, int ) ), 317 connect( view, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint &, int ) ),
318 this, SLOT( filePressed( int, QListViewItem *, const QPoint &, int ) ) ); 318 this, SLOT( filePressed( int, QListViewItem *, const QPoint &, int ) ) );
319 connect( view, SIGNAL( returnPressed( QListViewItem * ) ), 319 connect( view, SIGNAL( returnPressed( QListViewItem * ) ),
320 this, SLOT( fileClicked( QListViewItem * ) ) ); 320 this, SLOT( fileClicked( QListViewItem * ) ) );
321 321
322 QHBox *hb = new QHBox( this ); 322 QHBox *hb = new QHBox( this );
323
323 d->typeCombo = new TypeCombo( hb ); 324 d->typeCombo = new TypeCombo( hb );
324 connect( d->typeCombo, SIGNAL(selected(const QString&)), 325 connect( d->typeCombo, SIGNAL(selected(const QString&)),
325 this, SLOT(typeSelected(const QString&)) ); 326 this, SLOT(typeSelected(const QString&)) );
326 QWhatsThis::add( d->typeCombo, tr("Show documents of this type") ); 327 QWhatsThis::add( d->typeCombo, tr("Show documents of this type") );
327 328
328 Categories c; 329 Categories c;
329 c.load(categoryFileName()); 330 c.load(categoryFileName());
330 QArray<int> vl( 0 ); 331 QArray<int> vl( 0 );
331 d->catSelect = new CategorySelect( hb ); 332 d->catSelect = new CategorySelect( hb );
332 d->catSelect->setRemoveCategoryEdit( TRUE ); 333 d->catSelect->setRemoveCategoryEdit( TRUE );
333 d->catSelect->setCategories( vl, "Document View", tr("Document View") ); 334 d->catSelect->setCategories( vl, "Document View", tr("Document View") );
334 d->catSelect->setAllCategories( TRUE ); 335 d->catSelect->setAllCategories( TRUE );
@@ -487,24 +488,43 @@ void FileSelector::setNewVisible( bool b )
487 488
488 This function is deprecated. 489 This function is deprecated.
489*/ 490*/
490void FileSelector::setCloseVisible( bool b ) 491void FileSelector::setCloseVisible( bool b )
491{ 492{
492 if ( b ) 493 if ( b )
493 d->toolbar->show(); 494 d->toolbar->show();
494 else 495 else
495 d->toolbar->hide(); 496 d->toolbar->hide();
496} 497}
497 498
498/*! 499/*!
500
501*/
502void FileSelector::setTypeComboVisible( bool b ) {
503 if ( b )
504 d->typeCombo->show();
505 else
506 d->typeCombo->hide();
507}
508/*!
509
510*/
511void FileSelector::setCategorySelectVisible( bool b ) {
512 if ( b )
513 d->catSelect->show();
514 else
515 d->catSelect->hide();
516}
517
518/*!
499 Rereads the list of documents. 519 Rereads the list of documents.
500*/ 520*/
501void FileSelector::reread() 521void FileSelector::reread()
502{ 522{
503 d->files.clear(); 523 d->files.clear();
504 Global::findDocuments(&d->files, filter); 524 Global::findDocuments(&d->files, filter);
505 d->typeCombo->reread( d->files, filter ); 525 d->typeCombo->reread( d->files, filter );
506 updateView(); 526 updateView();
507} 527}
508 528
509void FileSelector::updateView() 529void FileSelector::updateView()
510{ 530{
diff --git a/library/fileselector.h b/library/fileselector.h
index f1c9eb1..e3ae891 100644
--- a/library/fileselector.h
+++ b/library/fileselector.h
@@ -45,24 +45,26 @@ private:
45}; 45};
46 46
47class FileSelectorPrivate; 47class FileSelectorPrivate;
48class FileSelector : public QVBox 48class FileSelector : public QVBox
49{ 49{
50 Q_OBJECT 50 Q_OBJECT
51 51
52public: 52public:
53 FileSelector( const QString &mimefilter, QWidget *parent, const char *name=0, bool newVisible = TRUE, bool closeVisible = TRUE ); 53 FileSelector( const QString &mimefilter, QWidget *parent, const char *name=0, bool newVisible = TRUE, bool closeVisible = TRUE );
54 ~FileSelector(); 54 ~FileSelector();
55 void setNewVisible( bool b ); 55 void setNewVisible( bool b );
56 void setCloseVisible( bool b ); 56 void setCloseVisible( bool b );
57 void setTypeComboVisible( bool b = TRUE );
58 void setCategorySelectVisible( bool b = TRUE );
57 void reread(); 59 void reread();
58 int fileCount(); 60 int fileCount();
59 DocLnk selectedDocument() const 61 DocLnk selectedDocument() const
60 { 62 {
61 const DocLnk* rp = ((FileSelector*)this)->selected(); 63 const DocLnk* rp = ((FileSelector*)this)->selected();
62 if (!rp) { 64 if (!rp) {
63 DocLnk r; 65 DocLnk r;
64 return r; 66 return r;
65 } 67 }
66 DocLnk r(*rp); 68 DocLnk r(*rp);
67 delete rp; 69 delete rp;
68 return r; 70 return r;