Summary: | Grep dialog doesn't prepopulate with selected text | ||
---|---|---|---|
Product: | [Developer tools] kdevplatform | Reporter: | Dan Christensen <daniel_l_christensen> |
Component: | grepview | Assignee: | KDevelop Developers <kdevelop-devel> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | 1.3.0 | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: |
Patch
Updated patch |
Description
Dan Christensen
2004-01-13 03:30:38 UTC
Created attachment 4132 [details]
Patch
Here is a suggested patch.
Nice patch. But the file is written with four spaces indentention, why did you use three spaces in the patch? The rule is look at the code surrounding the are you want to patch. And then use the same type (2 spaces, 4 spaces, tabs or whatever) Thanks for the patch Now in english :) Nice patch. But the file is written with four spaces indentention, why did you use three spaces in your patch? The rule is to look at the code surrounding the area you want to patch. And then use the same type (2 spaces, 4 spaces, tabs or whatever) of indentation. Sorry about that. I thought that I had matched the style of the file. I guess I wasn't paying close enough attention. Created attachment 4147 [details]
Updated patch
I've updated the patch to use the correct indentation style
Thanks, we'll commit it as soon as CVS is unfrozen. :) Subject: kdevelop/parts/grepview CVS commit by dagerbo: Commit suggested patch for bug 72523. Thanks to Dan Christensen for the patch. CCMAIL: 72523-done@bugs.kde.org M +17 -0 grepviewwidget.cpp 1.26 --- kdevelop/parts/grepview/grepviewwidget.cpp #1.25:1.26 @@ -17,4 +17,7 @@ #include <klocale.h> #include <kprocess.h> +#include <kparts/part.h> +#include <ktexteditor/selectioninterface.h> +using namespace KTextEditor; #include "kdevcore.h" @@ -119,4 +122,18 @@ GrepViewWidget::~GrepViewWidget() void GrepViewWidget::showDialog() { + // Get the selected text if there is any + KParts::ReadOnlyPart *ro_part = dynamic_cast<KParts::ReadOnlyPart*>(m_part->partController()->activePart()); + if (ro_part) + { + SelectionInterface *selectIface = dynamic_cast<SelectionInterface*>(ro_part); + if(selectIface && selectIface->hasSelection()) + { + QString selText = selectIface->selection(); + if(!selText.contains('\n')) + { + grepdlg->setPattern(selText); + } + } + } grepdlg->show(); } |