Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

fileselector.h

Go to the documentation of this file.
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 "qpeglobal.h"
00029 #include "filemanager.h"
00030 #include "applnk.h"
00031 
00032 class QPopupMenu;
00033 class QPushButton;
00034 class FileSelectorView;
00035 
00036 class FileSelectorItem : public QListViewItem
00037 {
00038 public:
00039     FileSelectorItem( QListView *parent, const DocLnk& f );
00040     ~FileSelectorItem();
00041 
00042     DocLnk file() const { return fl; }
00043 
00044 private:
00045     DocLnk fl;
00046 };
00047 
00048 class FileSelectorPrivate;
00049 class FileSelector : public QVBox
00050 {
00051     Q_OBJECT
00052 
00053 public:
00054     FileSelector( const QString &mimefilter, QWidget *parent, const char *name=0, bool newVisible = TRUE, bool closeVisible = TRUE );
00055     ~FileSelector();
00056     void setNewVisible( bool b );
00057     void setCloseVisible( bool b ) QPE_DEPRECATED;
00058     void setTypeComboVisible( bool b = TRUE );
00059     void setCategorySelectVisible( bool b = TRUE );
00060     void reread();
00061     int fileCount();
00062     DocLnk selectedDocument() const
00063     {
00064         const DocLnk* rp = ((FileSelector*)this)->selected();
00065         if (!rp) {
00066             DocLnk r;
00067             return r;
00068         }
00069         DocLnk r(*rp);
00070         delete rp;
00071         return r;
00072     }
00073 
00074     QValueList<DocLnk> fileList() const
00075     {
00076         ((FileSelector*)this)->fileCount(); // ensure all loaded when this is extended
00077 
00078         QValueList<DocLnk> list;
00079         FileSelectorItem *item = (FileSelectorItem *)((QListView*)view)->firstChild();
00080         while (item) {
00081             list.append(item->file());
00082             item = (FileSelectorItem *)item->nextSibling();
00083         }
00084 
00085         return list;
00086     }
00087 
00088 signals:
00089     void fileSelected( const DocLnk & );
00090     void newSelected( const DocLnk & );
00091     void closeMe();
00092 
00093 private slots:
00094     void createNew();
00095     void fileClicked( int, QListViewItem *, const QPoint &, int );
00096     // pressed to get 'right down'
00097     void filePressed( int, QListViewItem *, const QPoint &, int );
00098     void fileClicked( QListViewItem *);
00099     void typeSelected( const QString &type );
00100     void catSelected( int );
00101     void cardMessage( const QCString &, const QByteArray &);
00102 
00103 private:
00104     void updateView();
00105     void updateWhatsThis();
00106 
00107 private:
00108     // RESOLVE please -zecke@handhelds.org
00109     const DocLnk *selected() QPE_DEPRECATED; // use selectedDocument()  luckily no compiler is putting the access into the symbol name
00110     FileSelectorView *view;
00111     QString filter;
00112     QToolButton *buttonNew, *buttonClose;
00113     FileSelectorPrivate *d;
00114 };
00115 
00116 #endif

Generated on Sat Nov 5 16:16:35 2005 for OPIE by  doxygen 1.4.2