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

List:       kde-commits
Subject:    [kdevplatform] 97554eb: Make copyAction a local variable. Add Select
From:       Mantia Andras <amantia () kde ! org>
Date:       2010-07-07 4:45:02
Message-ID: 201007070445.o674j2xp020575 () kore ! kollide ! net
[Download RAW message or body]

commit 97554eb0b56dc815d0321e29fb92cfcea644d83c
Author: Mantia Andras <amantia@kde.org>
Date:   Wed Jul 7 07:58:11 2010 +0300

    Make copyAction a local variable. Add Select All action (without the shortcut for now)

diff --git a/plugins/standardoutputview/outputwidget.cpp b/plugins/standardoutputview/outputwidget.cpp
index be82b5b..dc8eeb7 100644
--- a/plugins/standardoutputview/outputwidget.cpp
+++ b/plugins/standardoutputview/outputwidget.cpp
@@ -88,8 +88,13 @@ OutputWidget::OutputWidget(QWidget* parent, ToolViewData* tvdata)
     separator->setSeparator(true);
     addAction(separator);
     
-    copyAction = KStandardAction::copy(this);
-//     copyAction->setShortcut(KShortcut());
+    KAction *selectAllAction = KStandardAction::selectAll(this);
+    selectAllAction->setShortcut(KShortcut()); //FIXME: why does CTRL-A conflict with Katepart (while CTRL-Cbelow doesn't) ?
+    selectAllAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
+    connect(selectAllAction, SIGNAL(triggered()), SLOT(selectAll()));
+    addAction(selectAllAction);
+
+    KAction *copyAction = KStandardAction::copy(this);
     copyAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
     connect(copyAction, SIGNAL(triggered()), SLOT(copySelection()));
     addAction(copyAction);
@@ -463,6 +468,18 @@ void OutputWidget::copySelection()
     cb->setText(content);
 }
 
+void OutputWidget::selectAll()
+{
+    QWidget* widget = currentWidget();
+    if( !widget )
+        return;
+    QAbstractItemView *view = dynamic_cast<QAbstractItemView*>(widget);
+    if( !view )
+        return;
+
+    view->selectAll();
+}
+
 
 
 #include "outputwidget.moc"
diff --git a/plugins/standardoutputview/outputwidget.h b/plugins/standardoutputview/outputwidget.h
index f316a08..eef3844 100644
--- a/plugins/standardoutputview/outputwidget.h
+++ b/plugins/standardoutputview/outputwidget.h
@@ -61,6 +61,7 @@ private slots:
     void previousOutput();
     void rowsInserted(const QModelIndex&, int, int);
     void copySelection();
+    void selectAll();
 
 private:
     QTreeView* createListView(int id);
@@ -76,7 +77,6 @@ private:
     QToolButton* m_closeButton;
     KAction* nextAction;
     KAction* previousAction;
-    KAction* copyAction;
     KToggleAction* activateOnSelect;
     KToggleAction* focusOnSelect;
 };
[prev in list] [next in list] [prev in thread] [next in thread] 

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