23 #include "edittype.moc" 
   25 #include "ui_edittypewidget.h" 
   27 #include <kicondialog.h> 
   28 #include <klineedit.h> 
   30 #include <kmessagebox.h> 
   31 #include <ktoolinvocation.h> 
   36     mname( name ), mdesc( desc ), micon( icon )
 
   38   setCaption( i18n( 
"Edit Type" ) );
 
   39   setButtons( Help | Ok | Cancel );
 
   42   setMainWidget( base );
 
   43   medittypewidget = 
new Ui_EditTypeWidget();
 
   44   medittypewidget->setupUi( base );
 
   45   base->layout()->setMargin( 0 );
 
   47   medittypewidget->editName->setText( mname );
 
   48   medittypewidget->editName->setWhatsThis(
 
   49         i18n( 
"Here you can edit the name of the current macro type." ) );
 
   50   medittypewidget->editDescription->setText( mdesc );
 
   51   medittypewidget->editDescription->setWhatsThis(
 
   52         i18n( 
"Here you can edit the description of the current macro type. " 
   53               "This field is optional, so you can also leave this empty: if " 
   54               "you do so, then your macro type will have no description." ) );
 
   55   medittypewidget->typeIcon->setIcon( !micon.isEmpty() ? micon : 
"system-run" );
 
   56   medittypewidget->typeIcon->setWhatsThis(
 
   57         i18n( 
"Use this button to change the icon of the current macro type." ) );
 
   59   connect( 
this, SIGNAL( helpClicked() ), 
this, SLOT( slotHelp() ) );
 
   60   connect( 
this, SIGNAL( okClicked() ), 
this, SLOT( slotOk() ) );
 
   61   connect( 
this, SIGNAL( cancelClicked() ), 
this, SLOT( slotCancel() ) );
 
   68   delete medittypewidget;
 
   71 void EditType::slotHelp()
 
   73   KToolInvocation::invokeHelp( 
"working-with-types", 
"kig" );
 
   76 void EditType::slotOk()
 
   78   QString tmp = medittypewidget->editName->text();
 
   81     KMessageBox::information( 
this, i18n( 
"The name of the macro can not be empty." ) );
 
   85   bool namechanged = 
false;
 
   86   bool descchanged = 
false;
 
   87   bool iconchanged = 
false;
 
   93   tmp = medittypewidget->editDescription->text();
 
   99   tmp = medittypewidget->typeIcon->icon();
 
  105   done( namechanged || descchanged || iconchanged );
 
  108 void EditType::slotCancel()
 
EditType(QWidget *parent, const QString &name=QString(), const QString &desc=QString(), const QString &icon=QString())
 
QString description() const