summaryrefslogtreecommitdiffstats
path: root/kipi-plugins/galleryexport/galleryconfig.cpp
blob: 32ffa87f09ccaa7b907286ef44e8e4da3fc4e0f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
/* ============================================================
 * File  : galleryconfig.cpp
 * Author: Colin Guthrie <kde@colin.guthr.ie>
 * Date  : 2006-09-04
 * Copyright 2006 by Colin Guthrie <kde@colin.guthr.ie>
 *
 * This program is free software; you can redistribute it
 * and/or modify it under the terms of the GNU General
 * Public License as published by the Free Software Foundation;
 * either version 2, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * ============================================================ */

// Include files for TQt

#include <tqlistview.h>
#include <tqpushbutton.h>
#include <tqtimer.h>
#include <tqpixmap.h>
#include <tqcursor.h>
#include <tqlineedit.h>
#include <tqprogressdialog.h>
#include <tqspinbox.h>
#include <tqcheckbox.h>
#include <tqlayout.h>

// Include files for KDE

#include <klocale.h>
#include <kmessagebox.h>
#include <kapplication.h>
#include <kiconloader.h>
#include <tdehtml_part.h>
#include <tdehtmlview.h>
#include <krun.h>
#include <kdebug.h>
#include <tdeconfig.h>

// KIPI include files

#include <libkipi/version.h>
#include <libkipi/interface.h>
#include <libkipi/imagedialog.h>

// Local includes.

#include "galleryconfig.h"
#include "galleries.h"

namespace KIPIGalleryExportPlugin
{

GalleryEdit::GalleryEdit(TQWidget* pParent,
                         Gallery* pGallery,
                         TQString title)
    : KDialogBase(pParent, 0, true, title, Ok|Cancel, Ok, false),
      mpGallery(pGallery)
{
  setButtonGuiItem( Ok, KStdGuiItem::save() );

  TQFrame *page = new TQFrame (this);
  TQHBoxLayout *tll = new TQHBoxLayout(page);
  page->setMinimumSize (500, 200);
  setMainWidget(page);

  TQVBoxLayout* vbox = new TQVBoxLayout();
  vbox->setSpacing (KDialog::spacingHint());
  tll->addItem(vbox);

  mpHeaderLabel = new TQLabel(page);
  mpHeaderLabel->setSizePolicy(TQSizePolicy(TQSizePolicy::Minimum,
                                            TQSizePolicy::Fixed));
  mpHeaderLabel->setText(title);
  vbox->addWidget(mpHeaderLabel);

  TQFrame* hline = new TQFrame(page, "hline");
  hline->setFrameShape(TQFrame::HLine);
  hline->setFrameShadow(TQFrame::Sunken);
  hline->setFrameShape(TQFrame::HLine);
  vbox->addWidget(hline);

  TQGridLayout* centerLayout = new TQGridLayout(0, 1, 1, 5, 5);

  mpNameEdit = new TQLineEdit( this );
  centerLayout->addWidget(mpNameEdit, 0, 1);

  mpUrlEdit = new TQLineEdit( this );
  centerLayout->addWidget(mpUrlEdit, 1, 1);

  mpUsernameEdit = new TQLineEdit( this );
  centerLayout->addWidget(mpUsernameEdit, 2, 1);

  mpPasswordEdit = new TQLineEdit( this );
  mpPasswordEdit->setEchoMode(TQLineEdit::Password);
  centerLayout->addWidget(mpPasswordEdit, 3, 1);

  TQLabel* name_label = new TQLabel(this);
  name_label->setText(i18n( "Name:" ));
  centerLayout->addWidget(name_label, 0, 0);

  TQLabel* urlLabel = new TQLabel(this);
  urlLabel->setText(i18n( "URL:" ));
  centerLayout->addWidget(urlLabel, 1, 0);

  TQLabel* nameLabel = new TQLabel(this);
  nameLabel->setText(i18n( "Username:" ));
  centerLayout->addWidget(nameLabel, 2, 0);

  TQLabel* passwdLabel = new TQLabel(this);
  passwdLabel->setText(i18n( "Password:" ));
  centerLayout->addWidget(passwdLabel, 3, 0);

  //---------------------------------------------
  mpGalleryVersion = new TQCheckBox( i18n("Use &Gallery 2"), this);
  mpGalleryVersion->setChecked( 2 == pGallery->version() );
  centerLayout->addWidget( mpGalleryVersion, 4, 1 );
  //---------------------------------------------

  vbox->addLayout( centerLayout );

  resize( TQSize(300, 150).expandedTo(minimumSizeHint()) );
  clearWState( WState_Polished );

  mpNameEdit->setText(pGallery->name());
  mpUrlEdit->setText(pGallery->url());
  mpUsernameEdit->setText(pGallery->username());
  mpPasswordEdit->setText(pGallery->password());
}

GalleryEdit::~GalleryEdit()
{

}

void GalleryEdit::slotOk(void)
{
  if (mpNameEdit->isModified())
    mpGallery->setName(mpNameEdit->text());
  if (mpUrlEdit->isModified())
    mpGallery->setUrl(mpUrlEdit->text());
  if (mpUsernameEdit->isModified())
    mpGallery->setUsername(mpUsernameEdit->text());
  if (mpPasswordEdit->isModified())
    mpGallery->setPassword(mpPasswordEdit->text());
  if (mpGalleryVersion->isChecked())
    mpGallery->setVersion(2);
  else
    mpGallery->setVersion(1);
  accept();
}

}

#include "galleryconfig.moc"