From 314310a082f33a91caf2ba4e7dc31fddc63d01d6 Mon Sep 17 00:00:00 2001 From: Darrell Anderson Date: Sun, 2 Mar 2014 18:08:59 -0600 Subject: Rename nonkdeappbutton->nontdeappbutton. --- kicker/kicker/buttons/CMakeLists.txt | 2 +- kicker/kicker/buttons/Makefile.am | 2 +- kicker/kicker/buttons/nonkdeappbutton.cpp | 287 ------------------------------ kicker/kicker/buttons/nonkdeappbutton.h | 92 ---------- kicker/kicker/buttons/nontdeappbutton.cpp | 287 ++++++++++++++++++++++++++++++ kicker/kicker/buttons/nontdeappbutton.h | 92 ++++++++++ kicker/kicker/core/container_button.cpp | 2 +- 7 files changed, 382 insertions(+), 382 deletions(-) delete mode 100644 kicker/kicker/buttons/nonkdeappbutton.cpp delete mode 100644 kicker/kicker/buttons/nonkdeappbutton.h create mode 100644 kicker/kicker/buttons/nontdeappbutton.cpp create mode 100644 kicker/kicker/buttons/nontdeappbutton.h (limited to 'kicker') diff --git a/kicker/kicker/buttons/CMakeLists.txt b/kicker/kicker/buttons/CMakeLists.txt index 1e7ede5b1..72d9254c3 100644 --- a/kicker/kicker/buttons/CMakeLists.txt +++ b/kicker/kicker/buttons/CMakeLists.txt @@ -42,7 +42,7 @@ set( target kicker_buttons ) set( ${target}_SRCS servicebutton.cpp bookmarksbutton.cpp browserbutton.cpp knewbutton.cpp desktopbutton.cpp extensionbutton.cpp - kbutton.cpp nonkdeappbutton.cpp servicemenubutton.cpp + kbutton.cpp nontdeappbutton.cpp servicemenubutton.cpp urlbutton.cpp windowlistbutton.cpp ) diff --git a/kicker/kicker/buttons/Makefile.am b/kicker/kicker/buttons/Makefile.am index 4dcbbb165..1bdba20a5 100644 --- a/kicker/kicker/buttons/Makefile.am +++ b/kicker/kicker/buttons/Makefile.am @@ -6,7 +6,7 @@ noinst_LTLIBRARIES = libkicker_buttons.la libkicker_buttons_la_SOURCES = servicebutton.cpp bookmarksbutton.cpp \ browserbutton.cpp knewbutton.cpp \ desktopbutton.cpp extensionbutton.cpp kbutton.cpp \ - nonkdeappbutton.cpp servicemenubutton.cpp urlbutton.cpp \ + nontdeappbutton.cpp servicemenubutton.cpp urlbutton.cpp \ windowlistbutton.cpp libkicker_buttons_la_LDFLAGS = $(all_libraries) diff --git a/kicker/kicker/buttons/nonkdeappbutton.cpp b/kicker/kicker/buttons/nonkdeappbutton.cpp deleted file mode 100644 index b2e90065a..000000000 --- a/kicker/kicker/buttons/nonkdeappbutton.cpp +++ /dev/null @@ -1,287 +0,0 @@ -/***************************************************************** - -Copyright (c) 1996-2001 the kicker authors. See file AUTHORS. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -******************************************************************/ - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// the header where the configuration dialog is defined. -#include "exe_dlg.h" - -// our own definition -#include "nonkdeappbutton.h" - -// we include the "moc" file so that the TDE build system knows to create it -#include "nonkdeappbutton.moc" - -// this is one of the two constructors. gets called when creating a new button -// e.g. via the "non-TDE Application" dialog, not one that was saved and then -// restored. -NonKDEAppButton::NonKDEAppButton(const TQString& name, - const TQString& description, - const TQString& filePath, const TQString& icon, - const TQString &cmdLine, bool inTerm, - TQWidget* parent) - : PanelButton(parent, "NonKDEAppButton") // call our superclass's constructor -{ - // call the initialization method - initialize(name, description, filePath, icon, cmdLine, inTerm); - - // and connect the clicked() signal (emitted when the button is activated) - // to the slotExec() slot - // we do this here instead of in initialize(...) since initialize(...) may - // get called later, e.g after reconfiguring it - connect(this, TQT_SIGNAL(clicked()), TQT_SLOT(slotExec())); -} - -// this constructor is used when restoring a button, usually at startup -NonKDEAppButton::NonKDEAppButton( const TDEConfigGroup& config, TQWidget* parent ) - : PanelButton(parent, "NonKDEAppButton") // call our superclass's constructor -{ - // call the initialization method, this time with values from a config file - initialize(config.readEntry("Name"), - config.readEntry("Description"), - config.readPathEntry("Path"), - config.readEntry("Icon"), - config.readPathEntry("CommandLine"), - config.readBoolEntry("RunInTerminal")); - - // see comment on connect in above constructor - connect(this, TQT_SIGNAL(clicked()), TQT_SLOT(slotExec())); -} - -void NonKDEAppButton::initialize(const TQString& name, - const TQString& description, - const TQString& filePath, const TQString& icon, - const TQString &cmdLine, bool inTerm ) -{ - // and now we actually set up most of the member variables with the - // values passed in here. by doing this all in an initialize() method - // we avoid duplicating this code all over the place - nameStr = name; - descStr = description; - pathStr = filePath; - iconStr = icon; - cmdStr = cmdLine; - term = inTerm; - - // now we set the buttons tooltip, title and icon using the appropriate - // set*() methods from the PanelButton class from which we subclass - - // assign the name or the description to a TQString called tooltip - TQString tooltip = description.isEmpty() ? nameStr : descStr; - - if (tooltip.isEmpty()) - { - // we had nothing, so let's try the path - tooltip = pathStr; - - // and add the command if we have one. - if (!cmdStr.isEmpty()) - { - tooltip += " " + cmdStr; - } - - // set the title to the pathStr - setTitle(pathStr); - } - else - { - // since we have a name or a description (assigned by the user) let's - // use that as the title - setTitle(nameStr.isEmpty() ? descStr : nameStr); - } - - // set the tooltip - TQToolTip::add(this, tooltip); - - // set the icon - setIcon(iconStr); -} - -void NonKDEAppButton::saveConfig( TDEConfigGroup& config ) const -{ - // this is called whenever we change something - // the config object sent in will already be set to the - // right group and file, so we can just start writing - config.writeEntry("Name", nameStr); - config.writeEntry("Description", descStr); - config.writeEntry("RunInTerminal", term); - config.writePathEntry("Path", pathStr); - config.writeEntry("Icon", iconStr); - config.writePathEntry("CommandLine", cmdStr); -} - -void NonKDEAppButton::dragEnterEvent(TQDragEnterEvent *ev) -{ - // when something is dragged onto this button, we'll accept it - // if we aren't dragged onto ourselves, and if it's a URL - if ((ev->source() != this) && KURLDrag::canDecode(ev)) - { - ev->accept(rect()); - } - else - { - ev->ignore(rect()); - } - - // and now let the PanelButton do as it wishes with it... - PanelButton::dragEnterEvent(ev); -} - -void NonKDEAppButton::dropEvent(TQDropEvent *ev) -{ - // something has been droped on us! - KURL::List fileList; - TQString execStr; - if (KURLDrag::decode(ev, fileList)) - { - // according to KURLDrag, we've successfully retrieved - // one or more URLs! now we iterate over them one by - // one .... - for (KURL::List::ConstIterator it = fileList.begin(); - it != fileList.end(); - ++it) - { - const KURL &url(*it); - if (KDesktopFile::isDesktopFile(url.path())) - { - // this URL is actually a .desktop file, so let's grab - // the URL it actually points to ... - KDesktopFile deskFile(url.path()); - deskFile.setDesktopGroup(); - - // ... and add it to the exec string - execStr += TDEProcess::quote(deskFile.readURL()) + " "; - } - else - { - // it's just a URL of some sort, add it directly to the exec - execStr += TDEProcess::quote(url.path()) + " "; - } - } - - // and now run the command - runCommand(execStr); - } - - // and let PanelButton clean up - PanelButton::dropEvent(ev); -} - -void NonKDEAppButton::slotExec() -{ - // the button was clicked, let's take some action - runCommand(); -} - -void NonKDEAppButton::runCommand(const TQString& execStr) -{ - // run our command! this method is used both by the drag 'n drop - // facilities as well as when the button is activated (usualy w/a click) - - // we'll use the "result" variable to record our success/failure - bool result; - - // since kicker doesn't listen to or use the session manager, we have - // to make sure that our environment is set up correctly. this is - // accomlplished by doing: - kapp->propagateSessionManager(); - - if (term) - { - // run in a terminal? ok! we find this in the config file in the - // [misc] group (this will usually be in kdeglobal, actually, which - // get merged into the application config automagically for us - TDEConfig *config = TDEGlobal::config(); - config->setGroup("misc"); - TQString termStr = config->readPathEntry("Terminal", "konsole"); - - // and now we run the darn thing and store how we fared in result - result = KRun::runCommand(termStr + " -e " + pathStr + " " + - cmdStr + " " + execStr, - pathStr, iconStr); - } - else - { - // just run it... - result = KRun::runCommand(pathStr + " " + cmdStr + " " + execStr, - pathStr, iconStr); - } - - if (!result) - { - // something went wrong, so let's show an error msg to the user - KMessageBox::error(this, i18n("Cannot execute non-TDE application."), - i18n("Kicker Error")); - return; - } -} - -void NonKDEAppButton::updateSettings(PanelExeDialog* dlg) -{ - // we were reconfigured via the confiugration dialog - // re-setup our member variables using initialize(...), - // this time using values from the dlg - initialize(dlg->title(), dlg->description(), dlg->command(), - dlg->iconPath(), dlg->commandLine(), dlg->useTerminal()); - - // now delete the dialog so that it doesn't leak memory - delete dlg; - - // and emit a signal that the container that houses us - // listens for so it knows when to start the process to - // save our configuration - emit requestSave(); -} - -void NonKDEAppButton::properties() -{ - // the user has requested to configure this button - // this method gets called by the ButtonContainer that houses the button - // see ButtonContainer::eventFilter(TQObject *o, TQEvent *e), where the - // context menu is created and dealt with. - - // so we create a new config dialog .... - PanelExeDialog* dlg = new PanelExeDialog(nameStr, descStr, pathStr, - iconStr, cmdStr, term, this); - - // ... connect the signal it emits when it has data for us to save - // to our updateSettings slot (see above) ... - connect(dlg, TQT_SIGNAL(updateSettings(PanelExeDialog*)), this, - TQT_SLOT(updateSettings(PanelExeDialog*))); - - // ... and then show it to the user - dlg->show(); -} - diff --git a/kicker/kicker/buttons/nonkdeappbutton.h b/kicker/kicker/buttons/nonkdeappbutton.h deleted file mode 100644 index 0407e85a4..000000000 --- a/kicker/kicker/buttons/nonkdeappbutton.h +++ /dev/null @@ -1,92 +0,0 @@ -/***************************************************************** - -Copyright (c) 1996-2000 the kicker authors. See file AUTHORS. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -******************************************************************/ - -#ifndef __nonkdeappbutton_h__ -#define __nonkdeappbutton_h__ - -// pull in the superclass's definition -#include "panelbutton.h" - -// forward declare this class -// lets the compiler know it exists without have to know all the gory details -class PanelExeDialog; - -/** - * Button that contains a non-TDE application - * subclass of PanelButton - */ -class NonKDEAppButton : public PanelButton -{ - // the Q_OBJECT macro provides the magic glue for signals 'n slots - Q_OBJECT - -public: - // define our two constructors, one used for creating new buttons... - NonKDEAppButton(const TQString& name, const TQString& description, - const TQString& filePath, const TQString& icon, - const TQString& cmdLine, bool inTerm, TQWidget* parent); - - // ... and once for restoring them at start up - NonKDEAppButton(const TDEConfigGroup& config, TQWidget* parent); - - // reimplemented from PanelButton - virtual void saveConfig(TDEConfigGroup& config) const; - virtual void properties(); - -protected slots: - // called when the button is activated - void slotExec(); - - // called after the user reconfigures something - void updateSettings(PanelExeDialog* dlg); - -protected: - // used to set up our internal state, either when creating the button - // or after reconfiguration - void initialize(const TQString& name, const TQString& description, - const TQString& filePath, const TQString& icon, - const TQString& cmdLine, bool inTerm); - - // run the command! - // the execStr parameter, which default to an empty string, - // is used to provide additional command line options aside - // from the ones in our config file; for instance a URL drag'd onto us - void runCommand(const TQString& execStr = TQString::null); - - // reimplemented from PanelButton - virtual TQString tileName() { return "URL"; } - TQString defaultIcon() const { return "exec"; }; - - // handle drag and drop actions - virtual void dropEvent(TQDropEvent *ev); - virtual void dragEnterEvent(TQDragEnterEvent *ev); - - TQString nameStr; // the name given this button by the user - TQString descStr; // the description given this button by the user - TQString pathStr; // the path to the command - TQString iconStr; // the path to the icon for this button - TQString cmdStr; // command line flags, if any - bool term; // whether to run this in a terminal or not -}; // all done defining the class! - -#endif diff --git a/kicker/kicker/buttons/nontdeappbutton.cpp b/kicker/kicker/buttons/nontdeappbutton.cpp new file mode 100644 index 000000000..4f88f2d37 --- /dev/null +++ b/kicker/kicker/buttons/nontdeappbutton.cpp @@ -0,0 +1,287 @@ +/***************************************************************** + +Copyright (c) 1996-2001 the kicker authors. See file AUTHORS. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +******************************************************************/ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// the header where the configuration dialog is defined. +#include "exe_dlg.h" + +// our own definition +#include "nontdeappbutton.h" + +// we include the "moc" file so that the TDE build system knows to create it +#include "nontdeappbutton.moc" + +// this is one of the two constructors. gets called when creating a new button +// e.g. via the "non-TDE Application" dialog, not one that was saved and then +// restored. +NonKDEAppButton::NonKDEAppButton(const TQString& name, + const TQString& description, + const TQString& filePath, const TQString& icon, + const TQString &cmdLine, bool inTerm, + TQWidget* parent) + : PanelButton(parent, "NonKDEAppButton") // call our superclass's constructor +{ + // call the initialization method + initialize(name, description, filePath, icon, cmdLine, inTerm); + + // and connect the clicked() signal (emitted when the button is activated) + // to the slotExec() slot + // we do this here instead of in initialize(...) since initialize(...) may + // get called later, e.g after reconfiguring it + connect(this, TQT_SIGNAL(clicked()), TQT_SLOT(slotExec())); +} + +// this constructor is used when restoring a button, usually at startup +NonKDEAppButton::NonKDEAppButton( const TDEConfigGroup& config, TQWidget* parent ) + : PanelButton(parent, "NonKDEAppButton") // call our superclass's constructor +{ + // call the initialization method, this time with values from a config file + initialize(config.readEntry("Name"), + config.readEntry("Description"), + config.readPathEntry("Path"), + config.readEntry("Icon"), + config.readPathEntry("CommandLine"), + config.readBoolEntry("RunInTerminal")); + + // see comment on connect in above constructor + connect(this, TQT_SIGNAL(clicked()), TQT_SLOT(slotExec())); +} + +void NonKDEAppButton::initialize(const TQString& name, + const TQString& description, + const TQString& filePath, const TQString& icon, + const TQString &cmdLine, bool inTerm ) +{ + // and now we actually set up most of the member variables with the + // values passed in here. by doing this all in an initialize() method + // we avoid duplicating this code all over the place + nameStr = name; + descStr = description; + pathStr = filePath; + iconStr = icon; + cmdStr = cmdLine; + term = inTerm; + + // now we set the buttons tooltip, title and icon using the appropriate + // set*() methods from the PanelButton class from which we subclass + + // assign the name or the description to a TQString called tooltip + TQString tooltip = description.isEmpty() ? nameStr : descStr; + + if (tooltip.isEmpty()) + { + // we had nothing, so let's try the path + tooltip = pathStr; + + // and add the command if we have one. + if (!cmdStr.isEmpty()) + { + tooltip += " " + cmdStr; + } + + // set the title to the pathStr + setTitle(pathStr); + } + else + { + // since we have a name or a description (assigned by the user) let's + // use that as the title + setTitle(nameStr.isEmpty() ? descStr : nameStr); + } + + // set the tooltip + TQToolTip::add(this, tooltip); + + // set the icon + setIcon(iconStr); +} + +void NonKDEAppButton::saveConfig( TDEConfigGroup& config ) const +{ + // this is called whenever we change something + // the config object sent in will already be set to the + // right group and file, so we can just start writing + config.writeEntry("Name", nameStr); + config.writeEntry("Description", descStr); + config.writeEntry("RunInTerminal", term); + config.writePathEntry("Path", pathStr); + config.writeEntry("Icon", iconStr); + config.writePathEntry("CommandLine", cmdStr); +} + +void NonKDEAppButton::dragEnterEvent(TQDragEnterEvent *ev) +{ + // when something is dragged onto this button, we'll accept it + // if we aren't dragged onto ourselves, and if it's a URL + if ((ev->source() != this) && KURLDrag::canDecode(ev)) + { + ev->accept(rect()); + } + else + { + ev->ignore(rect()); + } + + // and now let the PanelButton do as it wishes with it... + PanelButton::dragEnterEvent(ev); +} + +void NonKDEAppButton::dropEvent(TQDropEvent *ev) +{ + // something has been droped on us! + KURL::List fileList; + TQString execStr; + if (KURLDrag::decode(ev, fileList)) + { + // according to KURLDrag, we've successfully retrieved + // one or more URLs! now we iterate over them one by + // one .... + for (KURL::List::ConstIterator it = fileList.begin(); + it != fileList.end(); + ++it) + { + const KURL &url(*it); + if (KDesktopFile::isDesktopFile(url.path())) + { + // this URL is actually a .desktop file, so let's grab + // the URL it actually points to ... + KDesktopFile deskFile(url.path()); + deskFile.setDesktopGroup(); + + // ... and add it to the exec string + execStr += TDEProcess::quote(deskFile.readURL()) + " "; + } + else + { + // it's just a URL of some sort, add it directly to the exec + execStr += TDEProcess::quote(url.path()) + " "; + } + } + + // and now run the command + runCommand(execStr); + } + + // and let PanelButton clean up + PanelButton::dropEvent(ev); +} + +void NonKDEAppButton::slotExec() +{ + // the button was clicked, let's take some action + runCommand(); +} + +void NonKDEAppButton::runCommand(const TQString& execStr) +{ + // run our command! this method is used both by the drag 'n drop + // facilities as well as when the button is activated (usualy w/a click) + + // we'll use the "result" variable to record our success/failure + bool result; + + // since kicker doesn't listen to or use the session manager, we have + // to make sure that our environment is set up correctly. this is + // accomlplished by doing: + kapp->propagateSessionManager(); + + if (term) + { + // run in a terminal? ok! we find this in the config file in the + // [misc] group (this will usually be in kdeglobal, actually, which + // get merged into the application config automagically for us + TDEConfig *config = TDEGlobal::config(); + config->setGroup("misc"); + TQString termStr = config->readPathEntry("Terminal", "konsole"); + + // and now we run the darn thing and store how we fared in result + result = KRun::runCommand(termStr + " -e " + pathStr + " " + + cmdStr + " " + execStr, + pathStr, iconStr); + } + else + { + // just run it... + result = KRun::runCommand(pathStr + " " + cmdStr + " " + execStr, + pathStr, iconStr); + } + + if (!result) + { + // something went wrong, so let's show an error msg to the user + KMessageBox::error(this, i18n("Cannot execute non-TDE application."), + i18n("Kicker Error")); + return; + } +} + +void NonKDEAppButton::updateSettings(PanelExeDialog* dlg) +{ + // we were reconfigured via the confiugration dialog + // re-setup our member variables using initialize(...), + // this time using values from the dlg + initialize(dlg->title(), dlg->description(), dlg->command(), + dlg->iconPath(), dlg->commandLine(), dlg->useTerminal()); + + // now delete the dialog so that it doesn't leak memory + delete dlg; + + // and emit a signal that the container that houses us + // listens for so it knows when to start the process to + // save our configuration + emit requestSave(); +} + +void NonKDEAppButton::properties() +{ + // the user has requested to configure this button + // this method gets called by the ButtonContainer that houses the button + // see ButtonContainer::eventFilter(TQObject *o, TQEvent *e), where the + // context menu is created and dealt with. + + // so we create a new config dialog .... + PanelExeDialog* dlg = new PanelExeDialog(nameStr, descStr, pathStr, + iconStr, cmdStr, term, this); + + // ... connect the signal it emits when it has data for us to save + // to our updateSettings slot (see above) ... + connect(dlg, TQT_SIGNAL(updateSettings(PanelExeDialog*)), this, + TQT_SLOT(updateSettings(PanelExeDialog*))); + + // ... and then show it to the user + dlg->show(); +} + diff --git a/kicker/kicker/buttons/nontdeappbutton.h b/kicker/kicker/buttons/nontdeappbutton.h new file mode 100644 index 000000000..0bc3cd9ab --- /dev/null +++ b/kicker/kicker/buttons/nontdeappbutton.h @@ -0,0 +1,92 @@ +/***************************************************************** + +Copyright (c) 1996-2000 the kicker authors. See file AUTHORS. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +******************************************************************/ + +#ifndef __nontdeappbutton_h__ +#define __nontdeappbutton_h__ + +// pull in the superclass's definition +#include "panelbutton.h" + +// forward declare this class +// lets the compiler know it exists without have to know all the gory details +class PanelExeDialog; + +/** + * Button that contains a non-TDE application + * subclass of PanelButton + */ +class NonKDEAppButton : public PanelButton +{ + // the Q_OBJECT macro provides the magic glue for signals 'n slots + Q_OBJECT + +public: + // define our two constructors, one used for creating new buttons... + NonKDEAppButton(const TQString& name, const TQString& description, + const TQString& filePath, const TQString& icon, + const TQString& cmdLine, bool inTerm, TQWidget* parent); + + // ... and once for restoring them at start up + NonKDEAppButton(const TDEConfigGroup& config, TQWidget* parent); + + // reimplemented from PanelButton + virtual void saveConfig(TDEConfigGroup& config) const; + virtual void properties(); + +protected slots: + // called when the button is activated + void slotExec(); + + // called after the user reconfigures something + void updateSettings(PanelExeDialog* dlg); + +protected: + // used to set up our internal state, either when creating the button + // or after reconfiguration + void initialize(const TQString& name, const TQString& description, + const TQString& filePath, const TQString& icon, + const TQString& cmdLine, bool inTerm); + + // run the command! + // the execStr parameter, which default to an empty string, + // is used to provide additional command line options aside + // from the ones in our config file; for instance a URL drag'd onto us + void runCommand(const TQString& execStr = TQString::null); + + // reimplemented from PanelButton + virtual TQString tileName() { return "URL"; } + TQString defaultIcon() const { return "exec"; }; + + // handle drag and drop actions + virtual void dropEvent(TQDropEvent *ev); + virtual void dragEnterEvent(TQDragEnterEvent *ev); + + TQString nameStr; // the name given this button by the user + TQString descStr; // the description given this button by the user + TQString pathStr; // the path to the command + TQString iconStr; // the path to the icon for this button + TQString cmdStr; // command line flags, if any + bool term; // whether to run this in a terminal or not +}; // all done defining the class! + +#endif diff --git a/kicker/kicker/core/container_button.cpp b/kicker/kicker/core/container_button.cpp index a73d08abf..40f479308 100644 --- a/kicker/kicker/core/container_button.cpp +++ b/kicker/kicker/core/container_button.cpp @@ -47,7 +47,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "kicker.h" #include "kickerSettings.h" #include "kickertip.h" -#include "nonkdeappbutton.h" +#include "nontdeappbutton.h" #include "paneldrag.h" #include "servicebutton.h" #include "servicemenubutton.h" -- cgit v1.2.1