F:/KPlato/koffice/kplato/kptresourcesdialog.cc

Aller à la documentation de ce fichier.
00001 /* This file is part of the KDE project
00002    Copyright (C) 2005 Dag Andersen <danders@get2net.dk>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation;
00007    version 2 of the License.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #include <klocale.h>
00021 #include <kcommand.h>
00022 
00023 #include <kdebug.h>
00024 
00025 #include "kptresourcesdialog.h"
00026 #include "kptproject.h"
00027 #include "kptresourcespanel.h"
00028 #include "kptresource.h"
00029 
00030 namespace KPlato
00031 {
00032 
00033 ResourcesDialog::ResourcesDialog(Project &p, QWidget *parent, const char *name)
00034     : KDialog( parent),
00035       project(p)
00036 {
00037     setCaption( i18n("Resources") );
00038     setButtons( Ok|Cancel );
00039     setDefaultButton( Ok );
00040     showButtonSeparator( true );
00041     panel = new ResourcesPanel(this, &project);
00042 
00043     setMainWidget(panel);
00044     enableButtonOk(false);
00045 
00046     connect(this, SIGNAL(okClicked()), SLOT(slotOk()));
00047     connect(panel, SIGNAL(changed()), SLOT(slotChanged()));
00048 }
00049 
00050 
00051 void ResourcesDialog::slotChanged() {
00052     enableButtonOk(true);
00053 }
00054 
00055 void ResourcesDialog::slotOk() {
00056     if (!panel->ok())
00057         return;
00058     accept();
00059 }
00060 
00061 KCommand *ResourcesDialog::buildCommand(Part *part) {
00062     KMacroCommand *m = 0;
00063     QString c = i18n("Modify resources");
00064     KCommand *cmd = panel->buildCommand(part);
00065     if (cmd) {
00066         if (!m) m = new KMacroCommand(c);
00067         m->addCommand(cmd);
00068     }
00069     return m;
00070 }
00071 
00072 }  //KPlato namespace
00073 
00074 #include "kptresourcesdialog.moc"

Généré le Wed Nov 22 23:40:57 2006 pour KPlato par  doxygen 1.5.1-p1