Qtopia library API Documentation

fileselector.h

00001 /**********************************************************************
00002 ** Copyright (C) 2000-2002 Trolltech AS.  All rights reserved.
00003 **
00004 ** This file is part of the Qtopia Environment.
00005 **
00006 ** This file may be distributed and/or modified under the terms of the
00007 ** GNU General Public License version 2 as published by the Free Software
00008 ** Foundation and appearing in the file LICENSE.GPL included in the
00009 ** packaging of this file.
00010 **
00011 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00012 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00013 **
00014 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00015 **
00016 ** Contact info@trolltech.com if any conditions of this licensing are
00017 ** not clear to you.
00018 **
00019 **********************************************************************/
00020 #ifndef FILESELECTOR_H
00021 #define FILESELECTOR_H
00022 
00023 #include <qhbox.h>
00024 #include <qvbox.h>
00025 #include <qtoolbutton.h>
00026 #include <qlistview.h>
00027 
00028 #include "filemanager.h"
00029 #include "applnk.h"
00030 
00031 class QPopupMenu;
00032 class QPushButton;
00033 class FileSelectorView;
00034 
00035 class FileSelectorItem : public QListViewItem
00036 {
00037 public:
00038     FileSelectorItem( QListView *parent, const DocLnk& f );
00039     ~FileSelectorItem();
00040 
00041     DocLnk file() const { return fl; }
00042 
00043 private:
00044     DocLnk fl;
00045 };
00046 
00047 class FileSelectorPrivate;
00048 class FileSelector : public QVBox
00049 {
00050     Q_OBJECT
00051 
00052 public:
00053     FileSelector( const QString &mimefilter, QWidget *parent, const char *name=0, bool newVisible = TRUE, bool closeVisible = TRUE );
00054     ~FileSelector();
00055     void setNewVisible( bool b );
00056     void setCloseVisible( bool b );
00057     void setTypeComboVisible( bool b = TRUE );
00058     void setCategorySelectVisible( bool b = TRUE );
00059     void reread();
00060     int fileCount();
00061     DocLnk selectedDocument() const
00062     {
00063     const DocLnk* rp = ((FileSelector*)this)->selected();
00064     if (!rp) {
00065         DocLnk r;
00066         return r;
00067     }
00068     DocLnk r(*rp);
00069     delete rp;
00070     return r;
00071     }
00072 
00073     QValueList<DocLnk> fileList() const
00074     {
00075     ((FileSelector*)this)->fileCount(); // ensure all loaded when this is extended
00076 
00077     QValueList<DocLnk> list;
00078     FileSelectorItem *item = (FileSelectorItem *)((QListView*)view)->firstChild();
00079     while (item) {
00080         list.append(item->file());
00081         item = (FileSelectorItem *)item->nextSibling();
00082     }
00083 
00084     return list;
00085     }
00086 
00087 signals:
00088     void fileSelected( const DocLnk & );
00089     void newSelected( const DocLnk & );
00090     void closeMe();
00091 
00092 private slots:
00093     void createNew();
00094     void fileClicked( int, QListViewItem *, const QPoint &, int );
00095     // pressed to get 'right down'
00096     void filePressed( int, QListViewItem *, const QPoint &, int );
00097     void fileClicked( QListViewItem *);
00098     void typeSelected( const QString &type );
00099     void catSelected( int );
00100     void cardMessage( const QCString &, const QByteArray &);
00101 
00102 private:
00103     void updateView();
00104     void updateWhatsThis();
00105 
00106 private:
00107     // RESOLVE please -zecke@handhelds.org
00108     const DocLnk *selected(); // use selectedDocument()  luckily no compiler is putting the access into the symbol name
00109     FileSelectorView *view;
00110     QString filter;
00111     QToolButton *buttonNew, *buttonClose;
00112     FileSelectorPrivate *d;
00113 };
00114 
00115 #endif
KDE Logo
This file is part of the documentation for OPIE Version 1.5.5.
Documentation copyright © 1997-2003 the KDE developers. 2003 OPIE developers
Generated on Tue Feb 10 20:24:04 2004 by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2001