Diffstat (limited to 'libopie/ofileselector/ofileselector.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie/ofileselector/ofileselector.cpp | 56 |
1 files changed, 36 insertions, 20 deletions
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 @@ -243,13 +243,13 @@ bool OFileSelector::cd(const QString &path ) m_currentDir = path; reparse(); return true; } void OFileSelector::setSelector(int mode ) { -QString text; + QString text; switch( mode ){ case Normal: text = tr("Documents"); break; case Extended: text = tr("Files"); @@ -258,28 +258,28 @@ QString text; text = tr("All Files"); break; } slotViewCheck( text ); } -void OFileSelector::setPopupFactory(OPopupMenuFactory *popup ) +void OFileSelector::setPopupFactory(OPopupMenuFactory */*popup*/ ) { /* m_custom = popup; m_showPopup = true; */ } //void OFileSelector::updateL 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(); } } @@ -301,15 +301,15 @@ QStringList OFileSelector::selectedNames()const */ 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 { QStringList list; list << selectedPath(); @@ -330,13 +330,13 @@ int OFileSelector::fileCount() case Normal: count = m_select->fileCount(); break; case Extended: case ExtendedAll: default: - count = currentView()->childCount(); + count = currentView()->fileCount(); break; } return count; } DocLnk OFileSelector::selectedDocument() const { @@ -346,13 +346,13 @@ DocLnk OFileSelector::selectedDocument() const lnk = m_select->selectedDocument(); break; } case Extended: case ExtendedAll: default: - lnk = DocLnk( selectedName() ); // new DocLnk + lnk = DocLnk( selectedName() ); break; } return lnk; } QValueList<DocLnk> OFileSelector::selectedDocuments() const { @@ -369,12 +369,13 @@ 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 @@ -401,13 +402,13 @@ void OFileSelector::slotViewCheck(const QString &sel) m_selector = ExtendedAll; initializeListView(); reparse(); m_stack->raiseWidget( Extended ); // same widget other QFileFilter } } -// not yet finished..... + QString OFileSelector::currentMimeType() const{ QString mime; QString currentText; if (m_shChooser ) currentText = m_mimeCheck->currentText(); @@ -628,24 +629,24 @@ void OFileSelector::initVars() m_custom = 0; m_edit = 0; 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 ) ) // return; MimeType type( info->absFilePath() ); 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; } void OFileSelector::delItems() { @@ -922,13 +923,12 @@ 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; } } @@ -946,14 +946,15 @@ void OFileSelector::slotFileBridgeSelected( const DocLnk &lnk ) // emit fileSelected( 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 ;) qWarning("current changed"); if(!sel->isDir() ){ @@ -965,26 +966,28 @@ void OFileSelector::slotCurrentChanged(QListViewItem* item ) QString path =sel->directory() + "/" + str[0].stripWhiteSpace(); emit fileSelected(path ); 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 ) return; 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) ); if( sel->isDir() ){ cd( sel->directory() + "/" + str[0].stripWhiteSpace() ); @@ -998,56 +1001,61 @@ void OFileSelector::slotClicked( int button, QListViewItem *item, const QPoint & qWarning("file selected"); emit fileSelected( lnk ); } } break; } - } + } */ } void OFileSelector::slotRightButton(int button, QListViewItem *item, const QPoint &, int ) { if( item == 0 ) return; 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() { } 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 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+list[0], tr("Yes"),tr("No"),0,1,1) ) { @@ -1057,12 +1065,13 @@ void OFileSelector::slotDelete() } } else { QFile::remove( list[0] ); } m_View->takeItem( sel ); delete sel; + */ } void OFileSelector::cdUP() { QDir dir( m_currentDir ); dir.cdUp(); if(dir.exists() ){ @@ -1207,12 +1216,15 @@ 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; else filter = QDir::Files | QDir::Dirs | QDir::All ; @@ -1241,6 +1253,10 @@ void OFileSelector::internContextMenu() { void OFileSelector::internChangedDir( const QString& s) { emit dirSelected( s ); } void OFileSelector::internChangedDir( const QDir& s) { emit dirSelected( s ); } +QPixmap OFileSelector::pixmap( const QString& s ) { + + return (*m_pixmaps)[s]; +} |