author | zecke <zecke> | 2002-05-02 07:15:29 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-05-02 07:15:29 (UTC) |
commit | 9a3f2b67dab939993a56db83c1d473fc7ae6d57a (patch) (side-by-side diff) | |
tree | b35b8d840400996e270dace0a11648bf361ed31e /libopie/ofileselector.h | |
parent | a52fd4b1995e34963888397587aa2592ea858da6 (diff) | |
download | opie-9a3f2b67dab939993a56db83c1d473fc7ae6d57a.zip opie-9a3f2b67dab939993a56db83c1d473fc7ae6d57a.tar.gz opie-9a3f2b67dab939993a56db83c1d473fc7ae6d57a.tar.bz2 |
Here is the rewrite of ofileselector
Mostly the layout was fixed and it should be much easier to
understand whats going on
It also got more functionality with less code
Next is MultipleSelections, Open Dir mode save dir mode and
installingViews
-rw-r--r-- | libopie/ofileselector.h | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/libopie/ofileselector.h b/libopie/ofileselector.h index 5c38ac4..47697b9 100644 --- a/libopie/ofileselector.h +++ b/libopie/ofileselector.h @@ -54,53 +54,54 @@ class DocLnk; class QCheckBox; class QComboBox; class QPushButton; class FileSelector; class QGridLayout; class QLineEdit; class QLabel; class QWidgetStack; class QHBoxLayout; class QVBoxLayout; class QPopupMenu; class QFileInfo; +class QHBox; // class OFileSelector : public QWidget { Q_OBJECT public: enum Mode {OPEN=1, SAVE=2, FILESELECTOR=4, DIR=8 }; enum Selector{NORMAL=0, EXTENDED = 1, EXTENDED_ALL =2 }; enum View { DIRS = 1, FILES = 2, TREE = 4, ICON = 8 }; OFileSelector(QWidget *wid, int mode, int selector, const QString &dirName, const QString &fileName = QString::null, const QStringList &mimetypes = QStringList() ); OFileSelector(const QString &mimeFilter, QWidget *parent, const char *name, bool newVisible = TRUE, - bool closeVisible = FALSE ) { }; + bool closeVisible = FALSE ); - ~OFileSelector() {}; + ~OFileSelector(); // currently only for the FILESELECTOR Mode - void setNewVisible( bool /*b*/ ) { }; - void setCloseVisible(bool /*b*/ ) { }; + void setNewVisible( bool /*b*/ ); + void setCloseVisible(bool /*b*/ ); // end file selector mode // deprecated - void reread() { reparse(); }; + void reread(); // make sure not to leak please const DocLnk *selected(); // end deprecated bool isToolbarVisible() const { return m_shTool; }; bool isPermissionBarVisible() const { return m_shPerm; }; bool isLineEditVisible()const { return m_shLne; }; bool isChooserVisible( )const { return m_shChooser; }; bool isYesCancelVisible()const { return m_shYesNo; }; void setYesCancelVisible( bool show ); void setToolbarVisible( bool show ); void setPermissionBarVisible( bool show ); @@ -125,116 +126,120 @@ class OFileSelector : public QWidget { void setShowFiles(bool ); bool cd(const QString &path ); int mode()const { return m_mode; }; int selector()const { return m_selector; }; void setSelector( int ); bool showPopup()const { return m_showPopup; }; void setShowPopup( bool pop ) { m_showPopup = pop; }; void setPopupMenu( QPopupMenu * ); - void updateLay(); + // void updateLay(); void reparse(); // re reads the dir QString selectedName( )const; QStringList selectedNames()const; QString selectedPath() const; QStringList selectedPaths() const; QString directory()const; int fileCount(); /* the user needs to delete it */ DocLnk selectedDocument()const; /* the user needs to delete it */ QValueList<DocLnk> selectedDocuments()const; signals: void fileSelected( const DocLnk & ); void fileSelected( const QString & ); void dirSelected(const QString &dir ); void closeMe(); void ok(); void cancel(); + void contextMenu(); - protected slots: + private slots: + void slotTest() { qWarning("slotTest" ); setLineEditVisible(false ); }; void slotOk(); void slotCancel(); void slotViewCheck(const QString & ); void slotMimeCheck(const QString & ); - void locationComboActivated(const QString & ); - void insertLocationPath(const QString &, int); + void slotLocationActivated(const QString & ); + void slotInsertLocationPath(const QString &, int); void locationComboChanged(); - protected: + + private: void init(); void updateMimes(); protected: private: int m_mode, m_selector; QComboBox *m_location, *m_mimeCheck, *m_viewCheck; QPushButton *m_homeButton, *m_docButton, *m_hideButton, *m_ok, *m_cancel; - QPushButton *m_reread, *m_up; + QPushButton *m_reread, *m_up, *m_new, *m_close; QListView *m_View; QCheckBox *m_checkPerm; QWidget *m_pseudo; QVBoxLayout *m_pseudoLayout; QString m_currentDir; QString m_name; - QStringList m_mimetypes, requestedMimeTypesList; + QStringList m_mimetypes; FileSelector *m_select; QWidgetStack *m_stack; QVBoxLayout *m_lay; QGridLayout *m_Oselector; - QHBoxLayout *m_boxToolbar; - QHBoxLayout *m_boxOk; - QHBoxLayout *m_boxName; - QHBoxLayout *m_boxView; + QHBox *m_boxToolbar; + QHBox *m_boxOk; // (no layout anymore) wait + QHBox *m_boxName; // (no Layout anymore) wait + QHBox *m_boxView; QPopupMenu *m_custom; QLineEdit *m_edit; QLabel *m_fnLabel; bool m_shClose : 1; bool m_shNew : 1; bool m_shTool : 1; bool m_shPerm : 1; bool m_shLne : 1; bool m_shChooser : 1; bool m_shYesNo : 1; bool m_boCheckPerm : 1; bool m_autoMime : 1; bool m_case : 1; bool m_dir : 1; bool m_files : 1; bool m_showPopup : 1; - // implementation todo + void initVars(); virtual void addFile(const QString &mime, QFileInfo *info, bool symlink = FALSE ); virtual void addDir( const QString &mime, QFileInfo *info , bool symlink = FALSE ); virtual void addSymlink(const QString &, QFileInfo *, bool = FALSE ){}; void delItems(); void initializeName(); void initializeYes(); void initializeChooser(); void initializeListView(); + void initializePerm(); void initPics(); bool compliesMime(const QString &path, const QString &mime); class OFileSelectorPrivate; OFileSelectorPrivate *d; static QMap<QString,QPixmap> *m_pixmaps; private slots: void slotFileSelected(const QString & ); // not really meant to be a slot void slotFileBridgeSelected( const DocLnk & ); virtual void slotSelectionChanged(); virtual void slotCurrentChanged(QListViewItem* ); |