Bug 60671 - Allow selection and copy in the application output view
Summary: Allow selection and copy in the application output view
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: Output Views (show other bugs)
Version: git master
Platform: RedHat Enterprise Linux Linux
: NOR wishlist
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
: 65866 112396 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-07-03 06:41 UTC by Jon Smirl
Modified: 2007-01-07 21:07 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jon Smirl 2003-07-03 06:41:35 UTC
Version:           CVS (using KDE KDE 3.1)
Installed from:    RedHat RPMs

The Application window in the debugger should allow selection and copy. There should also be some way to clear it so that I don't get confused about the output from consecutive runs. Maybe right click menu with clear/copy option?
Comment 1 Amilcar do Carmo Lucas 2003-11-01 19:11:31 UTC
Application window is an output view
Comment 2 Amilcar do Carmo Lucas 2003-11-04 14:38:19 UTC
*** Bug 65866 has been marked as a duplicate of this bug. ***
Comment 3 Daniel Franke 2004-03-31 05:47:23 UTC
See #60058 for a patch to clear outputview.
(Additionally adding a copy-option should not be that difficult) 

Currently the application view is basicly a QListView, selection mode is single. Other views (messages, diff) are basicly QTextEdit.
Considering #60058, #60671 (this one) and #72076 together, it might be advisable to switch application view to QTextEdit also and re-use some of the functionality of message view?
Comment 4 Alexander Dymo 2004-03-31 19:38:47 UTC
QTextEdit is not that necessary. I think we should use embedded konsole for that. It has anything - copy, paste, etc.
Comment 5 Daniel Franke 2004-03-31 20:31:49 UTC
You are not talking about parts/konsole, do you?

If you do: your suggestion is to replace the current outputview by a (more or less restricted) konsolepart?
Comment 6 Alexander Dymo 2004-03-31 22:38:36 UTC
I'm talking about replacing QListView with widget provided by KonsolePart. It would look like similar to parts/konsole, of course.
Btw, what restrictions in konsolepart do you see?
Comment 7 Daniel Franke 2004-04-01 05:06:24 UTC
I'm not too familiar neither with kdevelop sources nor with KParts, so please correct me if I'm wrong:

Let's assume the QListView derived widget is replaced by a widget created by konsolpart. When using parts/konsole as a template, this will result in just another konsole - ups, we didn't ask for that?!

Alexander, if I understand your suggestion correctly, by using konsolepart you imply the following behaviour:
 * an empty application view at startup (no prompt)
 * the app may be executed within this konsole, external terminal not necessary
 * tools may be run within/from this console to gather their output
 * inactive state: either clear or display last messages

Requested features:
 a. application view should allow to be cleared (#60058)
 b. multi-line selection and copy-paste support (#60671)
 c. open corresponding sourcefile if a output-line has file- and line information (#72076) 

Also nice to have:
 d. distinguish between cout/cerr (cin?) by different highlighting
 e. output filter: cout/cerr (similar to very/short/full output of messages view)
 f. [together with (c)] output formats of tools may differ significantly, user-defined pattern-matching might be reasonable (in addition to capture-output-flag in tools menu)?

As far as I can see it:
Konsolepart provides (b), (a) might be achieved by submitting the "clear" statement, (c) if and only if the output if buffered, assumably it is (buffer access?). 
[Assumption:] Most likely it will not be possible to handle (d) and (e) with konsolepart as kdevelop will never "see" the output, it will be written by the konsole itself and will not be handled by the application view. 

Therefore my suggestion: use makeviewpart/makewidget as template to implement an application view that provides above features, since most of these features have already been implemented there.


Do you agree with this? Objections? Suggestions?
Comment 8 Paulo Moura Guedes 2004-12-10 23:36:23 UTC
I also miss the ability to select the application output.
Comment 9 Jordi Blasi 2005-03-10 11:03:31 UTC
... but never forget the current implemented feature "Filter Output" : "Filter for string" and "Filter for regular expresion" [in 3.2.0 RC1].

Missing also "Copy", "Select All" and "Save as ..."
Comment 10 Jens Dagerbo 2006-12-30 04:58:32 UTC
*** Bug 112396 has been marked as a duplicate of this bug. ***
Comment 11 Jens Dagerbo 2006-12-30 04:59:50 UTC
*** Bug 109165 has been marked as a duplicate of this bug. ***
Comment 12 Jens Dagerbo 2007-01-07 14:47:56 UTC
Since selection isn't possible in this widget and the output can be rather huge, I didn't want to make a "Copy" action. There is however now a save to file feature (both filtered and unfiltered) so I consider this fixed.
Comment 13 Alexander Dymo 2007-01-07 21:06:55 UTC
We can still have "copy".
Comment 14 Alexander Dymo 2007-01-07 21:07:34 UTC
SVN commit 620932 by dymo:

Applied patch from Andras Mantia: add "copy selection" action to the application output context menu.
BUG: 60671


 M  +17 -1     appoutputwidget.cpp  
 M  +1 -0      appoutputwidget.h  


--- branches/kdevelop/3.4/parts/outputviews/appoutputwidget.cpp #620931:620932
@@ -20,6 +20,7 @@
 #include <qradiobutton.h>
 #include <qfile.h>
 #include <qtextstream.h>
+#include <qclipboard.h>
 
 #include <klocale.h>
 #include <kdebug.h>
@@ -45,6 +46,7 @@
 	KConfig *config = kapp->config();
 	config->setGroup("General Options");
 	setFont(config->readFontEntry("OutputViewFont"));
+  setSelectionMode(QListBox::Extended);
 }
 
 void AppOutputWidget::clearViewAndContents()
@@ -225,8 +227,10 @@
 
 	int id = popup.insertItem( i18n("Clear output"), this, SLOT(clearViewAndContents()) );
 	popup.setItemEnabled( id, m_contentList.size() > 0 );
-	popup.insertSeparator();
 
+  popup.insertItem( i18n("Copy selected lines"), this, SLOT(copySelected()) );
+  popup.insertSeparator();
+
 	popup.insertItem( i18n("Save unfiltered"), this, SLOT(saveAll()) );
 	id = popup.insertItem( i18n("Save filtered output"), this, SLOT(saveFiltered()) );
 	popup.setItemEnabled( id, m_filter.m_isActive );
@@ -300,4 +304,16 @@
 	}
 }
 
+void AppOutputWidget::copySelected()
+{
+  uint n = count();
+  QString buffer;
+  for (uint i = 0; i < n; i++)
+  {
+    if (isSelected(i))
+      buffer += item(i)->text() + "\n";
+  }
+  kapp->clipboard()->setText(buffer, QClipboard::Clipboard);
+}
+
 #include "appoutputwidget.moc"
--- branches/kdevelop/3.4/parts/outputviews/appoutputwidget.h #620931:620932
@@ -39,6 +39,7 @@
 	void editFilter();
 	void saveAll();
 	void saveFiltered();
+  void copySelected();
 
 private:
 	virtual void childFinished(bool normal, int status);