lib Library API Documentation

koversiondialog.cc

00001 /* This file is part of the KDE project
00002    Copyright (C) 2005 Laurent Montel <montel@kde.org>
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; either
00007    version 2 of the License, or (at your option) any later version.
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., 59 Temple Place - Suite 330,
00017    Boston, MA 02111-1307, USA.
00018 */
00019 
00020 
00021 #include <qlabel.h>
00022 #include <qlayout.h>
00023 #include <qmultilineedit.h>
00024 #include <qpushbutton.h>
00025 #include <qtoolbutton.h>
00026 #include <qapplication.h>
00027 #include <qlayout.h>
00028 #include <kiconloader.h>
00029 #include <kbuttonbox.h>
00030 #include <kdebug.h>
00031 #include <kmessagebox.h>
00032 #include <klocale.h>
00033 #include <klistview.h>
00034 #include <kdebug.h>
00035 
00036 #include <qmultilineedit.h>
00037 
00038 #include "koversiondialog.h"
00039 
00040 
00041 KoVersionDialog::KoVersionDialog( QWidget* parent,  const char* name )
00042     : KDialogBase( parent, name, true, i18n("Version"), Ok|Cancel )
00043 {
00044   QWidget* page = new QWidget( this );
00045   setMainWidget( page );
00046 
00047   QGridLayout *grid1 = new QGridLayout( page,10,3,KDialog::marginHint(), KDialog::spacingHint());
00048 
00049   list=new KListView(page,  "versionlist");
00050   list->addColumn(i18n("Date & Time"));
00051   list->addColumn(i18n("Saved By"));
00052   list->addColumn(i18n("Comment"));
00053 
00054   grid1->addMultiCellWidget(list,0,8,0,0);
00055 
00056   m_pAdd=new QPushButton(i18n("&Add"),page);
00057   grid1->addWidget(m_pAdd,1,2);
00058 
00059   m_pRemove=new QPushButton(i18n("&Remove"),page);
00060   grid1->addWidget(m_pRemove,2,2);
00061 
00062   m_pModify=new QPushButton(i18n("&Modify"),page);
00063   grid1->addWidget(m_pModify,3,2);
00064 
00065   m_pOpen=new QPushButton(i18n("&Open"),page);
00066   grid1->addWidget(m_pOpen,4,2);
00067 
00068 
00069   connect( m_pRemove, SIGNAL( clicked() ), this, SLOT( slotRemove() ) );
00070   connect( m_pAdd, SIGNAL( clicked() ), this, SLOT( slotAdd() ) );
00071   connect( m_pOpen, SIGNAL( clicked() ), this, SLOT( slotOpen() ) );
00072   connect( m_pModify, SIGNAL( clicked() ), this, SLOT( slotModify() ) );
00073 
00074   updateButton();
00075 
00076   resize( 600, 250 );
00077 
00078 }
00079 
00080 KoVersionDialog::~KoVersionDialog()
00081 {
00082 }
00083 
00084 void KoVersionDialog::updateButton()
00085 {
00086 #if 0
00087     bool state = ( list->currentItem() >= 0 );
00088     m_pRemove->setEnabled( state );
00089 #endif
00090 }
00091 
00092 void KoVersionDialog::slotAdd()
00093 {
00094     //TODO create entry
00095 }
00096 
00097 void KoVersionDialog::slotRemove()
00098 {
00099     //TODO remove entry
00100 }
00101 
00102 void KoVersionDialog::slotModify()
00103 {
00104     KoVersionModifyDialog * dlg = new KoVersionModifyDialog(  this /*, const QString &_comment*/ /*TODO add*/ );
00105     if ( dlg->exec() )
00106     {
00107         //TODO
00108         kdDebug()<<" comment :"<<dlg->comment()<<endl;
00109     }
00110     delete dlg;
00111 
00112 }
00113 
00114 void KoVersionDialog::slotOpen()
00115 {
00116     //TODO open file
00117 }
00118 
00119 void KoVersionDialog::slotOk()
00120 {
00121     accept();
00122 }
00123 
00124 KoVersionModifyDialog::KoVersionModifyDialog(  QWidget* parent, const QString &_comment, const char* name )
00125     : KDialogBase( parent, name, true, i18n("Comment"), Ok|Cancel )
00126 {
00127     QWidget* page = new QWidget( this );
00128     setMainWidget( page );
00129 
00130     QHBoxLayout *grid1 = new QHBoxLayout( page,KDialog::marginHint(), KDialog::spacingHint());
00131 
00132     m_multiline=new QMultiLineEdit(page, "multiline");
00133     grid1->addWidget( m_multiline );
00134 
00135 }
00136 
00137 QString KoVersionModifyDialog::comment() const
00138 {
00139     return m_multiline->text();
00140 }
00141 
00142 
00143 #include "koversiondialog.moc"
KDE Logo
This file is part of the documentation for lib Library Version 1.4.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Mon Feb 13 09:40:14 2006 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003