-rw-r--r-- | libopie/ofileselector/ofileselector.cpp | 345 | ||||
-rw-r--r-- | libopie/ofileselector/ofileselector.h | 125 | ||||
-rw-r--r-- | libopie/ofileselector/olister.h | 1 |
3 files changed, 226 insertions, 245 deletions
diff --git a/libopie/ofileselector/ofileselector.cpp b/libopie/ofileselector/ofileselector.cpp index 98b61f7..c52aa62 100644 --- a/libopie/ofileselector/ofileselector.cpp +++ b/libopie/ofileselector/ofileselector.cpp @@ -21,25 +21,27 @@ #include <qpe/qpeapplication.h> #include <qpe/applnk.h> #include <qpe/global.h> #include <qpe/mimetype.h> #include <qpe/resource.h> #include <qpe/storage.h> #include <unistd.h> #include <stdlib.h> #include <sys/stat.h> #include "ofileview.h" +#include "ofileselectormain.h" #include "ofileselector.h" +#include "olocallister.h" #include "olister.h" QMap<QString,QPixmap> *OFileSelector::m_pixmaps = 0; namespace { /* let's find the index for a specified string */ int indexByString( const QComboBox *box, const QString &str ){ int index= 0; for(int i= 0; i < box->count(); i++ ){ /* found */ if( str == box->text(i ) ){ index= i; @@ -92,124 +94,108 @@ OFileSelector::OFileSelector(const QString &mimeFilter, QWidget *parent, } OFileSelector::~OFileSelector() { } void OFileSelector::setNewVisible( bool visible ) { m_shNew = visible; - if( m_selector == Normal ){ - delete m_select; - // we need to initialize but keep the selected mimetype - QString mime = currentMimeType(); - m_select = new FileSelector( mime , - m_stack, "fileselector", - m_shNew, m_shClose); - - connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), - this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); - connect(m_select, SIGNAL(closeMe() ), - this, SIGNAL(closeMe() ) ); - //connect to close me and other signals as well - m_stack->addWidget( m_select, Normal ); - }else{ - m_new->show(); - } + if (m_new ) + m_new->show(); } void OFileSelector::setCloseVisible( bool visible ) { m_shClose = visible; - if( m_selector == Normal ){ - setNewVisible( m_shNew ); // yeah baby - }else{ + + if( m_close ) m_close->show(); - } } void OFileSelector::reread() { - if( m_selector == Normal ){ - setNewVisible( m_shNew ); // make it a initializeSelector - }else { - reparse(); - } + if( m_selector == Normal ) + initializeOldSelector(); + else + reparse(); } const DocLnk *OFileSelector::selected() { DocLnk *lnk = new DocLnk(selectedDocument() ); return lnk; } void OFileSelector::setYesCancelVisible( bool show ) { initializeYes(); // FIXME if YesCancel is not shown we will initialize it to hide it :( m_shYesNo = show; + if( m_shYesNo ) m_boxOk->show(); else m_boxOk->hide(); } void OFileSelector::setToolbarVisible( bool show ) { m_shTool = show; - initializeListView(); // FIXME see above waste of memory if(!m_shTool ){ m_location->hide(); m_up->hide(); m_homeButton->hide(); m_docButton->hide(); }else{ m_location->show(); m_up->show(); m_homeButton->show(); m_docButton->show(); } } void OFileSelector::setPermissionBarVisible( bool show ) { m_shPerm = show; initializePerm(); + if( m_shPerm ) m_checkPerm->show(); else m_checkPerm->hide(); } void OFileSelector::setLineEditVisible( bool show ) { if( show ){ initializeName(); m_boxName->show(); }else{ - if( m_shLne && m_boxName != 0 ){ // check if we showed before this is the way to go - m_boxName->hide(); - } + // check if we showed before this is the way to go + if( m_shLne && m_boxName != 0 ) + m_boxName->hide(); } m_shLne = show; } void OFileSelector::setChooserVisible( bool show ) { m_shChooser = show; initializeChooser(); - if( m_shChooser ){ - m_boxView->hide(); - }else{ - m_boxView->show(); - } + + if( m_shChooser ) + m_boxView->hide(); + else + m_boxView->show(); + } QCheckBox* OFileSelector::permissionCheckbox() { if( m_selector == Normal ) return 0l; else return m_checkPerm; } bool OFileSelector::setPermission()const { return m_checkPerm == 0 ? false : m_checkPerm->isChecked(); @@ -217,33 +203,36 @@ bool OFileSelector::setPermission()const void OFileSelector::setPermissionChecked( bool check ) { if( m_checkPerm ) m_checkPerm->setChecked( check ); } void OFileSelector::setMode(int mode) // FIXME do direct raising { m_mode = mode; if( m_selector == Normal ) return; } -void OFileSelector::setShowDirs(bool ) +void OFileSelector::setShowDirs(bool dir) { - m_dir = true; - reparse(); + m_dir = dir; + if ( m_selector != Fileselector ) + reparse(); } void OFileSelector::setCaseSensetive(bool caSe ) { m_case = caSe; - reparse(); + + if ( m_selector != Fileselector ) + reparse(); } void OFileSelector::setShowFiles(bool show ) { m_files = show; reparse(); } /// bool OFileSelector::cd(const QString &path ) { m_currentDir = path; reparse(); return true; @@ -371,104 +360,68 @@ QValueList<DocLnk> OFileSelector::selectedDocuments() const void OFileSelector::slotOk() { emit ok(); } void OFileSelector::slotCancel() { emit cancel(); } /* switch the views */ void OFileSelector::slotViewCheck(const QString &sel) { if( sel == tr("Documents" ) ){ - if( m_select == 0 ){ - // autMime? fix cause now we use All and not the current - // yes currentMime fixes that for us - QString mime = currentMimeType(); - m_select = new FileSelector(mime, - m_stack, "fileselector", - m_shNew, m_shClose); - connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), - this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); - connect(m_select, SIGNAL(closeMe() ), - this, SIGNAL(closeMe() ) ); - //connect to close me and other signals as well - - m_stack->addWidget( m_select, Normal ); - } - m_stack->raiseWidget( Normal ); - m_selector = Normal; + initializeOldSelector(); + m_selector = Normal; + }else if( sel == tr("Files") ){ m_selector = Extended; - initializeListView(); - reparse(); - m_stack->raiseWidget( Extended ); + + // FIXME call the factory + //reparse(); }else if( sel == tr("All Files") ){ m_selector = ExtendedAll; - initializeListView(); - reparse(); - m_stack->raiseWidget( Extended ); // same widget other QFileFilter +/* see above + reparse(); */ } } QString OFileSelector::currentMimeType() const{ QString mime; QString currentText; - if (m_shChooser ) + if (m_shChooser && m_mimeCheck ) currentText = m_mimeCheck->currentText(); + qWarning("CurrentText" + currentText ); if (tr("All") == currentText ) return QString::null; else if (currentText.isEmpty() ) { ; }else { QMap<QString, QStringList>::ConstIterator it; it = m_mimetypes.find( currentText ); - if ( it == m_mimetypes.end() ) { + if ( it != m_mimetypes.end() ) { mime = it.data().join(";"); }else{ mime = currentText; } } return mime; } void OFileSelector::slotMimeCheck(const QString &mime) { if( m_selector == Normal ){ - //if( m_autoMime ){ - QString newMimeType; - if (mime != tr("All") ) { - QMap<QString, QStringList>::Iterator it; - it = m_mimetypes.find(mime); - if ( it != m_mimetypes.end() ) { - newMimeType = it.data().join(";"); - }else{ - newMimeType = mime; - } - } - delete m_select; - m_select = new FileSelector( newMimeType, - m_stack, "fileselector", - m_shNew, m_shClose); - - connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), - this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); - connect(m_select, SIGNAL(closeMe() ), - this, SIGNAL(closeMe() ) ); - //connect to close me and other signals as well - m_stack->addWidget( m_select, Normal ); - m_stack->raiseWidget( Normal ); + initializeOldSelector(); + updateMimes(); updateMimeCheck(); m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, mime) ); - //} }else{ // others qWarning("Mime %s", mime.latin1() ); if(m_shChooser ){ qWarning("Current Text %s", m_mimeCheck->currentText().latin1() ); //m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, mime) ); } reparse(); } } /* * Ok if a non dir gets inserted into this combobox @@ -515,53 +468,42 @@ void OFileSelector::locationComboChanged() if (info.isFile() ) cd(info.dirPath(TRUE) ); //absolute path else cd( m_location->lineEdit()->text() ); reparse(); } void OFileSelector::init() { m_lay = new QVBoxLayout( this ); m_lay->setSpacing(0 ); - m_stack = new QWidgetStack( this ); + /* take care of the main view... */ + initToolbar(); + + /* initialize the file lister */ + initLister(); if( m_selector == Normal ){ QString mime; if (!m_autoMime) { if (!m_mimetypes.isEmpty() ) { QMap<QString, QStringList>::Iterator it; it = m_mimetypes.begin(); // cause we're in the init mime = it.data().join(";"); } } - m_select = new FileSelector(mime, - m_stack, "fileselector", - m_shNew, m_shClose); - - connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), - this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); - connect(m_select, SIGNAL(closeMe() ), - this, SIGNAL( closeMe() ) ); - //connect to close me and other signals as well - - m_stack->addWidget( m_select, Normal ); - m_stack->raiseWidget( Normal ); - }else{ // we're in init so it will be EXTENDED or EXTENDED_ALL - // and initializeListview will take care of those - // toolbar get's generade in initializeListView - initializeListView( ); // will raise the widget as well - m_stack->raiseWidget( Extended ); + initializeOldSelector(); + }else{ + initializeView(); } - m_lay->addWidget( m_stack, 100 ); // add to the layout 10 = stretch if( m_shLne ) // the LineEdit with the current FileName initializeName(); if( m_shPerm ) // the Permission QCheckBox initializePerm(); if( m_shChooser ) // the Chooser for the view and Mimetypes initializeChooser(); if( m_shYesNo ) // the Yes No button row initializeYes( ); @@ -594,52 +536,53 @@ void OFileSelector::initVars() m_shClose = false; m_shNew = false; m_shTool = true; m_shPerm = false; m_shLne = true; m_shChooser = true; m_shYesNo = true; m_case = false; m_dir = true; m_files = true; m_showPopup = false; + m_mainView = 0l; + m_fileView = 0l; + m_lister = 0l; if(m_pixmaps == 0 ) // init the pixmaps initPics(); // pointers m_location = 0; m_mimeCheck = 0; m_viewCheck = 0; m_homeButton = 0; m_docButton = 0; m_hideButton = 0; m_ok = 0; m_cancel = 0; m_reread = 0; m_up = 0; m_View = 0; m_checkPerm = 0; m_pseudo = 0; m_pseudoLayout = 0; m_select = 0; - m_stack = 0; m_lay = 0; m_Oselector = 0; m_boxToolbar = 0; m_boxOk = 0; m_boxName = 0; m_boxView = 0; - m_custom = 0; m_edit = 0; m_fnLabel = 0; m_new = 0; m_close = 0; } void OFileSelector::initializeName() { /** Name Layout Line * This is the Layout line arranged in * horizontal way each components * are next to each other * but we will only do this if @@ -705,113 +648,121 @@ void OFileSelector::initializeChooser() { if( m_boxView == 0 ){ m_boxView = new QHBox( this ); m_viewCheck = new QComboBox( m_boxView, "view check"); m_mimeCheck = new QComboBox( m_boxView, "mime check"); m_boxView->setSpacing( 8 ); m_lay->addWidget(m_boxView, 0 ); m_viewCheck->insertItem( tr("Documents") ); m_viewCheck->insertItem( tr("Files") ); m_viewCheck->insertItem( tr("All Files") ); /* update to custom views */ + updateMimeCheck(); connect( m_viewCheck, SIGNAL( activated(const QString & ) ), this, SLOT( slotViewCheck(const QString & ) ) ); connect( m_mimeCheck, SIGNAL( activated(const QString & ) ), this, SLOT( slotMimeCheck( const QString & ) ) ); } } -void OFileSelector::initializeListView() -{ - qWarning("initializeListView"); - if( m_pseudo == 0 ){ - qWarning("init"); - m_pseudo = new QWidget( m_stack, "Pseudo Widget"); +/* generate the buttons for the toolbar */ +void OFileSelector::initToolbar() { + m_mainView = new OFileSelectorMain( this ); + + /* now generate the tool bar */ + qWarning( "toolbar" ); + m_pseudo = new QWidget( m_mainView, "Pseudo Widget" ); m_pseudoLayout = new QVBoxLayout( m_pseudo ); - // toolbar + m_boxToolbar = new QHBox( m_pseudo ); - m_boxToolbar->setSpacing(0 ); // next to each other please - - // toolbar members - { - // location QComboBox - m_location = new QComboBox( m_boxToolbar ); - m_location->setEditable( TRUE ); - m_location->setDuplicatesEnabled( FALSE ); - connect( m_location, SIGNAL(activated(const QString &) ), - this, SLOT( slotLocationActivated(const QString &) ) ); - connect( m_location->lineEdit(), SIGNAL(returnPressed() ), - this, SLOT(locationComboChanged() ) ); - // UP Button - m_up = new QPushButton(Resource::loadIconSet("up"),"", - m_boxToolbar,"cdUpButton"); - m_up->setFixedSize( QSize( 20, 20 ) ); - connect(m_up ,SIGNAL(clicked()),this,SLOT(cdUP() ) ); - m_up->setFlat(TRUE); - - // Home Button - m_homeButton = new QPushButton(Resource::loadIconSet("home") , - "", m_boxToolbar); - m_homeButton->setFixedSize( QSize( 20, 20 ) ); - connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotHome() ) ); - m_homeButton->setFlat(TRUE); - // Documents Button - m_docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"", - m_boxToolbar,"docsButton"); - m_docButton->setFixedSize( QSize( 20, 20 ) ); - connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotDoc() ) ); - m_docButton->setFlat(TRUE); - - // Close button - m_close = new QPushButton( Resource::loadIconSet( "close"), "", - m_boxToolbar ); - connect( m_close, SIGNAL(clicked() ), this, SIGNAL(closeMe() ) ); - m_close->setFixedSize( 20, 20 ); - - m_boxToolbar->setFixedHeight( 20 ); - m_pseudoLayout->addWidget(m_boxToolbar ); - - // let;s fill the Location ComboBox - StorageInfo storage; - const QList<FileSystem> &fs = storage.fileSystems(); - QListIterator<FileSystem> it ( fs ); - for( ; it.current(); ++it ){ + m_boxToolbar->setSpacing( 0 ); + + // tool bar members now + m_location = new QComboBox( m_boxToolbar ); + m_location->setEditable( TRUE ); + m_location->setDuplicatesEnabled( FALSE ); + connect( m_location, SIGNAL(activated(const QString& ) ), + this, SLOT(slotLocationActivated(const QString& )) ); + connect( m_location->lineEdit(), SIGNAL(returnPressed() ) , + this, SLOT(locationComboChanged() ) ); + + // UP Button + m_up = new QPushButton( Resource::loadIconSet("up"), QString::null, + m_boxToolbar, "cdUpButton" ); + m_up->setFixedSize( QSize(20, 20 ) ); + connect( m_up, SIGNAL( clicked() ), this, SLOT(cdUP() ) ); + m_up->setFlat( TRUE ); + + // Home Button + m_homeButton = new QPushButton(Resource::loadIconSet("home"), + QString::null, m_boxToolbar ); + m_homeButton->setFixedSize( QSize(20, 20 ) ); + connect(m_homeButton, SIGNAL(clicked() ), this, SLOT(slotHome() ) ); + m_homeButton->setFlat( TRUE ); + + // Documents Button + m_docButton = new QPushButton( Resource::loadIconSet("DocsIcon"), + QString::null, m_boxToolbar, + "docsButton" ); + m_docButton->setFixedSize( QSize(20, 20 ) ); + m_docButton->setFlat( true ); + connect( m_docButton, SIGNAL(clicked() ), + this, SLOT(slotDoc() ) ); + + // close button + m_close = new QPushButton( Resource::loadIconSet( "close"), "", + m_boxToolbar ); + connect( m_close, SIGNAL(clicked() ), this, SIGNAL(closeMe() ) ); + m_close->setFixedSize( 20, 20 ); + + m_boxToolbar->setFixedHeight( 20 ); + m_pseudoLayout->addWidget(m_boxToolbar ); + + /* init the locations */ + initLocations(); + + if( !m_shTool ){ + m_location->hide( ); + m_up->hide( ); + m_homeButton->hide( ); + m_docButton->hide( ); + } + if(!m_shClose ) + m_close->hide(); + + m_mainView->setToolbar( m_pseudo ); + m_lay->addWidget( m_mainView, 100 ); +} +/* initialize the OLocalLister */ +void OFileSelector::initLister() { + m_lister = new OLocalLister(this); +} +/* put default locations into the bar */ +void OFileSelector::initLocations () { + + // let;s fill the Location ComboBox + StorageInfo storage; + const QList<FileSystem> &fs = storage.fileSystems(); + QListIterator<FileSystem> it ( fs ); + for( ; it.current(); ++it ){ const QString disk = (*it)->name(); const QString path = (*it)->path(); m_location->insertItem(path+ "<-"+disk ); - } - int count = m_location->count(); - m_location->insertItem( m_currentDir ); - m_location->setCurrentItem( count ); - // due to the New and Close button we can not simply hide m_boxToolBar to not show it - if( !m_shTool ){ - m_location->hide( ); - m_up->hide( ); - m_homeButton->hide( ); - m_docButton->hide( ); - } - if(!m_shClose ) - m_close->hide(); - //if(!m_shNew) - //m_close->hide(); - - } // off toolbar - // the Main ListView - // make a QWidgetStack first so Views can share the Toolbar + } + int count = m_location->count(); + m_location->insertItem( m_currentDir ); + m_location->setCurrentItem( count ); - // m_pseudoLayout->addWidget( m_View, 288 ); - m_stack->addWidget( m_pseudo, Extended ); - } } void OFileSelector::initializePerm() { if( m_checkPerm == 0 ){ m_checkPerm = new QCheckBox(tr("Set Permission"), this, "perm"); m_checkPerm->setChecked( false ); m_lay->addWidget( m_checkPerm ); } } void OFileSelector::initPics() { m_pixmaps = new QMap<QString,QPixmap>; @@ -993,28 +944,28 @@ void OFileSelector::reparse() currentView()->sort(); if( m_shTool ){ m_location->insertItem( m_currentDir ); } // reenable painting and updates } OFileView* OFileSelector::currentView() { - return 0l; + return m_fileView; } OFileView* OFileSelector::currentView() const{ - return 0l; + return m_fileView; } int OFileSelector::filter() { int filter; if ( m_selector == ExtendedAll ) filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All; else filter = QDir::Files | QDir::Dirs | QDir::All ; return filter; } int OFileSelector::sorting() { int sort; @@ -1038,14 +989,34 @@ void OFileSelector::internContextMenu() { void OFileSelector::internChangedDir( const QString& s) { emit dirSelected( s ); cd(s ); } void OFileSelector::internChangedDir( const QDir& s) { emit dirSelected( s ); } QPixmap OFileSelector::pixmap( const QString& s ) { return (*m_pixmaps)[s]; } OLister* OFileSelector::currentLister()const { - return 0l; + return m_lister; +} +void OFileSelector::initializeOldSelector() { + qWarning("initializeOldSelector"); + + delete m_select; + + // we need to initialize but keep the selected mimetype + /* we default not to show close and new buttons */ + QString mime = currentMimeType(); + qWarning("MimeType " + mime ); + m_select = new FileSelector( mime , + m_mainView, "fileselector", + FALSE, FALSE); + + connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), + this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); + connect(m_select, SIGNAL(closeMe() ), + this, SIGNAL(closeMe() ) ); + //connect to close me and other signals as well + m_mainView->setWidget( m_select ); } diff --git a/libopie/ofileselector/ofileselector.h b/libopie/ofileselector/ofileselector.h index a7b363f..bf9a26b 100644 --- a/libopie/ofileselector/ofileselector.h +++ b/libopie/ofileselector/ofileselector.h @@ -60,24 +60,25 @@ class QComboBox; class QPushButton; class QGridLayout; class QLineEdit; class QLabel; class QWidgetStack; class QHBoxLayout; class QVBoxLayout; class QPopupMenu; class QFileInfo; class QHBox; class OFileView; class OLister; +class OFileSelectorMain; // /* the mimetypes one name and a list of mimetypes */ typedef QMap< QString, QStringList> MimeTypes; /** * FIXME later */ struct OPopupMenuFactory { OPopupMenuFactory() {} }; @@ -99,25 +100,25 @@ class OFileSelector : public QWidget { /** * The mode of the file selector * Either open, save, fileselector or dir browsing mode * */ enum Mode {Open = 1, Save = 2, Fileselector = 4, Dir = 8 }; /** * Selector. Either Normal for the one shipped with * libqpe or Extended. for the Extended * ExtendedAll also shows 'hidden' files */ - enum Selector{Normal=0, Extended = 1, ExtendedAll =2 }; + enum Selector{Normal=0, Extended = 1, ExtendedAll = 2}; /** * This is reserved for futrue views */ enum View { Dirs = 1, Files = 2, Tree = 4, Icon = 8 }; /** * A c'tor which should be used for advanced mode * @param wid the parent * @param mode the Mode of the Selector * @param selector the current View of the Selector * @param dirName in which dir to start @@ -333,24 +334,26 @@ class OFileSelector : public QWidget { int fileCount(); DocLnk selectedDocument()const; QValueList<DocLnk> selectedDocuments()const; OFileView* currentView(); OFileView* currentView()const; OLister* currentLister()const; int filter(); int sorting(); QPixmap pixmap( const QString& ); + /* our tool bar */ + QWidget* toolBar(); signals: void fileSelected( const DocLnk & ); void fileSelected( const QString & ); void dirSelected(const QString &dir ); void dirSelected( const QDir& ); void closeMe(); void ok(); void cancel(); void contextMenu(); private slots: @@ -360,111 +363,117 @@ class OFileSelector : public QWidget { void slotMimeCheck(const QString & ); void slotLocationActivated(const QString & ); void slotInsertLocationPath(const QString &, int); void locationComboChanged(); private: void init(); void updateMimes(); private: + OFileSelectorMain* m_mainView; + OLister* m_lister; + OFileView* m_fileView; FileSelector* m_select; 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, *m_new, *m_close; QListView *m_View; QCheckBox *m_checkPerm; QWidget *m_pseudo; QVBoxLayout *m_pseudoLayout; QString m_currentDir; QString m_name; - QMap<QString, QStringList> m_mimetypes; - - - QWidgetStack *m_stack; - QVBoxLayout *m_lay; - QGridLayout *m_Oselector; - - QHBox *m_boxToolbar; - QHBox *m_boxOk; - QHBox *m_boxName; - 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; - - void initVars(); - - void delItems(); - void initializeName(); - void initializeYes(); - void initializeChooser(); - void initializeListView(); - void initializePerm(); - void initPics(); - bool compliesMime(const QString &path, - const QString &mime); - bool compliesMime(const QString& mime ); + + QMap<QString, QStringList> m_mimetypes; + + QVBoxLayout *m_lay; + QGridLayout *m_Oselector; + + QHBox *m_boxToolbar; + QHBox *m_boxOk; + QHBox *m_boxName; + QHBox *m_boxView; + + + 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; + bool m_showHidden : 1; + + void initVars(); + + void delItems(); + void initializeName(); + void initializeYes(); + void initializeChooser(); + void initializePerm(); + void initPics(); + bool compliesMime(const QString &path, + const QString &mime); + bool compliesMime(const QString& mime ); /** * Updates the QComboBox with the current mimetypes */ - void updateMimeCheck(); + void updateMimeCheck(); + void initializeOldSelector(); + void initLister(); + void initToolbar(); + void initLocations(); + void initializeView() {}; // FIXME /** * Returns the current mimetype */ - QString currentMimeType()const; - class OFileSelectorPrivate; - OFileSelectorPrivate *d; - static QMap<QString,QPixmap> *m_pixmaps; + QString currentMimeType()const; + 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 & ); - // listview above - // popup below - virtual void slotDelete(); - virtual void cdUP(); - virtual void slotHome(); - virtual void slotDoc(); - virtual void slotNavigate( ); + void slotFileSelected(const QString & ); // not really meant to be a slot + void slotFileBridgeSelected( const DocLnk & ); + // listview above + // popup below + virtual void slotDelete(); + virtual void cdUP(); + virtual void slotHome(); + virtual void slotDoc(); + virtual void slotNavigate( ); /* for OLister */ private: /* for OFileView */ private: void internFileSelected( const QString& ); void internFileSelected( const DocLnk& ); void internContextMenu(); void internChangedDir( const QString& ); void internChangedDir( const QDir& ) ; diff --git a/libopie/ofileselector/olister.h b/libopie/ofileselector/olister.h index 081b876..ef61cab 100644 --- a/libopie/ofileselector/olister.h +++ b/libopie/ofileselector/olister.h @@ -1,18 +1,19 @@ #ifndef OPIE_FILE_LISTER_H #define OPIE_FILE_LISTER_H #include <qfileinfo.h> #include <qmap.h> #include <qstring.h> +#include <qstringlist.h> class OFileSelector; /** * lister is something like KIO but very * very basic and currently only for * populating our views. * This is a base class which needs to be implemented. * @see OLocalLister for a filesystem based implementation */ class OLister { public: OLister( OFileSelector* ); |