Menu

#17 execQuery() of selection / clipboard

closed
nobody
None
5
2015-06-05
2006-02-14
patjo
No

hi you!

Found your app and I liked it, I liked it a lot
...but...
at work I use the M$ equiv and it has this neat
feature that _if_ I select something in the editor
then only that code will be executed. Felt and
itch...
_
so... I made some changes to forms1.ui/execQuery()
which will:
1. check if anything is selected and use that _or_
2. if nothing is selected, check the
(global)clipboard ... and if it contents starts with
sql:// use that (discarding sql:// of course)
3. old behavior, take the complete text.

ok, the clipboard support is maybe out-there
but...the selection-support is really neat.

===

"show me the code", Linus Thorvalds

BTW, Tried to make a proper patch but got "closed
connection" from sourceforge (overload?). I could
check out the code alright - strange.

What more...I'm a csharp/java/perl-coder so maybe I
left some memory leaks. Haven't programmed C++ for 15
years.

So, take what you need or ignore this posting
completely :-)

signing of
Patrik

in forms1.h:

// your code==>
if (!db.isOpen())
{
QMessageBox::information( this, applicationName,
"There is no database opened." );
return;
}
//start of my code
QString cbtext;
QString sltext;
if (sqlTextEdit->hasSelectedText())
sltext = sqlTextEdit->selectedText();
else{
QString cbtemp =
clipboard->text(QClipboard::Clipboard);
if (cbtemp.startsWith("sql://"))
cbtext = cbtemp.mid(6);
}

QString query;
if (!sltext.isNull()) // if there is a selection
- use it
query = sltext;
else if (!cbtext.isNull()) // ok, no selection ...
a clipboard-entry?
query = cbtext;
else
query = sqlTextEdit->text(); // ok,
fallback - old behaviour

if (query.startsWith("sql://")) // always
remove sql:// at the beginning
query = query.mid(6);

//end of my code

if (query.isEmpty())

Discussion

  • Justin Clift

    Justin Clift - 2014-07-30

    Hi Patrik,

    Are you still interested in helping out with this? (we're on GitHub now, much easier to work with)

    Regards and best wishes,

    Justin Clift

     
  • Justin Clift

    Justin Clift - 2015-06-05
    • status: open --> closed
    • Group: --> Next Release (example)
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.