Summary: | Allow selection and copy in the application output view | ||
---|---|---|---|
Product: | [Applications] kdevelop | Reporter: | Jon Smirl <jonsmirl> |
Component: | Output Views | Assignee: | kdevelop-bugs-null |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | CC: | greatbunzinni, pupeno, ugo.riboni |
Priority: | NOR | ||
Version: | git master | ||
Target Milestone: | --- | ||
Platform: | RedHat Enterprise Linux | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Jon Smirl
2003-07-03 06:41:35 UTC
Application window is an output view *** Bug 65866 has been marked as a duplicate of this bug. *** 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? QTextEdit is not that necessary. I think we should use embedded konsole for that. It has anything - copy, paste, etc. 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? 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? 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? I also miss the ability to select the application output. ... 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 ..." *** Bug 112396 has been marked as a duplicate of this bug. *** *** Bug 109165 has been marked as a duplicate of this bug. *** 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. We can still have "copy". 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); |