00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include <ntqwidget.h>
00019 #include <ntqlineedit.h>
00020 #include <ntqfileinfo.h>
00021 #include <ntqfiledialog.h>
00022 #include <ntqcheckbox.h>
00023 #include <tdelocale.h>
00024 #include "commandentry.h"
00025 #include "commandentrydialog.h"
00026
00027 CommandEntryDialog::CommandEntryDialog(TQWidget *parent, const char *name, CommandEntry* entry, ConfigElem* pConfigElem):
00028 CommandEntryDlg(parent,name,true),
00029 m_pentry (entry),
00030 m_pConfigElem (pConfigElem)
00031 {
00032 m_EditName->setText (entry->m_name);
00033 m_EditPath->setText (entry->m_path);
00034 m_checkModal->setChecked(entry->m_waitForCommand);
00035 m_EditName->setFocus ();
00036 }
00037
00038 CommandEntryDialog::~CommandEntryDialog(){
00039 }
00040
00041 void CommandEntryDialog::slotPath ()
00042 {
00043 TQFileInfo info (m_EditPath->text ());
00044 TQString dir = info.dirPath ();
00045 TQFileDialog dlg (this, "Command", TRUE);
00046 dlg.setCaption (i18n("Select Command"));
00047 dlg.setDir (dir);
00048 dlg.setMode (TQFileDialog::ExistingFile);
00049 if (dlg.exec () == TQDialog::Accepted)
00050 m_EditPath->setText (dlg.selectedFile());
00051 }
00052
00053 void CommandEntryDialog::slotOk ()
00054 {
00055 TQString name = m_EditName->text();
00056 TQString path = m_EditPath->text();
00057 if (!name.isEmpty() && !path.isEmpty())
00058 {
00059 m_pentry->m_name = name;
00060 m_pentry->m_path = path;
00061 m_pentry->m_waitForCommand = m_checkModal->isChecked();
00062 accept ();
00063 }
00064 }
00065
00066 void CommandEntryDialog::slotTest ()
00067 {
00068 m_pentry->exec (m_EditPath->text(), m_pConfigElem);
00069 }