• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

kig

  • sources
  • kde-4.12
  • kdeedu
  • kig
  • modes
edittype.cc
Go to the documentation of this file.
1 /*
2  This file is part of Kig, a KDE program for Interactive Geometry...
3  Copyright (C) 2004 Dominique Devriese <devriese@kde.org>
4  Copyright (C) 2004 Pino Toscano <toscano.pino@tiscali.it>
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program; if not, write to the Free Software
18  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19  USA
20 */
21 
22 #include "edittype.h"
23 #include "edittype.moc"
24 
25 #include "ui_edittypewidget.h"
26 
27 #include <kicondialog.h>
28 #include <klineedit.h>
29 #include <klocale.h>
30 #include <kmessagebox.h>
31 #include <ktoolinvocation.h>
32 
33 EditType::EditType( QWidget* parent, const QString& name, const QString& desc,
34  const QString& icon )
35  : KDialog( parent ),
36  mname( name ), mdesc( desc ), micon( icon )
37 {
38  setCaption( i18n( "Edit Type" ) );
39  setButtons( Help | Ok | Cancel );
40 
41  QWidget* base = new QWidget( this );
42  setMainWidget( base );
43  medittypewidget = new Ui_EditTypeWidget();
44  medittypewidget->setupUi( base );
45  base->layout()->setMargin( 0 );
46 
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." ) );
58 
59  connect( this, SIGNAL( helpClicked() ), this, SLOT( slotHelp() ) );
60  connect( this, SIGNAL( okClicked() ), this, SLOT( slotOk() ) );
61  connect( this, SIGNAL( cancelClicked() ), this, SLOT( slotCancel() ) );
62 
63  resize( 450, 150 );
64 }
65 
66 EditType::~EditType()
67 {
68  delete medittypewidget;
69 }
70 
71 void EditType::slotHelp()
72 {
73  KToolInvocation::invokeHelp( "working-with-types", "kig" );
74 }
75 
76 void EditType::slotOk()
77 {
78  QString tmp = medittypewidget->editName->text();
79  if ( tmp.isEmpty() )
80  {
81  KMessageBox::information( this, i18n( "The name of the macro can not be empty." ) );
82  return;
83  }
84 
85  bool namechanged = false;
86  bool descchanged = false;
87  bool iconchanged = false;
88  if ( tmp != mname )
89  {
90  mname = tmp;
91  namechanged = true;
92  }
93  tmp = medittypewidget->editDescription->text();
94  if ( tmp != mdesc )
95  {
96  mdesc = tmp;
97  descchanged = true;
98  }
99  tmp = medittypewidget->typeIcon->icon();
100  if ( tmp != micon )
101  {
102  micon = tmp;
103  iconchanged = true;
104  }
105  done( namechanged || descchanged || iconchanged );
106 }
107 
108 void EditType::slotCancel()
109 {
110  done( 0 );
111 }
112 
113 QString EditType::name() const
114 {
115  return mname;
116 }
117 
118 QString EditType::description() const
119 {
120  return mdesc;
121 }
122 
123 QString EditType::icon() const
124 {
125  return micon;
126 }
edittype.h
QWidget
KDialog
EditType::~EditType
~EditType()
Definition: edittype.cc:66
EditType::name
QString name() const
Definition: edittype.cc:113
EditType::icon
QString icon() const
Definition: edittype.cc:123
EditType::EditType
EditType(QWidget *parent, const QString &name=QString(), const QString &desc=QString(), const QString &icon=QString())
Definition: edittype.cc:33
EditType::description
QString description() const
Definition: edittype.cc:118
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:35:39 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kig

Skip menu "kig"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal