[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/kfile
From:       David Faure <faure () kde ! org>
Date:       2010-10-28 22:52:18
Message-ID: 20101028225218.CB737AC899 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1190805 by dfaure:

Remove more code so that double-clicking on a file (in double-click mode) doesn't \
select the file + the dir + the dir again, in KFile::Files | KFile::Directory mode. \
The activated() signal is indeed enough, no need to do anything about double-click \
explicitely anywhere.

Tested with the "bug 173137" testcase in kfiledialogtest, in single-click and \
double-click mode, and testing  with click + Ok, Key_Enter, double-click. Hope I \
didn't miss anything.

The bug was already marked as fixed, but double-click global setting was probably not \
                tested back then. Reported by xdarklight.
CCBUG: 173137


 M  +0 -39     kdiroperator.cpp  
 M  +2 -2      kdiroperator.h  
 M  +0 -11     kfilewidget.cpp  
 M  +0 -1      kfilewidget.h  


--- trunk/KDE/kdelibs/kfile/kdiroperator.cpp #1190804:1190805
@@ -232,9 +232,7 @@
     void _k_slotCanceled();
     void _k_slotRedirected(const KUrl&);
     void _k_slotProperties();
-    void _k_slotPressed(const QModelIndex&);
     void _k_slotActivated(const QModelIndex&);
-    void _k_slotDoubleClicked(const QModelIndex&);
     void _k_slotSelectionChanged();
     void _k_openContextMenu(const QPoint&);
     void _k_triggerPreview(const QModelIndex&);
@@ -285,7 +283,6 @@
     KUrl previewUrl;
     int previewWidth;
 
-    bool leftButtonPressed;
     bool dirHighlighting;
     bool onlyDoubleClickSelectsFiles;
     QString lastURL; // used for highlighting a directory on cdUp
@@ -325,7 +322,6 @@
     preview(0),
     previewUrl(),
     previewWidth(0),
-    leftButtonPressed(false),
     dirHighlighting(false),
     onlyDoubleClickSelectsFiles(!KGlobalSettings::singleClick()),
     progressDelayTimer(0),
@@ -1594,10 +1590,6 @@
 
     connect(d->itemView, SIGNAL(activated(const QModelIndex&)),
             this, SLOT(_k_slotActivated(const QModelIndex&)));
-    connect(d->itemView, SIGNAL(doubleClicked(const QModelIndex&)),
-            this, SLOT(_k_slotDoubleClicked(const QModelIndex&)));
-    connect(d->itemView, SIGNAL(pressed(const QModelIndex&)),
-            this, SLOT(_k_slotPressed(const QModelIndex&)));
     connect(d->itemView, SIGNAL(customContextMenuRequested(const QPoint&)),
             this, SLOT(_k_openContextMenu(const QPoint&)));
     connect(d->itemView, SIGNAL(entered(const QModelIndex&)),
@@ -2357,16 +2349,6 @@
     }
 }
 
-void KDirOperator::Private::_k_slotPressed(const QModelIndex&)
-{
-    // Remember whether the left mouse button has been pressed, to prevent
-    // that a right-click on an item opens an item (see _k_slotDoubleClicked() and
-    // _k_openContextMenu()).
-    const Qt::KeyboardModifiers modifiers = QApplication::keyboardModifiers();
-    leftButtonPressed = (QApplication::mouseButtons() & Qt::LeftButton) &&
-                        !(modifiers & Qt::ShiftModifier) && !(modifiers & \
                Qt::ControlModifier);
-}
-
 void KDirOperator::Private::_k_slotActivated(const QModelIndex& index)
 {
     const QModelIndex dirIndex = proxyModel->mapToSource(index);
@@ -2383,25 +2365,6 @@
     }
 }
 
