|
View:
New views
8 Messages
—
Rating Filter:
Alert me
|
|
|
ksnapshot patchHi!
I already sent this patch to Richard Moore some time ago, but probably this mailing list is the better place.. ,-) For the first Klassroom Kourse of the kde forum I wrote my first patch and got an OK from the mentor. It was this feature wish: https://bugs.kde.org/show_bug.cgi?id=165482 (close ksnapshot when snapshot is opened with another application) Best Regards, Michael [patch] Index: ../ksnapshot/ksnapshotwidget.ui =================================================================== --- ../ksnapshot/ksnapshotwidget.ui (Revision 905197) +++ ../ksnapshot/ksnapshotwidget.ui (Arbeitskopie) @@ -218,6 +218,19 @@ </widget> </item> <item> + <widget class="QCheckBox" name="cbCloseWhenOpen" > + <property name="whatsThis" > + <string>When enabled, KSnapShot will be closed when snapshot is opened with another application</string> + </property> + <property name="text" > + <string>Close KSnapshot when opening other application</string> + </property> + <property name="checked" > + <bool>true</bool> + </property> + </widget> + </item> + <item> <widget class="KPushButton" name="btnCopy" > <property name="whatsThis" > <string>Click this button to copy the current snapshot to the clipboard.</string> Index: ../ksnapshot/ksnapshot.cpp =================================================================== --- ../ksnapshot/ksnapshot.cpp (Revision 906308) +++ ../ksnapshot/ksnapshot.cpp (Arbeitskopie) @@ -100,6 +100,7 @@ connect( mainWidget->btnCopy, SIGNAL( clicked() ), SLOT( slotCopy() ) ); // connect( mainWidget->btnOpen, SIGNAL( clicked() ), SLOT( slotOpen() ) ); connect( mainWidget->comboMode, SIGNAL( activated(int) ), SLOT( slotModeChanged(int) ) ); + connect( mainWidget->cbCloseWhenOpen, SIGNAL( toggled(bool) ), SLOT( slotCloseWhenOpenToggle(bool) )); openMenu = new QMenu(this); mainWidget->btnOpen->setMenu(openMenu); @@ -162,7 +163,11 @@ setMode( conf.readEntry("mode", 0) ); setIncludeDecorations(conf.readEntry("includeDecorations",true)); filename = KUrl( conf.readPathEntry( "filename", QDir::currentPath()+'/'+i18n("snapshot")+"1.png" )); - + + // shall KSnapshot be closed when "open with" is used? + KConfigGroup confOpen(KGlobal::config(), "Open-with settings"); + mainWidget->cbCloseWhenOpen->setChecked(confOpen.readEntry("close", false)); + // Make sure the name is not already being used while(KIO::NetAccess::exists( filename, KIO::NetAccess::DestinationSide, this )) { autoincFilename(); @@ -294,7 +299,12 @@ KUrl::List list; list.append(fileopen); - KRun::run(application, list, this); + if ( KRun::run(application, list, this) && closeWhenOpen() ) { + // if the service was able to run then we silently + // close the application. + accept(); + } + } void KSnapshot::slotOpen(QAction* action) @@ -330,13 +340,31 @@ if (!service && !dlg.text().isEmpty()) { - KRun::run(dlg.text(), list, this); - return; + if ( KRun::run(dlg.text(), list, this) ) { + // if the service was able to run then we silently + // close the application. + if ( closeWhenOpen() ){ + accept(); + } + } else { + KMessageBox::error(this, i18n("Unable to open %1. Please check to make sure the application was properly installed.", service->name())); + } + return; } } // we have an action with a service, run it! - KRun::run(*service, list, this, true); + if ( KRun::run(*service, list, this, true) ) { + // if the service was able to run then we silently + // close the application. + if ( closeWhenOpen() ){ + accept(); + } + } else { + KMessageBox::error(this, i18n("Unable to open %1. Please check to make sure the application was properly installed.", service->name())); + return; + } + } void KSnapshot::slotPopulateOpenMenu() @@ -400,6 +428,13 @@ show(); } +void KSnapshot::slotCloseWhenOpenToggle(bool checked) +{ + KConfigGroup conf(KGlobal::config(), "Open-with settings"); + conf.writeEntry("close", checked); + conf.sync(); +} + void KSnapshot::closeEvent( QCloseEvent * e ) { KConfigGroup conf(KGlobal::config(), "GENERAL"); @@ -599,6 +634,11 @@ return mainWidget->cbIncludeDecorations->isChecked(); } +bool KSnapshot::closeWhenOpen() const +{ + return mainWidget->cbCloseWhenOpen->isChecked(); +} + int KSnapshot::mode() const { return mainWidget->comboMode->currentIndex(); Index: ../ksnapshot/ksnapshot.h =================================================================== --- ../ksnapshot/ksnapshot.h (Revision 905197) +++ ../ksnapshot/ksnapshot.h (Arbeitskopie) @@ -157,6 +157,7 @@ void setTime( int newTime ); void setURL( const QString &newURL ); void setGrabMode( int m ); + void slotCloseWhenOpenToggle( bool checked ); void exit(); protected: @@ -182,6 +183,7 @@ void setMode( int mode ); int delay() const; bool includeDecorations() const; + bool closeWhenOpen() const; int mode() const; QPixmap preview(); int previewWidth() const; _______________________________________________ Kde-graphics-devel mailing list Kde-graphics-devel@... https://mail.kde.org/mailman/listinfo/kde-graphics-devel |
|
|
Re: ksnapshot patchHi Michael,
Sorry I've been so slow to reply, I was still thinking about this. I'm very reluctant to add new UI elements (everyone wants 'just one more checkbox') so they need to be considered in context. At the moment, I'm not sure if the use-case is common enough to warrant a checkbox when closing the app is already pretty easy. Anyone got an opinion on this? Cheers Rich. On Mon, Jan 19, 2009 at 9:56 PM, Michael Giesler <michael@...> wrote: > Hi! > > I already sent this patch to Richard Moore some time ago, but probably this > mailing list is the better place.. ,-) > > For the first Klassroom Kourse of the > kde forum I wrote my first patch and got an OK from the mentor. > It was this feature wish: > https://bugs.kde.org/show_bug.cgi?id=165482 > (close ksnapshot when snapshot is opened with another application) > > Best Regards, > Michael > > _______________________________________________ > Kde-graphics-devel mailing list > Kde-graphics-devel@... > https://mail.kde.org/mailman/listinfo/kde-graphics-devel > > Kde-graphics-devel mailing list Kde-graphics-devel@... https://mail.kde.org/mailman/listinfo/kde-graphics-devel |
|
|
Re: ksnapshot patchI guess another option would be to make it so that ksnapshot behaves
as you suggest and making it so that this isn't even optional. That might make a lot of sense. Opinions? Rich. On Mon, Jan 19, 2009 at 10:00 PM, Richard Moore <richmoore44@...> wrote: > Hi Michael, > > Sorry I've been so slow to reply, I was still thinking about this. I'm > very reluctant to add new UI elements (everyone wants 'just one more > checkbox') so they need to be considered in context. At the moment, > I'm not sure if the use-case is common enough to warrant a checkbox > when closing the app is already pretty easy. Anyone got an opinion on > this? > > Cheers > > Rich. > > On Mon, Jan 19, 2009 at 9:56 PM, Michael Giesler <michael@...> wrote: >> Hi! >> >> I already sent this patch to Richard Moore some time ago, but probably this >> mailing list is the better place.. ,-) >> >> For the first Klassroom Kourse of the >> kde forum I wrote my first patch and got an OK from the mentor. >> It was this feature wish: >> https://bugs.kde.org/show_bug.cgi?id=165482 >> (close ksnapshot when snapshot is opened with another application) >> >> Best Regards, >> Michael >> >> _______________________________________________ >> Kde-graphics-devel mailing list >> Kde-graphics-devel@... >> https://mail.kde.org/mailman/listinfo/kde-graphics-devel >> >> > Kde-graphics-devel mailing list Kde-graphics-devel@... https://mail.kde.org/mailman/listinfo/kde-graphics-devel |
|
|
|
|
|
Re: ksnapshot patchOn Mon, Jan 19, 2009 at 11:10 PM, Albert Astals Cid <tsdgeos@...> wrote:
> In my opinion it makes more sense that the calling application decides if it > wants ksnapshot to be closed after a snapshot. Maybe a command line switch? > > ksnapshot --closeaftersnapshot > > sounds a bit too long though The application doesn't call ksnapshot, it's the other way around - Send To Foo. Rich. _______________________________________________ Kde-graphics-devel mailing list Kde-graphics-devel@... https://mail.kde.org/mailman/listinfo/kde-graphics-devel |
|
|
Re: ksnapshot patchHi!
If we don't want to add another element to the ui, I could write a configure dialog.. At least I always use the same mode (fullscreen, window, ...), delay and window decoration mode - so it would make sense to move it to an own configuration window and add a new button "configure" beside the "help" button... This would make the ui even cleaner and it would be a great junior job for me.. ,-) What do you think about this? best regards, Michael _______________________________________________ Kde-graphics-devel mailing list Kde-graphics-devel@... https://mail.kde.org/mailman/listinfo/kde-graphics-devel |
|
|
Re: ksnapshot patchOn Tuesday 20 January 2009 07:18:11 Michael Giesler wrote:
> Hi! > > If we don't want to add another element to the ui, I could write a > configure dialog.. > At least I always use the same mode (fullscreen, window, ...), delay and > window decoration mode - so it would make sense to move it to an own > configuration window and add a new button "configure" beside the "help" > button... I think that for most people the settings they need change frequently enough that it would just end up being annoying for users. Sometimes I want to capture the whole desktop, sometimes just one window. For some purposes, I need some time to move my mouse to the right location (to demonstrate a hover effect), but other times it's pointless. Alex _______________________________________________ Kde-graphics-devel mailing list Kde-graphics-devel@... https://mail.kde.org/mailman/listinfo/kde-graphics-devel |
|
|
Re: ksnapshot patchOn Tue, Jan 20, 2009 at 7:18 AM, Michael Giesler <michael@...> wrote:
> If we don't want to add another element to the ui, I could write a configure > dialog.. > At least I always use the same mode (fullscreen, window, ...), delay and > window decoration mode - so it would make sense to move it to an own > configuration window and add a new button "configure" beside the "help" > button... > This would make the ui even cleaner and it would be a great junior job for > me.. ,-) Sorry, one of the main strengths of the UI is that it isn't done this way. The point is to provide a dialog style UI, no menu etc. to make it very quick to use. This has downsides too of course, but it would become a different program if that was changed. A short lived effort to do so is kgrab in extra gear which is a fork of ksnapshot, but I don't believe the maintainer is actively work on it. He doesn't seem to have updated to take account of any fixes etc. I've done. Cheers Rich. _______________________________________________ Kde-graphics-devel mailing list Kde-graphics-devel@... https://mail.kde.org/mailman/listinfo/kde-graphics-devel |
| Free embeddable forum powered by Nabble | Forum Help |