lib

Koversiondialog.cpp
1/* This file is part of the KDE project
2 Copyright (C) 2005 Laurent Montel <montel@kde.org>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20
21#include <tqlabel.h>
22#include <tqlayout.h>
23#include <tqmultilineedit.h>
24#include <tqpushbutton.h>
25#include <tqtoolbutton.h>
26#include <tqapplication.h>
27#include <tqlayout.h>
28#include <kiconloader.h>
29#include <kbuttonbox.h>
30#include <kdebug.h>
31#include <tdemessagebox.h>
32#include <tdelocale.h>
33#include <tdelistview.h>
34#include <kdebug.h>
35
36#include <tqmultilineedit.h>
37
38#include "Koversiondialog.h"
39
40
41KoVersionDialog::KoVersionDialog( TQWidget* parent, const char* name )
42 : KDialogBase( parent, name, true, i18n("Version"), Ok|Cancel )
43{
44 TQWidget* page = new TQWidget( this );
45 setMainWidget( page );
46
47 TQGridLayout *grid1 = new TQGridLayout( page,10,3,KDialog::marginHint(), KDialog::spacingHint());
48
49 list=new TDEListView(page, "versionlist");
50 list->addColumn(i18n("Date & Time"));
51 list->addColumn(i18n("Saved By"));
52 list->addColumn(i18n("Comment"));
53
54 grid1->addMultiCellWidget(list,0,8,0,0);
55
56 m_pAdd=new TQPushButton(i18n("&Add"),page);
57 grid1->addWidget(m_pAdd,1,2);
58
59 m_pRemove=new TQPushButton(i18n("&Remove"),page);
60 grid1->addWidget(m_pRemove,2,2);
61
62 m_pModify=new TQPushButton(i18n("&Modify"),page);
63 grid1->addWidget(m_pModify,3,2);
64
65 m_pOpen=new TQPushButton(i18n("&Open"),page);
66 grid1->addWidget(m_pOpen,4,2);
67
68
69 connect( m_pRemove, TQ_SIGNAL( clicked() ), this, TQ_SLOT( slotRemove() ) );
70 connect( m_pAdd, TQ_SIGNAL( clicked() ), this, TQ_SLOT( slotAdd() ) );
71 connect( m_pOpen, TQ_SIGNAL( clicked() ), this, TQ_SLOT( slotOpen() ) );
72 connect( m_pModify, TQ_SIGNAL( clicked() ), this, TQ_SLOT( slotModify() ) );
73
74 updateButton();
75
76 resize( 600, 250 );
77
78}
79
80KoVersionDialog::~KoVersionDialog()
81{
82}
83
84void KoVersionDialog::updateButton()
85{
86#if 0
87 bool state = ( list->currentItem() >= 0 );
88 m_pRemove->setEnabled( state );
89#endif
90}
91
92void KoVersionDialog::slotAdd()
93{
94 //TODO create entry
95}
96
97void KoVersionDialog::slotRemove()
98{
99 //TODO remove entry
100}
101
102void KoVersionDialog::slotModify()
103{
104 KoVersionModifyDialog * dlg = new KoVersionModifyDialog( this /*, const TQString &_comment*/ /*TODO add*/ );
105 if ( dlg->exec() )
106 {
107 //TODO
108 kdDebug()<<" comment :"<<dlg->comment()<<endl;
109 }
110 delete dlg;
111
112}
113
114void KoVersionDialog::slotOpen()
115{
116 //TODO open file
117}
118
120{
121 accept();
122}
123
124KoVersionModifyDialog::KoVersionModifyDialog( TQWidget* parent, const TQString &/*comment*/, const char* name )
125 : KDialogBase( parent, name, true, i18n("Comment"), Ok|Cancel )
126{
127 TQWidget* page = new TQWidget( this );
128 setMainWidget( page );
129
130 TQHBoxLayout *grid1 = new TQHBoxLayout( page,KDialog::marginHint(), KDialog::spacingHint());
131
132 m_multiline=new TQMultiLineEdit(page, "multiline");
133 grid1->addWidget( m_multiline );
134
135}
136
137TQString KoVersionModifyDialog::comment() const
138{
139 return m_multiline->text();
140}
141
142
143#include "Koversiondialog.moc"
virtual void slotOk()
static int marginHint()
static int spacingHint()
const char * name(StdAction id)