summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik Haumann <dhaumann@kde.org>2014-01-22 12:27:04 (GMT)
committerDominik Haumann <dhaumann@kde.org>2014-01-22 12:27:04 (GMT)
commit3255ca929dd82e70a907cca66454e3a809c431bc (patch)
tree718adc20166aa697bd3616c6f6304dc39ff6103f
parent3ff416ea03d1f5e79a15da40793e0fd91c68bf52 (diff)
revert: Even more quick way to switch to a previous document
This commit introduced too many regressions, e.g. the action View > Quick Open did not work anymore Revert: Even more quick way to switch to a previous document: show opened docs list (project files) only if user holds a `Ctrl` for awhile (~200ms), otherwise just quick-quick-switch to a previous document w/o flikering w/ widgets... CCBUG: 324348
-rw-r--r--kate/app/katemainwindow.cpp32
-rw-r--r--kate/app/katemainwindow.h17
-rw-r--r--kate/app/katequickopen.cpp19
-rw-r--r--kate/app/katequickopen.h14
4 files changed, 18 insertions, 64 deletions
diff --git a/kate/app/katemainwindow.cpp b/kate/app/katemainwindow.cpp
index 3be7e27..2edb479 100644
--- a/kate/app/katemainwindow.cpp
+++ b/kate/app/katemainwindow.cpp
@@ -321,7 +321,7 @@ void KateMainWindow::setupActions()
scuts << QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_O)
<< QKeySequence(Qt::CTRL + Qt::Key_Tab);
a->setShortcuts(scuts);
- connect( a, SIGNAL(triggered()), this, SLOT(slotPreQuickOpen()) );
+ connect( a, SIGNAL(triggered()), this, SLOT(slotQuickOpen()) );
a->setWhatsThis(i18n("Open a form to quick open documents."));
KToggleAction* showFullScreenAction = KStandardAction::fullScreen( 0, 0, this, this);
@@ -1002,33 +1002,15 @@ QObject *KateMainWindow::pluginView (const QString &name)
return m_pluginViews.contains(plugin) ? m_pluginViews.value (plugin) : 0;
}
-/**
- * just wait a little to make sure that user intended to see
- * a documents list and (still) holds a \c Ctrl key to indicate that...
- */
-void KateMainWindow::slotPreQuickOpen ()
-{
- QTimer::singleShot(200, this, SLOT(slotQuickOpen()));
-}
-
-/**
- * show quick open and pass focus to it if \c Ctrl key still pressed,
- * otherwise just switch to a previous document quickly!
- */
void KateMainWindow::slotQuickOpen ()
{
+ /**
+ * show quick open and pass focus to it
+ */
m_quickOpen->update ();
- Qt::KeyboardModifiers mod = QApplication::keyboardModifiers ();
- if (mod & Qt::ControlModifier)
- {
- m_mainStackedWidget->setCurrentWidget (m_quickOpen);
- centralWidget()->setFocusProxy (m_quickOpen);
- m_quickOpen->setFocus ();
- }
- else
- {
- m_quickOpen->justSwitchToPreviousDocument ();
- }
+ m_mainStackedWidget->setCurrentWidget (m_quickOpen);
+ centralWidget()->setFocusProxy (m_quickOpen);
+ m_quickOpen->setFocus ();
}
QWidget *KateMainWindow::createToolView (KTextEditor::Plugin *plugin, const QString &identifier, KTextEditor::MainWindow::ToolViewPosition pos, const QIcon &icon, const QString &text)
diff --git a/kate/app/katemainwindow.h b/kate/app/katemainwindow.h
index 9ab96fe..edf439c 100644
--- a/kate/app/katemainwindow.h
+++ b/kate/app/katemainwindow.h
@@ -168,9 +168,14 @@ class KateMainWindow : public KateMDI::MainWindow, virtual public KParts::PartBa
void queueModifiedOnDisc(KTextEditor::Document *doc);
/**
- * slots used for actions in the menus/toolbars
- * or internal signal connections
+ * Show quick open
*/
+ void slotQuickOpen ();
+
+ /**
+ * slots used for actions in the menus/toolbars
+ * or internal signal connections
+ */
private Q_SLOTS:
void newWindow ();
@@ -187,12 +192,6 @@ class KateMainWindow : public KateMDI::MainWindow, virtual public KParts::PartBa
void editKeys();
void mSlotFixOpenWithMenu();
- /**
- * Show quick open
- */
- void slotPreQuickOpen ();
- void slotQuickOpen ();
-
/* to update the caption */
void slotDocumentCreated (KTextEditor::Document *doc);
void updateCaption (KTextEditor::Document *doc);
@@ -429,7 +428,7 @@ class KateMainWindow : public KateMDI::MainWindow, virtual public KParts::PartBa
* quick open to fast switch documents
*/
KateQuickOpen *m_quickOpen;
-
+
/**
* keeps track of views
*/
diff --git a/kate/app/katequickopen.cpp b/kate/app/katequickopen.cpp
index d8c657d..e73e0f4 100644
--- a/kate/app/katequickopen.cpp
+++ b/kate/app/katequickopen.cpp
@@ -271,32 +271,17 @@ void KateQuickOpen::update ()
m_listView->resizeColumnToContents(0);
}
-/**
- * just quick switch to a previous document without displaying any list
- */
-void KateQuickOpen::justSwitchToPreviousDocument ()
-{
- if (m_model->hasIndex(1, 0)) {
- switchTo(m_model->index(1, 0));
- }
-}
-
void KateQuickOpen::slotReturnPressed ()
{
- switchTo(m_listView->currentIndex());
-}
-
-void KateQuickOpen::switchTo (const QModelIndex& index)
-{
/**
* open document for first element, if possible
* prefer to use the document pointer
*/
- KTextEditor::Document *doc = index.data(DocumentRole).value<QPointer<KTextEditor::Document> >();
+ KTextEditor::Document *doc = m_listView->currentIndex().data(DocumentRole).value<QPointer<KTextEditor::Document> >();
if (doc) {
m_mainWindow->wrapper()->activateView (doc);
} else {
- QUrl url = index.data(UrlRole).value<QUrl>();
+ QUrl url = m_listView->currentIndex().data(UrlRole).value<QUrl>();
if (!url.isEmpty())
m_mainWindow->wrapper()->openUrl (url);
}
diff --git a/kate/app/katequickopen.h b/kate/app/katequickopen.h
index b7aeeca..b02cca3 100644
--- a/kate/app/katequickopen.h
+++ b/kate/app/katequickopen.h
@@ -22,15 +22,13 @@
#include <QWidget>
-class QTreeView;
-class KLineEdit;
class KateMainWindow;
class KLineEdit;
-class QListView;
class QModelIndex;
class QStandardItemModel;
class QSortFilterProxyModel;
+class QTreeView;
class KateQuickOpen : public QWidget {
Q_OBJECT
@@ -42,11 +40,6 @@ class KateQuickOpen : public QWidget {
*/
void update ();
- /**
- * super fast quick switch
- */
- void justSwitchToPreviousDocument ();
-
protected:
bool eventFilter(QObject *obj, QEvent *event);
@@ -59,11 +52,6 @@ class KateQuickOpen : public QWidget {
*/
void slotReturnPressed ();
- /**
- * Switch to a document with given index
- */
- void switchTo (const QModelIndex&);
-
private:
KateMainWindow *m_mainWindow;
QTreeView *m_listView;