author | zautrix <zautrix> | 2005-02-05 12:03:42 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-05 12:03:42 (UTC) |
commit | f5902d0e08e0b10321c555e8846a8a8ce2087d30 (patch) (unidiff) | |
tree | 5aeaa9689b3161867fb0c8707adc5908b5072f06 /microkde | |
parent | 86c0d35262454a31ed7d50d3e20cbdace954ebdf (diff) | |
download | kdepimpi-f5902d0e08e0b10321c555e8846a8a8ce2087d30.zip kdepimpi-f5902d0e08e0b10321c555e8846a8a8ce2087d30.tar.gz kdepimpi-f5902d0e08e0b10321c555e8846a8a8ce2087d30.tar.bz2 |
file selector fix
-rw-r--r-- | microkde/kfiledialog.cpp | 2 | ||||
-rw-r--r-- | microkde/ofileselector_p.cpp | 28 | ||||
-rw-r--r-- | microkde/ofileselector_p.h | 1 |
3 files changed, 30 insertions, 1 deletions
diff --git a/microkde/kfiledialog.cpp b/microkde/kfiledialog.cpp index 977499e..309f8dc 100644 --- a/microkde/kfiledialog.cpp +++ b/microkde/kfiledialog.cpp | |||
@@ -21,8 +21,9 @@ QString KFileDialog::getSaveFileName( const QString & fn, | |||
21 | if ( file.isEmpty() ) | 21 | if ( file.isEmpty() ) |
22 | file = QDir::homeDirPath()+"/*"; | 22 | file = QDir::homeDirPath()+"/*"; |
23 | QFileInfo fi ( file ); | 23 | QFileInfo fi ( file ); |
24 | OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Save, fi.dirPath(true), fi.fileName() ); | 24 | OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Save, fi.dirPath(true), fi.fileName() ); |
25 | QObject::connect ( &o, SIGNAL( ok() ), &dia, SLOT ( accept () ) ); | ||
25 | lay.addWidget( &o); | 26 | lay.addWidget( &o); |
26 | // o.setNewVisible( true ); | 27 | // o.setNewVisible( true ); |
27 | // o.setNameVisible( true ); | 28 | // o.setNameVisible( true ); |
28 | dia.showMaximized(); | 29 | dia.showMaximized(); |
@@ -46,8 +47,9 @@ QString KFileDialog::getOpenFileName( const QString & fn, | |||
46 | if ( file.isEmpty() ) | 47 | if ( file.isEmpty() ) |
47 | file = QDir::homeDirPath()+"/*";; | 48 | file = QDir::homeDirPath()+"/*";; |
48 | QFileInfo fi ( file ); | 49 | QFileInfo fi ( file ); |
49 | OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Open, fi.dirPath(true), fi.fileName() ); | 50 | OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Open, fi.dirPath(true), fi.fileName() ); |
51 | QObject::connect ( &o, SIGNAL( ok() ), &dia, SLOT ( accept () ) ); | ||
50 | lay.addWidget( &o); | 52 | lay.addWidget( &o); |
51 | dia.showMaximized(); | 53 | dia.showMaximized(); |
52 | int res = dia.exec(); | 54 | int res = dia.exec(); |
53 | if ( res ) | 55 | if ( res ) |
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 | |||
@@ -384,15 +384,17 @@ OFileSelector* OFileViewFileListView::selector() { | |||
384 | return m_sel; | 384 | return m_sel; |
385 | } | 385 | } |
386 | 386 | ||
387 | bool OFileViewFileListView::eventFilter (QObject *o, QEvent *e) { | 387 | bool OFileViewFileListView::eventFilter (QObject *o, QEvent *e) { |
388 | #if 0 | ||
388 | if ( e->type() == QEvent::KeyPress ) { | 389 | if ( e->type() == QEvent::KeyPress ) { |
389 | QKeyEvent *k = (QKeyEvent *)e; | 390 | QKeyEvent *k = (QKeyEvent *)e; |
390 | if ( (k->key()==Key_Enter) || (k->key()==Key_Return)) { | 391 | if ( (k->key()==Key_Enter) || (k->key()==Key_Return)) { |
391 | slotClicked( Qt::LeftButton,m_view->currentItem(),QPoint(0,0),0); | 392 | slotClicked( Qt::LeftButton,m_view->currentItem(),QPoint(0,0),0); |
392 | return true; | 393 | return true; |
393 | } | 394 | } |
394 | } | 395 | } |
396 | #endif | ||
395 | return false; | 397 | return false; |
396 | } | 398 | } |
397 | 399 | ||
398 | 400 | ||
@@ -400,8 +402,12 @@ void OFileViewFileListView::connectSlots() { | |||
400 | connect(m_view, SIGNAL(clicked(QListViewItem*) ), | 402 | connect(m_view, SIGNAL(clicked(QListViewItem*) ), |
401 | this, SLOT(slotCurrentChanged(QListViewItem*) ) ); | 403 | this, SLOT(slotCurrentChanged(QListViewItem*) ) ); |
402 | connect(m_view, SIGNAL(mouseButtonClicked(int, QListViewItem*, const QPoint&, int ) ), | 404 | connect(m_view, SIGNAL(mouseButtonClicked(int, QListViewItem*, const QPoint&, int ) ), |
403 | this, SLOT(slotClicked(int, QListViewItem*, const QPoint&, int ) ) ); | 405 | this, SLOT(slotClicked(int, QListViewItem*, const QPoint&, int ) ) ); |
406 | connect(m_view, SIGNAL(doubleClicked( QListViewItem* )), | ||
407 | this, SLOT(slotDoubleClicked(QListViewItem* ) ) ); | ||
408 | connect(m_view, SIGNAL(returnPressed( QListViewItem* )), | ||
409 | this, SLOT(slotDoubleClicked(QListViewItem* ) ) ); | ||
404 | } | 410 | } |
405 | void OFileViewFileListView::slotCurrentChanged( QListViewItem* item) { | 411 | void OFileViewFileListView::slotCurrentChanged( QListViewItem* item) { |
406 | if (!item) | 412 | if (!item) |
407 | return; | 413 | return; |
@@ -422,8 +428,28 @@ void OFileViewFileListView::slotCurrentChanged( QListViewItem* item) { | |||
422 | } | 428 | } |
423 | } | 429 | } |
424 | #endif | 430 | #endif |
425 | } | 431 | } |
432 | void OFileViewFileListView::slotDoubleClicked(QListViewItem* item ) { | ||
433 | if (!item ) return; | ||
434 | OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); | ||
435 | if (!sel->isLocked() ) { | ||
436 | QStringList str = QStringList::split("->", sel->text(1) ); | ||
437 | if (sel->isDir() ) { | ||
438 | m_currentDir = sel->directory() + "/" + str[0].stripWhiteSpace(); | ||
439 | emit selector()->dirSelected( m_currentDir ); | ||
440 | reread( m_all ); | ||
441 | }else { // file | ||
442 | //qWarning("slot Clicked"); | ||
443 | selector()->m_lneEdit->setText( str[0].stripWhiteSpace() ); | ||
444 | QString path = sel->directory() + "/" + str[0].stripWhiteSpace(); | ||
445 | emit selector()->fileSelected( path ); | ||
446 | DocLnk lnk( path ); | ||
447 | emit selector()->fileSelected( lnk ); | ||
448 | emit selector()->ok(); | ||
449 | } | ||
450 | } // not locked | ||
451 | } | ||
426 | void OFileViewFileListView::slotClicked(int button , QListViewItem* item, const QPoint&, int ) { | 452 | void OFileViewFileListView::slotClicked(int button , QListViewItem* item, const QPoint&, int ) { |
427 | if (!item || ( button != Qt::LeftButton) ) | 453 | if (!item || ( button != Qt::LeftButton) ) |
428 | return; | 454 | return; |
429 | 455 | ||
@@ -434,9 +460,9 @@ void OFileViewFileListView::slotClicked(int button , QListViewItem* item, const | |||
434 | m_currentDir = sel->directory() + "/" + str[0].stripWhiteSpace(); | 460 | m_currentDir = sel->directory() + "/" + str[0].stripWhiteSpace(); |
435 | emit selector()->dirSelected( m_currentDir ); | 461 | emit selector()->dirSelected( m_currentDir ); |
436 | reread( m_all ); | 462 | reread( m_all ); |
437 | }else { // file | 463 | }else { // file |
438 | qWarning("slot Clicked"); | 464 | //qWarning("slot Clicked"); |
439 | selector()->m_lneEdit->setText( str[0].stripWhiteSpace() ); | 465 | selector()->m_lneEdit->setText( str[0].stripWhiteSpace() ); |
440 | QString path = sel->directory() + "/" + str[0].stripWhiteSpace(); | 466 | QString path = sel->directory() + "/" + str[0].stripWhiteSpace(); |
441 | emit selector()->fileSelected( path ); | 467 | emit selector()->fileSelected( path ); |
442 | DocLnk lnk( path ); | 468 | DocLnk lnk( path ); |
diff --git a/microkde/ofileselector_p.h b/microkde/ofileselector_p.h index b371806..834fd70 100644 --- a/microkde/ofileselector_p.h +++ b/microkde/ofileselector_p.h | |||
@@ -125,8 +125,9 @@ private slots: | |||
125 | void cdDoc(); | 125 | void cdDoc(); |
126 | void changeDir( const QString& ); | 126 | void changeDir( const QString& ); |
127 | void slotCurrentChanged( QListViewItem* ); | 127 | void slotCurrentChanged( QListViewItem* ); |
128 | void slotClicked(int, QListViewItem*, const QPoint&, int ); | 128 | void slotClicked(int, QListViewItem*, const QPoint&, int ); |
129 | void slotDoubleClicked(QListViewItem*); | ||
129 | void slotFSActivated(int); | 130 | void slotFSActivated(int); |
130 | 131 | ||
131 | protected: | 132 | protected: |
132 | 133 | ||