-rw-r--r-- | libopie/ofileselector.cc | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/libopie/ofileselector.cc b/libopie/ofileselector.cc index 9534667..6a6a300 100644 --- a/libopie/ofileselector.cc +++ b/libopie/ofileselector.cc @@ -346,65 +346,65 @@ QStringList OFileSelector::selectedNames()const list << selectedName(); // FIXME implement multiple Selections } return list; } /** If mode is set to the Dir selection this will return the selected path. * * */ QString OFileSelector::selectedPath()const { QString path; if( m_selector == NORMAL ){ path = QPEApplication::documentDir(); }else if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ){ ; } return path; } QStringList OFileSelector::selectedPaths() const { QStringList list; list << selectedPath(); return list; } QString OFileSelector::directory()const { if( m_selector == NORMAL ) return QPEApplication::documentDir(); return QDir(m_currentDir).absPath(); } -int OFileSelector::fileCount() +int OFileSelector::fileCount() const { int count; switch( m_selector ){ case NORMAL: count = m_select->fileCount(); break; //case CUSTOM: case EXTENDED: case EXTENDED_ALL: default: count = m_View->childCount(); break; } return count; } DocLnk OFileSelector::selectedDocument() const { DocLnk lnk; switch( m_selector ){ case NORMAL:{ lnk = m_select->selectedDocument(); break; } case EXTENDED: case EXTENDED_ALL: default: lnk = DocLnk( selectedName() ); // new DocLnk break; } return lnk; } QValueList<DocLnk> OFileSelector::selectedDocuments() const @@ -653,97 +653,97 @@ void OFileSelector::initVars() 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::addFile(const QString &mime, QFileInfo *info, bool symlink) +void OFileSelector::addFile(const QString &/*mime*/, QFileInfo *info, bool symlink) { if(!m_files) return; // if( !compliesMime(info->absFilePath(), mime ) ) // return; MimeType type( info->absFilePath() ); if (!compliesMime( type.id() ) ) return; QPixmap pix = type.pixmap(); QString dir; QString name; bool locked; if( pix.isNull() ) pix = Resource::loadPixmap( "UnknownDocument-14"); dir = info->dirPath( true ); if( symlink ) name = info->fileName() + " -> " +info->dirPath() + "/" + info->readLink(); else { name = info->fileName(); if( ( m_mode == OPEN && !info->isReadable() )|| ( m_mode == SAVE && !info->isWritable() ) ){ locked = true; pix = Resource::loadPixmap("locked"); } } new OFileSelectorItem( m_View, pix, name, info->lastModified().toString(), QString::number( info->size() ), dir, locked ); } -void OFileSelector::addDir(const QString &mime, QFileInfo *info, bool symlink ) +void OFileSelector::addDir(const QString &/*mime*/, QFileInfo *info, bool symlink ) { if(!m_dir) return; if( m_selector == EXTENDED_ALL || m_selector == EXTENDED ){ bool locked = false; QString name; QPixmap pix; if( ( m_mode == OPEN && !info->isReadable() ) || ( m_mode == SAVE && !info->isWritable() ) ){ locked = true; if( symlink ) pix = (*m_pixmaps)["symlinkedlocked"]; else pix = Resource::loadPixmap("lockedfolder"); }else { // readable pix = symlink ? (*m_pixmaps)["dirsymlink"] : Resource::loadPixmap("folder") ; } name = symlink ? info->fileName() + "->" + info->dirPath(true) + "/" +info->readLink() : info->fileName() ; new OFileSelectorItem( m_View, pix, name, info->lastModified().toString(), QString::number( info->size() ), info->dirPath( true ), locked, true ); }// else CUSTOM View } void OFileSelector::delItems() { } void OFileSelector::initializeName() { /** Name Layout Line @@ -989,65 +989,64 @@ bool OFileSelector::compliesMime( const QString &path, const QString &mime ) * is contained in the mimefilter and then we will * look if both are equal until the '/' */ bool OFileSelector::compliesMime( const QString& mime ) { qWarning("mimetype is %s", mime.latin1() ); QString currentText; if (m_shChooser ) currentText = m_mimeCheck->currentText(); qWarning("current text is %s", currentText.latin1() ); QMap<QString, QStringList>::Iterator it; QStringList list; if ( currentText == tr("All") ) return true; else if ( currentText.isEmpty() && !m_mimetypes.isEmpty() ) { it = m_mimetypes.begin(); list = it.data(); }else if ( currentText.isEmpty() ) return true; else{ it = m_mimetypes.find(currentText ); if ( it == m_mimetypes.end() ) qWarning("not there"), list << currentText; else qWarning("found"), list = it.data(); } // dump it now //for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { // qWarning( "%s", (*it).latin1() ); //} 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; } } return false; } void OFileSelector::slotFileSelected( const QString &string ) { if( m_shLne ) m_edit->setText( string ); emit fileSelected( string ); } void OFileSelector::slotFileBridgeSelected( const DocLnk &lnk ) { slotFileSelected( lnk.name() ); emit fileSelected( lnk ); } void OFileSelector::slotSelectionChanged() { } void OFileSelector::slotCurrentChanged(QListViewItem* item ) { if( item == 0 ) return; if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ) { OFileSelectorItem *sel = (OFileSelectorItem*) item; // start to use the C++ casts ;) qWarning("current changed"); if(!sel->isDir() ){ if( m_shLne ) @@ -1076,65 +1075,65 @@ void OFileSelector::slotClicked( int button, QListViewItem *item, const QPoint & break; case EXTENDED: // fall through case EXTENDED_ALL:{ OFileSelectorItem *sel = (OFileSelectorItem*)item; if(!sel->isLocked() ){ QStringList str = QStringList::split("->", sel->text(1) ); if( sel->isDir() ){ cd( sel->directory() + "/" + str[0].stripWhiteSpace() ); // if MODE Dir m_shLne set the Text }else{ if( m_shLne ) m_edit->setText( str[0].stripWhiteSpace() ); qWarning("selected here in slot clicked"); emit fileSelected( sel->directory() + "/" + str[0].stripWhiteSpace() ); DocLnk lnk( sel->directory() + "/" + str[0].stripWhiteSpace() ); 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() { |