-void KDirOperator::Private::_k_slotDoubleClicked(const QModelIndex& index)
-{
-    if (!leftButtonPressed) {
-        return;
-    }
-
-    const QModelIndex dirIndex = proxyModel->mapToSource(index);
-    KFileItem item = dirModel->itemForIndex(dirIndex);
-
-    if (item.isNull())
-        return;
-
-    if (item.isDir()) {
-        parent->selectDir(item);
-    } else {
-        parent->selectFile(item);
-    }
-}
-
 void KDirOperator::Private::_k_slotSelectionChanged()
 {
     if (itemView == 0) {
@@ -2425,8 +2388,6 @@
 
 void KDirOperator::Private::_k_openContextMenu(const QPoint& pos)
 {
-    leftButtonPressed = false;
-
     const QModelIndex proxyIndex = itemView->indexAt(pos);
     const QModelIndex dirIndex = proxyModel->mapToSource(proxyIndex);
     KFileItem item = dirModel->itemForIndex(dirIndex);
--- trunk/KDE/kdelibs/kfile/kdiroperator.h #1190804:1190805
@@ -470,6 +470,8 @@
      * When argument is true, files and directories are highlighted with single \
                click and
      * selected (executed) with double click.
      *
+     * NOTE: this is not implemented in KDE 4 yet
+     *
      * The default follows the signle/double click system setting.
      */
     void setOnlyDoubleClickSelectsFiles(bool enable);
@@ -908,9 +910,7 @@
     Q_PRIVATE_SLOT( d, void _k_slotCanceled() )
     Q_PRIVATE_SLOT( d, void _k_slotRedirected(const KUrl&) )
     Q_PRIVATE_SLOT( d, void _k_slotProperties() )
-    Q_PRIVATE_SLOT( d, void _k_slotPressed(const QModelIndex&) )
     Q_PRIVATE_SLOT( d, void _k_slotActivated(const QModelIndex&) )
-    Q_PRIVATE_SLOT( d, void _k_slotDoubleClicked(const QModelIndex&) )
     Q_PRIVATE_SLOT( d, void _k_slotSelectionChanged() )
     Q_PRIVATE_SLOT( d, void _k_openContextMenu(const QPoint&) )
     Q_PRIVATE_SLOT( d, void _k_triggerPreview(const QModelIndex&) )
--- trunk/KDE/kdelibs/kfile/kfilewidget.cpp #1190804:1190805
@@ -186,7 +186,6 @@
     void _k_zoomInIconsSize();
     void _k_slotIconSizeSliderMoved(int);
     void _k_slotIconSizeChanged(int);
-    void _k_slotViewDoubleClicked(const QModelIndex&);
 
     void addToRecentDocuments();
 
@@ -1741,8 +1740,6 @@
         d->ops->setView( KFile::Default );
         d->ops->view()->setSizePolicy( QSizePolicy( QSizePolicy::Maximum, \
QSizePolicy::Maximum ) );  d->hasView = true;
-
-        connect(d->ops->view(), SIGNAL(doubleClicked(QModelIndex)), this, \
SLOT(_k_slotViewDoubleClicked(QModelIndex)));  }
     d->ops->clearHistory();
 
@@ -2058,14 +2055,6 @@
     QApplication::sendEvent(iconSizeSlider, &toolTipEvent);
 }
 
-void KFileWidgetPrivate::_k_slotViewDoubleClicked(const QModelIndex &index)
-{
-    if (!index.isValid()) {
-        return;
-    }
-    q->slotOk();
-}
-
 static QString getExtensionFromPatternList(const QStringList &patternList)
 {
 //     kDebug(kfile_area);
--- trunk/KDE/kdelibs/kfile/kfilewidget.h #1190804:1190805
@@ -523,7 +523,6 @@
     Q_PRIVATE_SLOT(d, void _k_zoomInIconsSize())
     Q_PRIVATE_SLOT(d, void _k_slotIconSizeSliderMoved(int))
     Q_PRIVATE_SLOT(d, void _k_slotIconSizeChanged(int))
-    Q_PRIVATE_SLOT(d, void _k_slotViewDoubleClicked(const QModelIndex&))
 };
 
 #endif /* KABSTRACTFILEWIDGET_H */


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic