summaryrefslogtreecommitdiffstats
path: root/src/apppropprg.cpp
diff options
context:
space:
mode:
authorPascal Viandier <midi-pascal@videotron.ca>2015-10-01 19:38:38 +0200
committerSlávek Banko <slavek.banko@axis.cz>2015-10-01 19:38:38 +0200
commit1e0e72fceb542e4eb984b50f747c38314f055b8f (patch)
tree40d35ec3682c465348f8d8d73509aeda4729a8bb /src/apppropprg.cpp
parentc9e33e7d3fcd5b21a00e13dcbb5742a6c8da6106 (diff)
downloadkooldock-1e0e72fceb542e4eb984b50f747c38314f055b8f.tar.gz
kooldock-1e0e72fceb542e4eb984b50f747c38314f055b8f.zip
Fix remaining issues and build warnings
Cleanup code Signed-off-by: Pascal Viandier <midi-pascal@videotron.ca>
Diffstat (limited to 'src/apppropprg.cpp')
-rw-r--r--src/apppropprg.cpp164
1 files changed, 78 insertions, 86 deletions
diff --git a/src/apppropprg.cpp b/src/apppropprg.cpp
index 4d9d60e..122206e 100644
--- a/src/apppropprg.cpp
+++ b/src/apppropprg.cpp
@@ -9,6 +9,7 @@
// Copyright: See COPYING file that comes with this distribution
//
//
+
#include <kicondialog.h>
#include <tdefiledialog.h>
#include <tdemessagebox.h>
@@ -19,71 +20,71 @@
#include "appProp.h"
#include "kooldock.h"
-appPropPrg::appPropPrg(TQWidget *parent, const char *name)
-: appProp(parent, name)
+appPropPrg::appPropPrg(TQWidget *parent,
+ const char* name):
+ appProp(parent, name)
{
-
}
-
appPropPrg::~appPropPrg()
{
}
void appPropPrg::accept()
{
- TQString icon;
- TQString desktop;
- TQString path;
- TQString puser;
+ TQString icon;
+ TQString desktop;
+ TQString path;
+ TQString puser;
- icon=iconbutton->icon();
- desktop=cmdname->text();
- path=cmdpath->text();
- puser=user->text();
+ icon = iconbutton->icon();
+ desktop = cmdname->text();
+ path = cmdpath->text();
+ puser = user->text();
- if(icon.length() == 0)
- {
- KMessageBox::sorry(0, i18n("You must select an icon!"), i18n("Error"), 1);
- return;
- }
- if(desktop.length() == 0)
- {
- KMessageBox::sorry(0, i18n("You must enter a name!"), i18n("Error"), 1);
- return;
- }
- if(path.length() == 0)
- {
- KMessageBox::sorry(0, i18n("You must enter a command or path!"), i18n("Error"), 1);
- return;
- }
- if((cuser->isChecked()==true) && (puser.length()==0))
- {
- KMessageBox::sorry(0, i18n("You must provide a username!"), i18n("Error"), 1);
- return;
- }
+ if (icon.length() == 0) {
+ KMessageBox::sorry(0, i18n("You must select an icon!"), i18n("Error"), 1);
+ return;
+ }
+ if (desktop.length() == 0) {
+ KMessageBox::sorry(0, i18n("You must enter a name!"), i18n("Error"), 1);
+ return;
+ }
+ if (path.length() == 0) {
+ KMessageBox::sorry(0, i18n("You must enter a command or path!"), i18n("Error"), 1);
+ return;
+ }
+ if ((cuser->isChecked() == true) && (puser.length() == 0)) {
+ KMessageBox::sorry(0, i18n("You must provide a username!"), i18n("Error"), 1);
+ return;
+ }
-
- // Now we modify desktop (lowercase, no spaces)
- desktop.remove(" ", TRUE);
- desktop=desktop.lower();
- desktop.append(".desktop");
+ // Modify desktop (lowercase, no spaces)
+ desktop.remove(" ", true);
+ desktop = desktop.lower();
+ desktop.append(".desktop");
- //To handle position
- TQString progPath = locateLocal("data", "kooldock");
- TQDir dir(progPath + TQString("/menu/"));
- TQString preffix;
- TQStringList fileList = dir.entryList("*.desktop");
+ // Handle position
+ TQString progPath = locateLocal("data", "kooldock");
+ TQDir dir(progPath + TQString("/menu/"));
+ TQString preffix;
+ TQStringList fileList = dir.entryList("*.desktop");
- int pos=fileList.count();
- if(pos<10) preffix=TQString("0%1_").arg(pos);
- if(pos>=10) preffix=TQString("%1_").arg(pos);
+ int pos = fileList.count();
+ if (pos < 10) {
+ preffix = TQString("0%1_").arg(pos);
+ }
+ if (pos >= 10) {
+ preffix = TQString("%1_").arg(pos);
+ }
desktop.prepend(preffix);
- //End handling position
+ // End handling position
- /* Here we add the .desktop file to the menuPath */
- KoolDock::addFile(desktop, icon, cmdpath->text(), cmdname->text(), true, terminal->isChecked(), tclose->isChecked(), cuser->isChecked(), user->text());
+ // Add the .desktop file to the menuPath
+ KoolDock::addFile(desktop, icon, cmdpath->text(), cmdname->text(),
+ true, terminal->isChecked(), tclose->isChecked(),
+ cuser->isChecked(), user->text());
user->setEnabled(false);
cuser->setChecked(false);
terminal->setChecked(false);
@@ -103,57 +104,48 @@ void appPropPrg::reject()
this->hide();
}
-void appPropPrg::closeEvent( TQCloseEvent *e )
+void appPropPrg::closeEvent(TQCloseEvent* e)
{
- e->ignore();
- reject();
+ e->ignore();
+ reject();
}
void appPropPrg::cmdfile_clicked()
{
- TQString tmp;
-
- TQString fileToOpen=KFileDialog::getOpenFileName(TQDir::currentDirPath(), "*.*", this, i18n("Open File"));
- if (!fileToOpen.isEmpty())
- {
- cmdpath->setText(fileToOpen);
-
- //Lets set a default icon based on the program name
- tmp=fileToOpen;
- int pos=tmp.findRev("/", -1);
- if(pos!=-1)
- {
- tmp.remove(1, pos);
- tmp.remove("/", TRUE);
- }
- iconbutton->setIcon(tmp);
- cmdname->setText(tmp);
- }
+ TQString fileToOpen = KFileDialog::getOpenFileName(TQDir::currentDirPath(), "*.*", this, i18n("Open File"));
+ if (!fileToOpen.isEmpty()) {
+ cmdpath->setText(fileToOpen);
+ // Set a default icon based on the program name
+ TQString tmp = fileToOpen;
+ int pos = tmp.findRev("/", -1);
+ if (pos != -1) {
+ tmp.remove(1, pos);
+ tmp.remove("/", true);
+ }
+ iconbutton->setIcon(tmp);
+ cmdname->setText(tmp);
+ }
}
void appPropPrg::cuserchk()
{
- if(cuser->isChecked()==true)
- {
- user->setEnabled(true);
- }
- else
- {
- user->setEnabled(false);
- }
+ if (cuser->isChecked() == true) {
+ user->setEnabled(true);
+ }
+ else {
+ user->setEnabled(false);
+ }
}
void appPropPrg::terminalchk()
{
- if(terminal->isChecked()==true)
- {
- tclose->setEnabled(true);
- }
- else
- {
- tclose->setChecked(false);
- tclose->setEnabled(false);
- }
+ if (terminal->isChecked() == true) {
+ tclose->setEnabled(true);
+ }
+ else {
+ tclose->setChecked(false);
+ tclose->setEnabled(false);
+ }
}
#include "apppropprg.moc"