~ubuntu-branches/ubuntu/edgy/digikam/edgy-updates

« back to all changes in this revision

Viewing changes to digikam/imagedescedit.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Achim Bohnet
  • Date: 2005-03-10 02:39:02 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 hoary)
  • Revision ID: james.westby@ubuntu.com-20050310023902-023nymfst5mg696c
Tags: 0.7.2-2
* debian/TODO: clean
* digikam manpage: better --detect-camera description

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* ============================================================
2
 
 * File  : imagedescedit.cpp
3
 
 * Author: Renchi Raju <renchi@pooh.tam.uiuc.edu>
4
 
 * Date  : 2003-03-09
5
 
 * Description :
6
 
 *
7
 
 * Copyright 2003 by Renchi Raju
8
 
 *
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)
13
 
 * any later version.
14
 
 *
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.
19
 
 *
20
 
 * ============================================================ */
21
 
 
22
 
#include <klocale.h>
23
 
 
24
 
#include <qlabel.h>
25
 
#include <qtextedit.h>
26
 
#include <qlayout.h>
27
 
#include <qgroupbox.h>
28
 
 
29
 
#include "imagedescedit.h"
30
 
 
31
 
 
32
 
ImageDescEdit::ImageDescEdit(const QString& itemName,
33
 
                             const QString& itemComments,
34
 
                             QWidget *parent)
35
 
    : KDialogBase( Plain, i18n("Image Comments"), Ok|Cancel, Ok,
36
 
                   parent, 0, true, true )
37
 
{
38
 
    mItemName = itemName;
39
 
 
40
 
    QVBoxLayout *topLayout = new QVBoxLayout( plainPage(),
41
 
                                              0, spacingHint() );
42
 
 
43
 
    QGroupBox* groupBox = new QGroupBox( plainPage() );
44
 
    groupBox->setTitle(i18n("Image Comments"));
45
 
    topLayout->addWidget(groupBox);
46
 
 
47
 
    groupBox->setColumnLayout(0, Qt::Vertical );
48
 
    groupBox->layout()->setSpacing( 5 );
49
 
    groupBox->layout()->setMargin( 5 );
50
 
 
51
 
    QGridLayout *groupBoxLayout =
52
 
        new QGridLayout( groupBox->layout() );
53
 
    groupBoxLayout->setAlignment( Qt::AlignTop );
54
 
 
55
 
    // ------------------------------------------------
56
 
 
57
 
    QLabel* nameL = new QLabel(groupBox);
58
 
    nameL->setText(i18n("Name: ") + mItemName);
59
 
    groupBoxLayout->addWidget(nameL, 0, 0);
60
 
 
61
 
    QLabel* commentsL = new QLabel(groupBox);
62
 
    commentsL->setText(i18n("Comments: "));
63
 
    groupBoxLayout->addWidget(commentsL, 1, 0);
64
 
 
65
 
    mCommentsEdit = new QTextEdit(groupBox);
66
 
    groupBoxLayout->addWidget(mCommentsEdit, 2, 0);
67
 
 
68
 
    mCommentsEdit->setFocus();
69
 
 
70
 
    // -- Init Values ---------------------------------
71
 
    enableButtonOK(false);
72
 
    mCommentsEdit->setText(itemComments);
73
 
 
74
 
    // -- Setup Connections ---------------------------
75
 
 
76
 
    connect(mCommentsEdit, SIGNAL(textChanged()),
77
 
            this, SLOT(slot_textChanged()));
78
 
    
79
 
    resize(400, 300);
80
 
}
81
 
 
82
 
ImageDescEdit::~ImageDescEdit()
83
 
{
84
 
}
85
 
 
86
 
 
87
 
void ImageDescEdit::slot_textChanged()
88
 
{
89
 
    enableButtonOK(true);
90
 
}
91
 
 
92
 
 
93
 
bool ImageDescEdit::editComments(const QString& itemName,
94
 
                                 QString& itemComments,
95
 
                                 QWidget *parent
96
 
                                )
97
 
{
98
 
    ImageDescEdit dlg(itemName, itemComments, parent);
99
 
 
100
 
    bool ok = dlg.exec() == QDialog::Accepted;
101
 
    itemComments = dlg.mCommentsEdit->text();
102
 
    return ok;
103
 
}