-rw-r--r-- | libopie/ofileselector/ofiledialog.cpp | 4 | ||||
-rw-r--r-- | libopie/ofileselector/ofilelistview.cpp | 43 | ||||
-rw-r--r-- | libopie/ofileselector/ofileselector.cpp | 56 | ||||
-rw-r--r-- | libopie/ofileselector/ofileselector.h | 2 | ||||
-rw-r--r-- | libopie/ofileselector/ofileview.cpp | 3 | ||||
-rw-r--r-- | libopie/ofileselector/ofileview.h | 2 |
6 files changed, 69 insertions, 41 deletions
diff --git a/libopie/ofileselector/ofiledialog.cpp b/libopie/ofileselector/ofiledialog.cpp index 4783004..430def2 100644 --- a/libopie/ofileselector/ofiledialog.cpp +++ b/libopie/ofileselector/ofiledialog.cpp @@ -81,7 +81,7 @@ QString OFileDialog::getOpenFileName(int selector, { QString ret; OFileDialog dlg( caption.isEmpty() ? tr("Open") : caption, - wid, OFileSelector::OPEN, selector, startDir, file, mimes); + wid, OFileSelector::Open, selector, startDir, file, mimes); dlg.showMaximized(); if( dlg.exec() ) ret = dlg.fileName(); @@ -97,7 +97,7 @@ QString OFileDialog::getSaveFileName(int selector, { QString ret; OFileDialog dlg( caption.isEmpty() ? tr("Save") : caption, - wid, OFileSelector::SAVE, selector, startDir, file, mimes); + wid, OFileSelector::Save, selector, startDir, file, mimes); dlg.showMaximized(); if( dlg.exec() ) ret = dlg.fileName(); diff --git a/libopie/ofileselector/ofilelistview.cpp b/libopie/ofileselector/ofilelistview.cpp index 0c7d45b..7108a5b 100644 --- a/libopie/ofileselector/ofilelistview.cpp +++ b/libopie/ofileselector/ofilelistview.cpp @@ -1,4 +1,7 @@ +#include <qpe/mimetype.h> +#include <qpe/resource.h> + #include "ofileselector.h" #include "ofileselectoritem.h" #include "ofilelistview.h" @@ -15,7 +18,7 @@ OFileListView::~OFileListView() { void OFileListView::clear() { QListView::clear(); } -void OFileListView::addFile( const QString& mime, +void OFileListView::addFile( const QString&, QFileInfo* info, bool isSymlink ) { MimeType type( info->absFilePath() ); @@ -33,8 +36,8 @@ void OFileListView::addFile( const QString& mime, name = info->fileName() + " -> " +info->dirPath() + "/" + info->readLink(); else { name = info->fileName(); - if( ( selector()->mode() == Open && !info->isReadable() )|| - ( selector()->mode() == Save && !info->isWritable() ) ){ + if( ( selector()->mode() == OFileSelector::Open && !info->isReadable() ) || + ( selector()->mode() == OFileSelector::Save && !info->isWritable() ) ){ locked = true; pix = Resource::loadPixmap("locked"); } @@ -48,15 +51,15 @@ void OFileListView::addFile( const QString& /*mime*/, const QString& /*dir*/, const QString& /*file*/, bool /*isSyml*/ ) { } -void OFileListView::addDir( const QString& mime, - QFileInfo* info, bool isSym ) { +void OFileListView::addDir( const QString&, + QFileInfo* info, bool symlink ) { bool locked = false; QString name; QPixmap pix; - if( ( selector()->mode() == Open && !info->isReadable() ) || - ( selector()->mode() == Save && !info->isWritable() ) ){ + if( ( selector()->mode() == OFileSelector::Open && !info->isReadable() ) || + ( selector()->mode() == OFileSelector::Save && !info->isWritable() ) ){ locked = true; @@ -78,17 +81,17 @@ void OFileListView::addDir( const QString& mime, true ); } -void OFileListView::addDir( const QString& mime, const QString& dir, - const QString& file, bool ) { +void OFileListView::addDir( const QString& /*mime*/, const QString& /*dir*/, + const QString& /*file*/, bool ) { } -void OFileListView::addSymlink( const QString& mime, - QFileInfo* info, - bool isSym ) { +void OFileListView::addSymlink( const QString& /*mime*/, + QFileInfo* /*info*/, + bool /*isSym*/ ) { } -void OFileListView::addSymlink( const QString& mime, const QString& path, - const QString& file, bool isSym ) { +void OFileListView::addSymlink( const QString& /*mime*/, const QString& /*path*/, + const QString& /*file*/, bool /*isSym*/ ) { } void OFileListView::cd( const QString& ) { @@ -105,13 +108,17 @@ QString OFileListView::selectedName()const{ return item->text( 1 ); } QStringList OFileListView::selectedNames()const { - + QStringList list; + list << selectedName(); + return list; } QString OFileListView::selectedPath()const { - + return QString::null; } -QString OFileListView::selectedPaths()const { - +QStringList OFileListView::selectedPaths()const { + QStringList list; + list << selectedPath(); + return list; } int OFileListView::fileCount() { return childCount(); diff --git a/libopie/ofileselector/ofileselector.cpp b/libopie/ofileselector/ofileselector.cpp index f655606..16ee3ee 100644 --- a/libopie/ofileselector/ofileselector.cpp +++ b/libopie/ofileselector/ofileselector.cpp @@ -246,7 +246,7 @@ bool OFileSelector::cd(const QString &path ) } void OFileSelector::setSelector(int mode ) { -QString text; + QString text; switch( mode ){ case Normal: text = tr("Documents"); @@ -261,7 +261,7 @@ QString text; slotViewCheck( text ); } -void OFileSelector::setPopupFactory(OPopupMenuFactory *popup ) +void OFileSelector::setPopupFactory(OPopupMenuFactory */*popup*/ ) { /* m_custom = popup; m_showPopup = true; @@ -274,9 +274,9 @@ QString OFileSelector::selectedName() const { QString name; if( m_selector == Normal ){ - DocLnk lnk = m_select->selectedDocument(); - name = lnk.file(); - }else if( m_selector == Extended || m_selector == ExtendedAll ){ + DocLnk lnk = m_select->selectedDocument(); + name = lnk.file(); + }else { if ( m_shLne ) { name = m_currentDir + "/" +m_edit->text(); }else{ @@ -304,9 +304,9 @@ QString OFileSelector::selectedPath()const QString path; if( m_selector == Normal ){ path = QPEApplication::documentDir(); - }else if( m_selector == Extended || m_selector == ExtendedAll ){ - ; //FIXME - } + } /*else if( m_selector == Extended || m_selector == ExtendedAll ){ + ; + }*/ return path; } QStringList OFileSelector::selectedPaths() const @@ -333,7 +333,7 @@ int OFileSelector::fileCount() case Extended: case ExtendedAll: default: - count = currentView()->childCount(); + count = currentView()->fileCount(); break; } return count; @@ -349,7 +349,7 @@ DocLnk OFileSelector::selectedDocument() const case Extended: case ExtendedAll: default: - lnk = DocLnk( selectedName() ); // new DocLnk + lnk = DocLnk( selectedName() ); break; } return lnk; @@ -372,6 +372,7 @@ void OFileSelector::slotCancel() { emit cancel(); } +/* switch the views */ void OFileSelector::slotViewCheck(const QString &sel) { if( sel == tr("Documents" ) ){ @@ -404,7 +405,7 @@ void OFileSelector::slotViewCheck(const QString &sel) m_stack->raiseWidget( Extended ); // same widget other QFileFilter } } -// not yet finished..... + QString OFileSelector::currentMimeType() const{ QString mime; QString currentText; @@ -631,7 +632,7 @@ void OFileSelector::initVars() m_new = 0; m_close = 0; } -void OFileSelector::addFile(const QString &mime, QFileInfo *info, bool symlink) +void OFileSelector::addFile(const QString &, QFileInfo *info, bool ) { if(!m_files) return; @@ -642,7 +643,7 @@ void OFileSelector::addFile(const QString &mime, QFileInfo *info, bool symlink) return; } -void OFileSelector::addDir(const QString &mime, QFileInfo *info, bool symlink ) +void OFileSelector::addDir(const QString &, QFileInfo *, bool ) { if(!m_dir) return; @@ -925,7 +926,6 @@ bool OFileSelector::compliesMime( const QString& mime ) { qWarning("list doesn't contain it "); QStringList::Iterator it2; int pos; - int pos2; for ( it2 = list.begin(); it2 != list.end(); ++it2 ) { pos = (*it2).findRev("/*"); if ( pos >= 0 ) { @@ -949,8 +949,9 @@ void OFileSelector::slotSelectionChanged() { } -void OFileSelector::slotCurrentChanged(QListViewItem* item ) +void OFileSelector::slotCurrentChanged(QListViewItem* /*item*/ ) { + /* if( item == 0 ) return; if( m_selector == Extended || m_selector == ExtendedAll ) { @@ -968,10 +969,12 @@ void OFileSelector::slotCurrentChanged(QListViewItem* item ) emit fileSelected(lnk ); } } - } + } */ } -void OFileSelector::slotClicked( int button, QListViewItem *item, const QPoint &, int) +void OFileSelector::slotClicked( int /*button*/, QListViewItem */*item*/, const QPoint &, int) + { + /* if ( item == 0 ) return; @@ -981,7 +984,7 @@ void OFileSelector::slotClicked( int button, QListViewItem *item, const QPoint & switch( m_selector ){ default: break; - case Extended: // fall through + case Extended: // fall through case ExtendedAll:{ OFileSelectorItem *sel = (OFileSelectorItem*)item; if(!sel->isLocked() ){ @@ -1001,7 +1004,7 @@ void OFileSelector::slotClicked( int button, QListViewItem *item, const QPoint & } break; } - } + } */ } void OFileSelector::slotRightButton(int button, QListViewItem *item, const QPoint &, int ) { @@ -1012,20 +1015,23 @@ void OFileSelector::slotRightButton(int button, QListViewItem *item, const QPoin return; slotContextMenu( item ); } -void OFileSelector::slotContextMenu( QListViewItem *item) +void OFileSelector::slotContextMenu( QListViewItem */*item*/) { } void OFileSelector::slotChangedDir() { + /* OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); if(sel->isDir() ){ QStringList str = QStringList::split("->", sel->text(1) ); cd( sel->directory() + "/" + str[0].stripWhiteSpace() ); } + */ } void OFileSelector::slotOpen() { + /* OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); if(!sel->isDir() ){ QStringList str = QStringList::split("->", sel->text(1) ); @@ -1034,6 +1040,7 @@ void OFileSelector::slotOpen() // DocLnk lnk( sel->directory() + "/" + str[0].stripWhiteSpace() ); //emit fileSelected( lnk ); } + */ } void OFileSelector::slotRescan() { @@ -1045,6 +1052,7 @@ void OFileSelector::slotRename() } void OFileSelector::slotDelete() { + /* OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); QStringList list = QStringList::split("->", sel->text(1) ); if( sel->isDir() ){ @@ -1060,6 +1068,7 @@ void OFileSelector::slotDelete() } m_View->takeItem( sel ); delete sel; + */ } void OFileSelector::cdUP() { @@ -1210,6 +1219,9 @@ void OFileSelector::reparse() OFileView* OFileSelector::currentView() { return 0l; } +OFileView* OFileSelector::currentView() const{ + return 0l; +} int OFileSelector::filter() { int filter; if ( m_selector == ExtendedAll ) @@ -1244,3 +1256,7 @@ void OFileSelector::internChangedDir( const QString& s) { void OFileSelector::internChangedDir( const QDir& s) { emit dirSelected( s ); } +QPixmap OFileSelector::pixmap( const QString& s ) { + + return (*m_pixmaps)[s]; +} diff --git a/libopie/ofileselector/ofileselector.h b/libopie/ofileselector/ofileselector.h index 937569d..12af732 100644 --- a/libopie/ofileselector/ofileselector.h +++ b/libopie/ofileselector/ofileselector.h @@ -336,8 +336,10 @@ class OFileSelector : public QWidget { QValueList<DocLnk> selectedDocuments()const; OFileView* currentView(); + OFileView* currentView()const; int filter(); int sorting(); + QPixmap pixmap( const QString& ); signals: void fileSelected( const DocLnk & ); diff --git a/libopie/ofileselector/ofileview.cpp b/libopie/ofileselector/ofileview.cpp index 71843c1..9bb40c9 100644 --- a/libopie/ofileselector/ofileview.cpp +++ b/libopie/ofileselector/ofileview.cpp @@ -26,3 +26,6 @@ void OFileView::changedDir( const QString& s) { void OFileView::changedDir( const QDir& d ) { m_sel->internChangedDir( d ); } +OFileSelector* OFileView::selector() const { + return m_sel; +} diff --git a/libopie/ofileselector/ofileview.h b/libopie/ofileselector/ofileview.h index 997266a..1b397f5 100644 --- a/libopie/ofileselector/ofileview.h +++ b/libopie/ofileselector/ofileview.h @@ -90,7 +90,7 @@ protected: void contextMenu(); void changedDir(const QString &); void changedDir(const QDir & ); - OFileSelector* selector(); + OFileSelector* selector()const; private: OFileSelector* m_sel; |