author | zecke <zecke> | 2002-09-15 20:00:57 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-09-15 20:00:57 (UTC) |
commit | f79126f5ba0b1d1520e5fb07716ffe9e2479aedf (patch) (side-by-side diff) | |
tree | 6e44ff18246728b0861cc7ce974a0a0fae3c6796 | |
parent | 1c5780f34ec9b4dc004714488b46997fe1a0909b (diff) | |
download | opie-f79126f5ba0b1d1520e5fb07716ffe9e2479aedf.zip opie-f79126f5ba0b1d1520e5fb07716ffe9e2479aedf.tar.gz opie-f79126f5ba0b1d1520e5fb07716ffe9e2479aedf.tar.bz2 |
Make it compile but it's not working yet
-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 @@ -80,9 +80,9 @@ QString OFileDialog::getOpenFileName(int selector, const QString &caption ) { 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(); @@ -96,9 +96,9 @@ QString OFileDialog::getSaveFileName(int selector, const QString &caption ) { 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,5 +1,8 @@ +#include <qpe/mimetype.h> +#include <qpe/resource.h> + #include "ofileselector.h" #include "ofileselectoritem.h" #include "ofilelistview.h" @@ -14,9 +17,9 @@ 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() ); QPixmap pix = type.pixmap(); @@ -32,10 +35,10 @@ void OFileListView::addFile( const QString& mime, if( isSymlink ) 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"); } } @@ -47,17 +50,17 @@ void OFileListView::addFile( const QString& mime, 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; if( symlink ) @@ -77,19 +80,19 @@ void OFileListView::addDir( const QString& mime, info->dirPath( true ), locked, 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& ) { @@ -104,15 +107,19 @@ 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 @@ -245,9 +245,9 @@ bool OFileSelector::cd(const QString &path ) return true; } void OFileSelector::setSelector(int mode ) { -QString text; + QString text; switch( mode ){ case Normal: text = tr("Documents"); break; @@ -260,9 +260,9 @@ QString text; } slotViewCheck( text ); } -void OFileSelector::setPopupFactory(OPopupMenuFactory *popup ) +void OFileSelector::setPopupFactory(OPopupMenuFactory */*popup*/ ) { /* m_custom = popup; m_showPopup = true; */ @@ -273,11 +273,11 @@ void OFileSelector::setPopupFactory(OPopupMenuFactory *popup ) 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{ name = m_currentDir + "/" + currentView()->selectedName(); @@ -303,11 +303,11 @@ 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 { @@ -332,9 +332,9 @@ int OFileSelector::fileCount() break; case Extended: case ExtendedAll: default: - count = currentView()->childCount(); + count = currentView()->fileCount(); break; } return count; } @@ -348,9 +348,9 @@ DocLnk OFileSelector::selectedDocument() const } case Extended: case ExtendedAll: default: - lnk = DocLnk( selectedName() ); // new DocLnk + lnk = DocLnk( selectedName() ); break; } return lnk; } @@ -371,8 +371,9 @@ void OFileSelector::slotOk() void OFileSelector::slotCancel() { emit cancel(); } +/* switch the views */ void OFileSelector::slotViewCheck(const QString &sel) { if( sel == tr("Documents" ) ){ if( m_select == 0 ){ @@ -403,9 +404,9 @@ void OFileSelector::slotViewCheck(const QString &sel) reparse(); m_stack->raiseWidget( Extended ); // same widget other QFileFilter } } -// not yet finished..... + QString OFileSelector::currentMimeType() const{ QString mime; QString currentText; if (m_shChooser ) @@ -630,9 +631,9 @@ void OFileSelector::initVars() m_fnLabel = 0; 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; // if( !compliesMime(info->absFilePath(), mime ) ) @@ -641,9 +642,9 @@ void OFileSelector::addFile(const QString &mime, QFileInfo *info, bool symlink) if (!compliesMime( type.id() ) ) return; } -void OFileSelector::addDir(const QString &mime, QFileInfo *info, bool symlink ) +void OFileSelector::addDir(const QString &, QFileInfo *, bool ) { if(!m_dir) return; } @@ -924,9 +925,8 @@ bool OFileSelector::compliesMime( const QString& mime ) { if ( list.contains(mime) ) return true; 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 ) { if ( mime.contains( (*it2).left(pos) ) ) return true; @@ -948,10 +948,11 @@ void OFileSelector::slotFileBridgeSelected( const DocLnk &lnk ) void OFileSelector::slotSelectionChanged() { } -void OFileSelector::slotCurrentChanged(QListViewItem* item ) +void OFileSelector::slotCurrentChanged(QListViewItem* /*item*/ ) { + /* if( item == 0 ) return; if( m_selector == Extended || m_selector == ExtendedAll ) { OFileSelectorItem *sel = (OFileSelectorItem*) item; // start to use the C++ casts ;) @@ -967,12 +968,14 @@ void OFileSelector::slotCurrentChanged(QListViewItem* item ) DocLnk lnk( path ); 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; if( button != Qt::LeftButton ) @@ -980,9 +983,9 @@ 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() ){ QStringList str = QStringList::split("->", sel->text(1) ); @@ -1000,9 +1003,9 @@ void OFileSelector::slotClicked( int button, QListViewItem *item, const QPoint & } } break; } - } + } */ } void OFileSelector::slotRightButton(int button, QListViewItem *item, const QPoint &, int ) { if( item == 0 ) @@ -1011,30 +1014,34 @@ void OFileSelector::slotRightButton(int button, QListViewItem *item, const QPoin if( button != Qt::RightButton ) 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) ); slotFileSelected( sel->directory() +"/" +str[0].stripWhiteSpace() ); qWarning("slot open"); // DocLnk lnk( sel->directory() + "/" + str[0].stripWhiteSpace() ); //emit fileSelected( lnk ); } + */ } void OFileSelector::slotRescan() { @@ -1044,8 +1051,9 @@ void OFileSelector::slotRename() reparse(); } void OFileSelector::slotDelete() { + /* OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); QStringList list = QStringList::split("->", sel->text(1) ); if( sel->isDir() ){ QString str = QString::fromLatin1("rm -rf ") + sel->directory() +"/" + list[0]; //better safe than sorry @@ -1059,8 +1067,9 @@ void OFileSelector::slotDelete() QFile::remove( list[0] ); } m_View->takeItem( sel ); delete sel; + */ } void OFileSelector::cdUP() { QDir dir( m_currentDir ); @@ -1209,8 +1218,11 @@ void OFileSelector::reparse() OFileView* OFileSelector::currentView() { return 0l; } +OFileView* OFileSelector::currentView() const{ + return 0l; +} int OFileSelector::filter() { int filter; if ( m_selector == ExtendedAll ) filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All; @@ -1243,4 +1255,8 @@ 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 @@ -335,10 +335,12 @@ 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 & ); void fileSelected( const QString & ); 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 @@ -25,4 +25,7 @@ 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 @@ -89,9 +89,9 @@ protected: void fileSelected(const DocLnk & ); void contextMenu(); void changedDir(const QString &); void changedDir(const QDir & ); - OFileSelector* selector(); + OFileSelector* selector()const; private: OFileSelector* m_sel; }; |