summaryrefslogtreecommitdiffabout
path: root/microkde/ofileselector_p.cpp
Side-by-side diff
Diffstat (limited to 'microkde/ofileselector_p.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/ofileselector_p.cpp28
1 files changed, 27 insertions, 1 deletions
diff --git a/microkde/ofileselector_p.cpp b/microkde/ofileselector_p.cpp
index fd5f965..f85f8f4 100644
--- a/microkde/ofileselector_p.cpp
+++ b/microkde/ofileselector_p.cpp
@@ -385,6 +385,7 @@ OFileSelector* OFileViewFileListView::selector() {
}
bool OFileViewFileListView::eventFilter (QObject *o, QEvent *e) {
+#if 0
if ( e->type() == QEvent::KeyPress ) {
QKeyEvent *k = (QKeyEvent *)e;
if ( (k->key()==Key_Enter) || (k->key()==Key_Return)) {
@@ -392,6 +393,7 @@ bool OFileViewFileListView::eventFilter (QObject *o, QEvent *e) {
return true;
}
}
+#endif
return false;
}
@@ -401,6 +403,10 @@ void OFileViewFileListView::connectSlots() {
this, SLOT(slotCurrentChanged(QListViewItem*) ) );
connect(m_view, SIGNAL(mouseButtonClicked(int, QListViewItem*, const QPoint&, int ) ),
this, SLOT(slotClicked(int, QListViewItem*, const QPoint&, int ) ) );
+ connect(m_view, SIGNAL(doubleClicked( QListViewItem* )),
+ this, SLOT(slotDoubleClicked(QListViewItem* ) ) );
+ connect(m_view, SIGNAL(returnPressed( QListViewItem* )),
+ this, SLOT(slotDoubleClicked(QListViewItem* ) ) );
}
void OFileViewFileListView::slotCurrentChanged( QListViewItem* item) {
if (!item)
@@ -423,6 +429,26 @@ void OFileViewFileListView::slotCurrentChanged( QListViewItem* item) {
}
#endif
}
+void OFileViewFileListView::slotDoubleClicked(QListViewItem* item ) {
+ if (!item ) return;
+ OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item);
+ if (!sel->isLocked() ) {
+ QStringList str = QStringList::split("->", sel->text(1) );
+ if (sel->isDir() ) {
+ m_currentDir = sel->directory() + "/" + str[0].stripWhiteSpace();
+ emit selector()->dirSelected( m_currentDir );
+ reread( m_all );
+ }else { // file
+ //qWarning("slot Clicked");
+ selector()->m_lneEdit->setText( str[0].stripWhiteSpace() );
+ QString path = sel->directory() + "/" + str[0].stripWhiteSpace();
+ emit selector()->fileSelected( path );
+ DocLnk lnk( path );
+ emit selector()->fileSelected( lnk );
+ emit selector()->ok();
+ }
+ } // not locked
+}
void OFileViewFileListView::slotClicked(int button , QListViewItem* item, const QPoint&, int ) {
if (!item || ( button != Qt::LeftButton) )
return;
@@ -435,7 +461,7 @@ void OFileViewFileListView::slotClicked(int button , QListViewItem* item, const
emit selector()->dirSelected( m_currentDir );
reread( m_all );
}else { // file
- qWarning("slot Clicked");
+ //qWarning("slot Clicked");
selector()->m_lneEdit->setText( str[0].stripWhiteSpace() );
QString path = sel->directory() + "/" + str[0].stripWhiteSpace();
emit selector()->fileSelected( path );