author | zautrix <zautrix> | 2005-06-18 18:03:50 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-18 18:03:50 (UTC) |
commit | 3d86c369e8b48b340e4093b034f1347defea876b (patch) (side-by-side diff) | |
tree | 50becb886d75770ce35108f4f97837b6b9d5664f /microkde | |
parent | 45c93de5a458e7ca0c293eebe504a9d949cc045c (diff) | |
download | kdepimpi-3d86c369e8b48b340e4093b034f1347defea876b.zip kdepimpi-3d86c369e8b48b340e4093b034f1347defea876b.tar.gz kdepimpi-3d86c369e8b48b340e4093b034f1347defea876b.tar.bz2 |
file dialog fixes
-rw-r--r-- | microkde/ofileselector_p.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/microkde/ofileselector_p.cpp b/microkde/ofileselector_p.cpp index e2af32b..488dee2 100644 --- a/microkde/ofileselector_p.cpp +++ b/microkde/ofileselector_p.cpp @@ -112,106 +112,107 @@ void ODocumentFileView::reread() { if (!m_selector) return; m_selector->setNewVisible( showNew() ); m_selector->setCloseVisible( showClose() ); m_selector->filter = currentMimeType().join(";"); m_selector->reread(); } int ODocumentFileView::fileCount()const { if (!m_selector) return -1; return m_selector->fileCount(); } DocLnk ODocumentFileView::selectedDocument()const { if (!m_selector) return DocLnk(); DocLnk lnk = *m_selector->selected(); return lnk; } QWidget* ODocumentFileView::widget( QWidget* parent ) { if (!m_selector ) { m_selector = new FileSelector(currentMimeType().join(";"), parent, "fileselector", showNew(), showClose() ); QObject::connect(m_selector, SIGNAL(fileSelected( const DocLnk& ) ), selector(), SLOT(slotDocLnkBridge(const DocLnk&) ) ); QObject::connect(m_selector, SIGNAL(closeMe() ), selector(), SIGNAL(closeMe() ) ); QObject::connect(m_selector, SIGNAL(newSelected(const DocLnk& ) ), selector(), SIGNAL(newSelected(const DocLnk& ) ) ); } return m_selector; } /* * This is the file system view used * we use a QListView + QListViewItems for it */ OFileSelectorItem::OFileSelectorItem( QListView* view, const QPixmap& pixmap, const QString& path, const QString& date, const QString& size, const QString& dir, bool isLocked, bool isDir ) : QListViewItem( view ) { - QString kind; + QString kind = "dir";; QString _path = path; - if ( isDir ) - kind = "dir"; - else - kind = "file"; + if ( !isDir ){ + int arrow = path.findRev( "." ,-1); + if (arrow > 0 ) { + kind = path.mid(arrow+1); + } + } setPixmap(0, pixmap ); int arrow = path.find( "->" ); if (arrow > 0 ) { - kind += path.mid( arrow ); _path = path.left(arrow); } setText(1, _path ); setText(2, size ); setText(3, date ); setText(4, kind ); m_isDir = isDir; m_dir = dir; m_locked = isLocked; } OFileSelectorItem::~OFileSelectorItem() { } bool OFileSelectorItem::isLocked()const { return m_locked; } QString OFileSelectorItem::directory()const { return m_dir; } bool OFileSelectorItem::isDir()const { return m_isDir; } QString OFileSelectorItem::path()const { return text( 1 ); } QString OFileSelectorItem::key( int id, bool )const { QString ke; if( id == 0 || id == 1 ){ // name if( m_isDir ){ ke.append("0" ); ke.append( text(1) ); }else{ ke.append("1" ); ke.append( text(1) ); } return ke; } else if ( id == 2 ) { QString sort = "00000000"; sort = sort.left( 9-text( 2 ).length()) + text( 2 ); return sort; } else return text( id ); } OFileViewFileListView::OFileViewFileListView( QWidget* parent, const QString& startDir, OFileSelector* sel) @@ -246,99 +247,99 @@ OFileViewFileListView::OFileViewFileListView( QWidget* parent, const QString& st btn = new QToolButton( box ); btn->setIconSet( Resource::loadPixmap("DocsIcon") ); connect(btn, SIGNAL(clicked() ), this, SLOT(cdDoc() ) ); m_btnNew = new QToolButton( box ); m_btnNew->setIconSet( Resource::loadPixmap("new") ); connect(m_btnNew, SIGNAL(clicked() ), this, SLOT(slotNew() ) ); m_btnClose = new QToolButton( box ); m_btnClose->setIconSet( Resource::loadPixmap("close") ); connect(m_btnClose, SIGNAL(clicked() ), selector(), SIGNAL(closeMe() ) ); btn = new QToolButton( box ); btn->setIconSet( Resource::loadPixmap("cardmon/pcmcia") ); /* let's fill device parts */ QPopupMenu* pop = new QPopupMenu(this); connect(pop, SIGNAL( activated(int) ), this, SLOT(slotFSActivated(int) ) ); 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_dev.insert( disk, path ); pop->insertItem( disk ); } m_fsPop = pop; btn->setPopup( pop ); btn->setPopupDelay ( 0 ); lay->addWidget( box ); m_view = new QListView( this ); m_view->installEventFilter(this); QPEApplication::setStylusOperation( m_view->viewport(), QPEApplication::RightOnHold); m_view->addColumn(" " ); - m_view->addColumn(i18n("Name"), 135 ); + m_view->addColumn(i18n("Name"), 150 ); m_view->addColumn(i18n("Size"), -1 ); - m_view->addColumn(i18n("Date"), 60 ); + m_view->addColumn(i18n("Date"), -1 ); m_view->addColumn(i18n("Mime Type"), -1 ); m_view->setSorting( 1 ); m_view->setAllColumnsShowFocus( TRUE ); lay->addWidget( m_view, 1000 ); connectSlots(); } OFileViewFileListView::~OFileViewFileListView() { } void OFileViewFileListView::slotNew() { DocLnk lnk; emit selector()->newSelected( lnk ); } OFileSelectorItem* OFileViewFileListView::currentItem()const{ QListViewItem* item = m_view->currentItem(); if (!item ) return 0l; return static_cast<OFileSelectorItem*>(item); } void OFileViewFileListView::reread( bool all ) { m_view->clear(); if (selector()->showClose() ) m_btnClose->show(); else m_btnClose->hide(); if (selector()->showNew() ) m_btnNew->show(); else m_btnNew->hide(); m_mimes = selector()->currentMimeType(); m_all = all; QDir dir( m_currentDir ); if (!dir.exists() ) return; topLevelWidget()->setCaption( dir.path() ); dir.setSorting( QDir::Name | QDir::DirsFirst | QDir::Reversed ); int filter; if (m_all ) filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All; else filter = QDir::Files | QDir::Dirs | QDir::All; |