commandentrydialog.cpp

00001 /***************************************************************************
00002                           commandentrydialog.cpp  -  description
00003                              -------------------
00004     begin                : Wed Oct 31 2001
00005     copyright            : (C) 2001 by Eggert Ehmke
00006     email                : eggert.ehmke@berlin.de
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #include <qwidget.h>
00019 #include <qlineedit.h>
00020 #include <qfileinfo.h>
00021 #include <qfiledialog.h>
00022 #include <qcheckbox.h>
00023 #include <klocale.h>
00024 #include "commandentry.h"
00025 #include "commandentrydialog.h"
00026 
00027 CommandEntryDialog::CommandEntryDialog(QWidget *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        QFileInfo info (m_EditPath->text ());
00044        QString dir = info.dirPath ();
00045        QFileDialog dlg (this, "Command", TRUE);
00046        dlg.setCaption (i18n("Select Command"));
00047        dlg.setDir (dir);
00048        dlg.setMode (QFileDialog::ExistingFile);
00049   if (dlg.exec () == QDialog::Accepted)
00050        m_EditPath->setText (dlg.selectedFile());
00051 }
00052 
00053 void CommandEntryDialog::slotOk ()
00054 {
00055        QString name = m_EditName->text();
00056        QString 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 }

Generated on Wed May 16 21:15:18 2007 for kshowmail by  doxygen 1.5.0