summaryrefslogtreecommitdiff
path: root/library
authorzecke <zecke>2002-09-29 16:53:10 (UTC)
committer zecke <zecke>2002-09-29 16:53:10 (UTC)
commit33ebc68a530393697724428f0e0db3a4807f3a9e (patch) (side-by-side diff)
treef13affe84a0a4fce01c642c18b6b3c3f42d68e6b /library
parent3e8ee39d31b43f01524670df6cb048efc2194b9a (diff)
downloadopie-33ebc68a530393697724428f0e0db3a4807f3a9e.zip
opie-33ebc68a530393697724428f0e0db3a4807f3a9e.tar.gz
opie-33ebc68a530393697724428f0e0db3a4807f3a9e.tar.bz2
Add the possibility to hide/show the TypeCombo/CategorySelect
Diffstat (limited to 'library') (more/less context) (ignore 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
@@ -299,48 +299,49 @@ FileSelector::FileSelector( const QString &f, QWidget *parent, const char *name,
d->toolbar->hide();
QWidget *spacer = new QWidget( d->toolbar );
spacer->setBackgroundMode( PaletteButton );
QToolButton *tb = new QToolButton( d->toolbar );
tb->setPixmap( Resource::loadPixmap( "close" ) );
connect( tb, SIGNAL( clicked() ), this, SIGNAL( closeMe() ) );
buttonClose = tb;
tb->setFixedSize( 18, 20 ); // tb->sizeHint() );
tb->setAutoRaise( TRUE );
QToolTip::add( tb, tr( "Close the File Selector" ) );
QPEMenuToolFocusManager::manager()->addWidget( tb );
view = new FileSelectorView( this, "fileview" );
QPEApplication::setStylusOperation( view->viewport(), QPEApplication::RightOnHold );
connect( view, SIGNAL( mouseButtonClicked( int, QListViewItem *, const QPoint &, int ) ),
this, SLOT( fileClicked( int, QListViewItem *, const QPoint &, int ) ) );
connect( view, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint &, int ) ),
this, SLOT( filePressed( int, QListViewItem *, const QPoint &, int ) ) );
connect( view, SIGNAL( returnPressed( QListViewItem * ) ),
this, SLOT( fileClicked( QListViewItem * ) ) );
QHBox *hb = new QHBox( this );
+
d->typeCombo = new TypeCombo( hb );
connect( d->typeCombo, SIGNAL(selected(const QString&)),
this, SLOT(typeSelected(const QString&)) );
QWhatsThis::add( d->typeCombo, tr("Show documents of this type") );
Categories c;
c.load(categoryFileName());
QArray<int> vl( 0 );
d->catSelect = new CategorySelect( hb );
d->catSelect->setRemoveCategoryEdit( TRUE );
d->catSelect->setCategories( vl, "Document View", tr("Document View") );
d->catSelect->setAllCategories( TRUE );
connect( d->catSelect, SIGNAL(signalSelected(int)), this, SLOT(catSelected(int)) );
QWhatsThis::add( d->catSelect, tr("Show documents in this category") );
setCloseVisible( closeVisible );
QCopChannel *channel = new QCopChannel( "QPE/Card", this );
connect( channel, SIGNAL(received(const QCString &, const QByteArray &)),
this, SLOT(cardMessage( const QCString &, const QByteArray &)) );
reread();
updateWhatsThis();
}
@@ -475,48 +476,67 @@ void FileSelector::setNewVisible( bool b )
{
if ( d->showNew != b ) {
d->showNew = b;
updateView();
updateWhatsThis();
}
}
/*!
If \a b is TRUE a "close" or "no document" button is visible; if \a
b is FALSE this button is not visible and the user is unable to
leave the dialog without creating or selecting a document.
This function is deprecated.
*/
void FileSelector::setCloseVisible( bool b )
{
if ( b )
d->toolbar->show();
else
d->toolbar->hide();
}
/*!
+
+*/
+void FileSelector::setTypeComboVisible( bool b ) {
+ if ( b )
+ d->typeCombo->show();
+ else
+ d->typeCombo->hide();
+}
+/*!
+
+*/
+void FileSelector::setCategorySelectVisible( bool b ) {
+ if ( b )
+ d->catSelect->show();
+ else
+ d->catSelect->hide();
+}
+
+/*!
Rereads the list of documents.
*/
void FileSelector::reread()
{
d->files.clear();
Global::findDocuments(&d->files, filter);
d->typeCombo->reread( d->files, filter );
updateView();
}
void FileSelector::updateView()
{
FileSelectorItem *item = (FileSelectorItem *)view->selectedItem();
if ( item == d->newDocItem )
item = 0;
QString oldFile;
if ( item )
oldFile = item->file().file();
view->clear();
QListIterator<DocLnk> dit( d->files.children() );
for ( ; dit.current(); ++dit ) {
bool mimeMatch = FALSE;
if ( d->mimeFilters.count() ) {
QValueList<QRegExp>::Iterator it;
diff --git a/library/fileselector.h b/library/fileselector.h
index f1c9eb1..e3ae891 100644
--- a/library/fileselector.h
+++ b/library/fileselector.h
@@ -33,48 +33,50 @@ class QPushButton;
class FileSelectorView;
class FileSelectorItem : public QListViewItem
{
public:
FileSelectorItem( QListView *parent, const DocLnk& f );
~FileSelectorItem();
DocLnk file() const { return fl; }
private:
DocLnk fl;
};
class FileSelectorPrivate;
class FileSelector : public QVBox
{
Q_OBJECT
public:
FileSelector( const QString &mimefilter, QWidget *parent, const char *name=0, bool newVisible = TRUE, bool closeVisible = TRUE );
~FileSelector();
void setNewVisible( bool b );
void setCloseVisible( bool b );
+ void setTypeComboVisible( bool b = TRUE );
+ void setCategorySelectVisible( bool b = TRUE );
void reread();
int fileCount();
DocLnk selectedDocument() const
{
const DocLnk* rp = ((FileSelector*)this)->selected();
if (!rp) {
DocLnk r;
return r;
}
DocLnk r(*rp);
delete rp;
return r;
}
QValueList<DocLnk> fileList() const
{
((FileSelector*)this)->fileCount(); // ensure all loaded when this is extended
QValueList<DocLnk> list;
FileSelectorItem *item = (FileSelectorItem *)((QListView*)view)->firstChild();
while (item) {
list.append(item->file());
item = (FileSelectorItem *)item->nextSibling();
}