1
/* ============================================================
2
* File : imagedescedit.cpp
3
* Author: Renchi Raju <renchi@pooh.tam.uiuc.edu>
7
* Copyright 2003 by Renchi Raju
9
* This program is free software; you can redistribute it
10
* and/or modify it under the terms of the GNU General
11
* Public License as published bythe Free Software Foundation;
12
* either version 2, or (at your option)
15
* This program is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
* GNU General Public License for more details.
20
* ============================================================ */
25
#include <qtextedit.h>
27
#include <qgroupbox.h>
29
#include "imagedescedit.h"
32
ImageDescEdit::ImageDescEdit(const QString& itemName,
33
const QString& itemComments,
35
: KDialogBase( Plain, i18n("Image Comments"), Ok|Cancel, Ok,
36
parent, 0, true, true )
40
QVBoxLayout *topLayout = new QVBoxLayout( plainPage(),
43
QGroupBox* groupBox = new QGroupBox( plainPage() );
44
groupBox->setTitle(i18n("Image Comments"));
45
topLayout->addWidget(groupBox);
47
groupBox->setColumnLayout(0, Qt::Vertical );
48
groupBox->layout()->setSpacing( 5 );
49
groupBox->layout()->setMargin( 5 );
51
QGridLayout *groupBoxLayout =
52
new QGridLayout( groupBox->layout() );
53
groupBoxLayout->setAlignment( Qt::AlignTop );
55
// ------------------------------------------------
57
QLabel* nameL = new QLabel(groupBox);
58
nameL->setText(i18n("Name: ") + mItemName);
59
groupBoxLayout->addWidget(nameL, 0, 0);
61
QLabel* commentsL = new QLabel(groupBox);
62
commentsL->setText(i18n("Comments: "));
63
groupBoxLayout->addWidget(commentsL, 1, 0);
65
mCommentsEdit = new QTextEdit(groupBox);
66
groupBoxLayout->addWidget(mCommentsEdit, 2, 0);
68
mCommentsEdit->setFocus();
70
// -- Init Values ---------------------------------
71
enableButtonOK(false);
72
mCommentsEdit->setText(itemComments);
74
// -- Setup Connections ---------------------------
76
connect(mCommentsEdit, SIGNAL(textChanged()),
77
this, SLOT(slot_textChanged()));
82
ImageDescEdit::~ImageDescEdit()
87
void ImageDescEdit::slot_textChanged()
93
bool ImageDescEdit::editComments(const QString& itemName,
94
QString& itemComments,
98
ImageDescEdit dlg(itemName, itemComments, parent);
100
bool ok = dlg.exec() == QDialog::Accepted;
101
itemComments = dlg.mCommentsEdit->text();