~ubuntu-branches/debian/sid/kdevelop/sid

« back to all changes in this revision

Viewing changes to parts/distpart/distpart_widget.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jeremy Lainé
  • Date: 2006-05-23 18:39:42 UTC
  • Revision ID: james.westby@ubuntu.com-20060523183942-hucifbvh68k2bwz7
Tags: upstream-3.3.2
Import upstream version 3.3.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
 *   Copyright (C) 2004 by ian reinhart geiser                             *
 
3
 *   geiseri@kde.org                                                       *
 
4
 *                                                                         *
 
5
 *   This program is free software; you can redistribute it and/or modify  *
 
6
 *   it under the terms of the GNU General Public License as published by  *
 
7
 *   the Free Software Foundation; either version 2 of the License, or     *
 
8
 *   (at your option) any later version.                                   *
 
9
 *                                                                         *
 
10
 *   This program is distributed in the hope that it will be useful,       *
 
11
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 
12
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 
13
 *   GNU General Public License for more details.                          *
 
14
 *                                                                         *
 
15
 *   You should have received a copy of the GNU General Public License     *
 
16
 *   along with this program; if not, write to the                         *
 
17
 *   Free Software Foundation, Inc.,                                       *
 
18
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 
19
 ***************************************************************************/
 
20
#include "distpart_widget.h"
 
21
 
 
22
#include <kparts/part.h>
 
23
#include <klibloader.h>
 
24
#include <kurl.h>
 
25
#include <kdebug.h>
 
26
#include <kprocess.h>
 
27
#include <kfiledialog.h>
 
28
#include <kio/netaccess.h>
 
29
#include <klocale.h>
 
30
#include "kdevproject.h"
 
31
#include "domutil.h"
 
32
#include <ktar.h>
 
33
#include <kmessagebox.h>
 
34
 
 
35
#include <kdevcore.h>
 
36
#include <qgroupbox.h>
 
37
#include <qlayout.h>
 
38
#include <qnetwork.h>
 
39
#include <qurloperator.h>
 
40
#include <qmessagebox.h>
 
41
#include "distpart_part.h"
 
42
#include <qdir.h>
 
43
#include <qfile.h>
 
44
#include <qregexp.h>
 
45
#include <qstringlist.h>
 
46
#include <qtabwidget.h>
 
47
#include "kdevmakefrontend.h"
 
48
#include <kprogress.h>
 
49
 
 
50
#include <qerrormessage.h>
 
51
#include "specsupport.h"
 
52
#include "lsmsupport.h"
 
53
 
 
54
DistpartDialog::DistpartDialog(DistpartPart *part, QWidget *parent)
 
55
        :distpart_ui(parent, "dist_widget"), m_part(part) {
 
56
    m_spec = new SpecSupport(m_part);
 
57
 
 
58
    connect( customProjectCheckBox, SIGNAL(toggled(bool) ),
 
59
            this, SLOT(slotcustomProjectCheckBoxChanged()));
 
60
    connect( uploadCustomCheckBox, SIGNAL(toggled(bool)),
 
61
            this, SLOT(slotuploadCustomCheckBoxChanged()));
 
62
 
 
63
//    connect( okayPushButton, SIGNAL(clicked()),
 
64
//            this, SLOT(slotokayPushButtonPressed()));
 
65
//    connect( cancelPushButton, SIGNAL(clicked()),
 
66
//            this, SLOT(slotcancelPushButtonPressed()));
 
67
/*    connect(help_PushButton, SIGNAL(clicked()),
 
68
            this, SLOT(slothelp_PushButtonPressed()));*/
 
69
    connect( createSrcArchPushButton, SIGNAL(clicked()),
 
70
            this, SLOT(slotcreateSrcArchPushButtonPressed()));
 
71
    connect( resetSrcPushButton, SIGNAL(clicked()),
 
72
            this, SLOT(slotresetSrcPushButtonPressed()));
 
73
 
 
74
    connect( genHTMLPushButton, SIGNAL(clicked()),
 
75
            this, SLOT(slotgenHTMLPushButtonPressed()));
 
76
    connect( resetHTMLPushButton, SIGNAL(clicked()),
 
77
            this, SLOT(slotresetHTMLPushButtonPressed()));
 
78
    connect( uploadSubmitPushButton, SIGNAL(clicked()),
 
79
            this, SLOT(slotuploadSubmitPushButtonPressed()));
 
80
    connect( uploadResetPushButton, SIGNAL(clicked()),
 
81
            this, SLOT(slotuploadResetPushButtonPressed()));
 
82
    connect( uploadAddFileToolButton, SIGNAL(clicked()),
 
83
            this, SLOT(slotuploadAddFileToolButtonPressed()));
 
84
    connect( uploadRemoveToolButton, SIGNAL(clicked()),
 
85
            this, SLOT(slotuploadRemoveToolButtonPressed()));
 
86
//      connect(  buildAllPushButton, SIGNAL( clicked() ), this, SLOT( slotbuildAllPushButtonPressed() ));
 
87
//      connect(  exportSPECPushButton, SIGNAL( clicked() ), this, SLOT( slotexportSPECPushButtonPressed( ) ) );
 
88
//      connect(  srcPackagePushButton, SIGNAL( clicked() ), this, SLOT( slotsrcPackagePushButtonPressed() ) );
 
89
//      connect(  importSPECPushButton, SIGNAL( clicked() ), this, SLOT( slotimportSPECPushButtonPressed() ) );
 
90
    loadSettings();
 
91
 
 
92
 
 
93
     localOptionsGroupBox->setEnabled(false);
 
94
     devPackageCheckBox->setEnabled(false);
 
95
     docsPackageCheckBox->setEnabled(false);
 
96
     appIconCheckBox->setEnabled(false);
 
97
     uploadftpkdeorgCheckBox->setEnabled(false);
 
98
     uploadAppsKDEcomCheckBox->setEnabled(false);
 
99
}
 
100
 
 
101
 
 
102
DistpartDialog::~DistpartDialog() {
 
103
}
 
104
 
 
105
//    QPushButton* okayPushButton;
 
106
 
 
107
void DistpartDialog::slotokayPushButtonPressed() {
 
108
    storeSettings();
 
109
//    accept();
 
110
}
 
111
//    QPushButton* cancelPushButton;
 
112
 
 
113
void DistpartDialog::slotcancelPushButtonPressed() {
 
114
//    reject();
 
115
}
 
116
//    QPushButton* help_PushButton;
 
117
 
 
118
/*void DistpartDialog::slothelp_PushButtonPressed() {
 
119
    QMessageBox::about(this,i18n("Distpart Help"),i18n("In order to build a RPM package :\n\t1) Create a source archive\n\t2) Generate a SPEC File\n\t3) Build the package"));
 
120
}*/
 
121
 
 
122
//    QPushButton* createSrcArchPushButton;
 
123
void DistpartDialog::slotcreateSrcArchPushButtonPressed() {
 
124
    kdDebug() << "Starting archive..." << endl;
 
125
    QString dist = (getcustomProjectCheckBoxState() && getbzipCheckBoxState()) ? "application/x-bzip2" : "application/x-gzip";
 
126
 
 
127
    QString filename = m_part->project()->projectDirectory() + "/" + getappNameFormatLineEditText() +
 
128
                       "-" +
 
129
                       getversionLineEditText() +
 
130
                       ((getcustomProjectCheckBoxState() && getbzipCheckBoxState()) ? ".tar.bz2" : ".tar.gz");
 
131
 
 
132
    KTar tar(filename, dist);
 
133
    if ( tar.open(IO_WriteOnly) )
 
134
    {
 
135
        QStringList files = m_part->project()->distFiles();
 
136
        KProgressDialog *prog = new KProgressDialog( 0, "dialog", i18n("Building Package"), "", true );
 
137
        prog->show();
 
138
        for( uint idx = 0; idx < files.count(); ++idx)
 
139
        {
 
140
                if ( !tar.addLocalFile( m_part->project()->projectDirectory() + "/" + files[idx], getappNameFormatLineEditText() + "/" + files[idx]) )
 
141
                {
 
142
                        kdDebug() << "Failed to write file " << files[idx] << endl;
 
143
                }
 
144
                else
 
145
                {
 
146
                        prog->setLabel(i18n("Adding file: %1").arg( files[idx]) );
 
147
                        prog->progressBar()->setValue( (idx*100)/files.count() );
 
148
                }
 
149
        }
 
150
        tar.close( );
 
151
        prog->hide();
 
152
        delete prog;
 
153
        KMessageBox::information( this, i18n("Archive made at: %1").arg( filename ), i18n("Archive Done") );
 
154
 
 
155
    }
 
156
    else
 
157
    {
 
158
        kdDebug() << "Failed to open archive..." << endl;
 
159
    }
 
160
 
 
161
}
 
162
 
 
163
//    QPushButton* resetSrcPushButton;
 
164
void DistpartDialog::slotresetSrcPushButtonPressed() {}
 
165
 
 
166
 
 
167
 
 
168
//    QPushButton* genHTMLPushButton;
 
169
void DistpartDialog::slotgenHTMLPushButtonPressed() {}
 
170
 
 
171
//    QPushButton* resetHTMLPushButton;
 
172
void DistpartDialog::slotresetHTMLPushButtonPressed() {}
 
173
 
 
174
//    QToolButton* uploadAddFileToolButton;
 
175
void DistpartDialog::slotuploadAddFileToolButtonPressed() {
 
176
     uploadFileListBox->insertStringList(KFileDialog::getOpenFileNames());
 
177
}
 
178
 
 
179
//    QToolButton* uploadRemoveToolButton;
 
180
void DistpartDialog::slotuploadRemoveToolButtonPressed() {
 
181
    for(unsigned int i=0; i<  uploadFileListBox->count(); i++)
 
182
        if ( uploadFileListBox->isSelected(i))  uploadFileListBox->removeItem(i);
 
183
}
 
184
 
 
185
//    QPushButton* uploadSubmitPushButton;
 
186
void DistpartDialog::slotuploadSubmitPushButtonPressed() {
 
187
 
 
188
    if(getuploadftpkdeorgCheckBoxState() || getuploadAppsKDEcomCheckBoxState())
 
189
        kdDebug() << "Implement ftp.kde.org & apps.kde.com ftp transfer" << endl;
 
190
    else {
 
191
        for(unsigned int i=0; i< uploadFileListBox->count(); i++)
 
192
            KIO::NetAccess::copy(KURL::fromPathOrURL( uploadFileListBox->text(i) ),
 
193
                    KURL::fromPathOrURL( getuploadURLLineEditText() +  uploadFileListBox->text(i).replace(QRegExp("[^/]*/"),"") ));
 
194
    }
 
195
}
 
196
 
 
197
//    QPushButton* uploadResetPushButton;
 
198
void DistpartDialog::slotuploadResetPushButtonPressed() {
 
199
     uploadFileListBox->clear();
 
200
}
 
201
 
 
202
// Connect Slots to the following widgets and add
 
203
// accessors and mutators
 
204
 
 
205
 
 
206
//    QCheckBox* customProjectCheckBox;
 
207
void DistpartDialog::slotcustomProjectCheckBoxChanged() {
 
208
    kdDebug () << "New State" <<  customProjectCheckBox->isChecked() << endl;
 
209
     sourceOptionsGroupBox->setEnabled( customProjectCheckBox->isChecked());
 
210
}
 
211
 
 
212
bool DistpartDialog::getcustomProjectCheckBoxState() {
 
213
    return  customProjectCheckBox->isChecked();
 
214
}
 
215
 
 
216
void DistpartDialog::setcustomProjectCheckBoxState(bool state) {
 
217
     customProjectCheckBox->setChecked(state);
 
218
}
 
219
 
 
220
//  QCheckBox* uploadCustomCheckBox;
 
221
void DistpartDialog::slotuploadCustomCheckBoxChanged() {
 
222
     uploadURLLineEdit->setEnabled( uploadCustomCheckBox->isChecked());
 
223
}
 
224
 
 
225
bool DistpartDialog::getuploadCustomCheckBoxState() {
 
226
    return  uploadCustomCheckBox->isChecked();
 
227
}
 
228
 
 
229
void DistpartDialog::setuploadCustomCheckBoxState(bool state) {
 
230
     uploadCustomCheckBox->setChecked(state);
 
231
}
 
232
 
 
233
// Add accessors and mutators for the following
 
234
 
 
235
//   QCheckBox* bzipCheckBox;
 
236
bool DistpartDialog::getbzipCheckBoxState() {
 
237
    return  bzipCheckBox->isChecked();
 
238
}
 
239
 
 
240
void DistpartDialog::setbzipCheckBoxState(bool state) {
 
241
     bzipCheckBox->setChecked(state);
 
242
}
 
243
 
 
244
//    QCheckBox* appIconCheckBox;
 
245
bool DistpartDialog::getappIconCheckBoxState() {
 
246
    return  appIconCheckBox->isChecked();
 
247
}
 
248
 
 
249
void DistpartDialog::setappIconCheckBoxState(bool state) {
 
250
     appIconCheckBox->setChecked(state);
 
251
}
 
252
 
 
253
//    QCheckBox* genHTMLCheckBox;
 
254
bool DistpartDialog::getgenHTMLCheckBoxState() {
 
255
    return  genHTMLCheckBox->isChecked();
 
256
}
 
257
 
 
258
void DistpartDialog::setgenHTMLCheckBoxState(bool state) {
 
259
     genHTMLCheckBox->setChecked(state);
 
260
}
 
261
 
 
262
//    QCheckBox* useRPMInfoCheckBox;
 
263
bool DistpartDialog::getuseRPMInfoCheckBoxState() {
 
264
    return  useRPMInfoCheckBox->isChecked();
 
265
}
 
266
 
 
267
void DistpartDialog::setuseRPMInfoCheckBoxState(bool state) {
 
268
     useRPMInfoCheckBox->setChecked(state);
 
269
}
 
270
 
 
271
//    QCheckBox* uploadAppsKDEcomCheckBox;
 
272
bool DistpartDialog::getuploadAppsKDEcomCheckBoxState() {
 
273
    return  uploadAppsKDEcomCheckBox->isChecked();
 
274
}
 
275
 
 
276
void DistpartDialog::setuploadAppsKDEcomCheckBoxState(bool state) {
 
277
     uploadAppsKDEcomCheckBox->setChecked(state);
 
278
}
 
279
 
 
280
//    QCheckBox* uploadftpkdeorgCheckBox;
 
281
bool DistpartDialog::getuploadftpkdeorgCheckBoxState() {
 
282
    return  uploadftpkdeorgCheckBox->isChecked();
 
283
}
 
284
 
 
285
void DistpartDialog::setuploadftpkdeorgCheckBoxState(bool state) {
 
286
     uploadftpkdeorgCheckBox->setChecked(state);
 
287
}
 
288
 
 
289
//    QCheckBox* devPackageCheckBox;
 
290
bool DistpartDialog::getdevPackageCheckBoxState() {
 
291
    return  devPackageCheckBox->isChecked();
 
292
}
 
293
 
 
294
void DistpartDialog::setdevPackageCheckBoxState(bool state) {
 
295
     devPackageCheckBox->setChecked(state);
 
296
}
 
297
 
 
298
//    QCheckBox* docsPackageCheckBox;
 
299
bool DistpartDialog::getdocsPackageCheckBoxState() {
 
300
    return  docsPackageCheckBox->isChecked();
 
301
}
 
302
 
 
303
void DistpartDialog::setdocsPackageCheckBoxState(bool state) {
 
304
     docsPackageCheckBox->setChecked(state);
 
305
}
 
306
 
 
307
//    QLineEdit* archNameFormatLineEdit;
 
308
QString DistpartDialog::getarchNameFormatLineEditText() {
 
309
    return  archNameFormatLineEdit->text();
 
310
}
 
311
 
 
312
void DistpartDialog::setarchNameFormatLineEditText(QString text) {
 
313
     archNameFormatLineEdit->setText(text);
 
314
}
 
315
 
 
316
//    QLineEdit* appNameLineEdit;
 
317
QString DistpartDialog::getappNameFormatLineEditText() {
 
318
    return  appNameLineEdit->text();
 
319
}
 
320
 
 
321
void DistpartDialog::setappNameFormatLineEditText(QString text) {
 
322
     appNameLineEdit->setText(text);
 
323
}
 
324
 
 
325
//    QLineEdit* summaryLineEdit;
 
326
QString DistpartDialog::getsummaryLineEditText() {
 
327
    return  summaryLineEdit->text();
 
328
}
 
329
 
 
330
void DistpartDialog::setsummaryLineEditText(QString text) {
 
331
     summaryLineEdit->setText(text);
 
332
}
 
333
 
 
334
//    QLineEdit* groupLineEdit;
 
335
QString DistpartDialog::getgroupLineEditText() {
 
336
    return  groupLineEdit->text();
 
337
}
 
338
 
 
339
void DistpartDialog::setgroupLineEditText(QString text) {
 
340
     groupLineEdit->setText(text);
 
341
}
 
342
 
 
343
//    QLineEdit* releaseLineEdit;
 
344
QString DistpartDialog::getreleaseLineEditText() {
 
345
    return  releaseLineEdit->text();
 
346
}
 
347
 
 
348
void DistpartDialog::setreleaseLineEditText(QString text) {
 
349
     releaseLineEdit->setText(text);
 
350
}
 
351
 
 
352
//    QLineEdit* VersionLineEdit;
 
353
QString DistpartDialog::getversionLineEditText() {
 
354
    return  versionLineEdit->text();
 
355
}
 
356
 
 
357
void DistpartDialog::setversionLineEditText(QString text) {
 
358
     versionLineEdit->setText( text );
 
359
}
 
360
 
 
361
//    QLineEdit* VendorLineEdit;
 
362
QString DistpartDialog::getvendorLineEditText() {
 
363
    return  vendorLineEdit->text();
 
364
}
 
365
 
 
366
void DistpartDialog::setvendorLineEditText(QString text) {
 
367
     vendorLineEdit->setText(text);
 
368
}
 
369
 
 
370
//    QLineEdit* LicenseLineEdit;
 
371
QString DistpartDialog::getlicenseLineEditText() {
 
372
    return  licenseLineEdit->text();
 
373
}
 
374
 
 
375
void DistpartDialog::setlicenseLineEditText(QString text) {
 
376
     licenseLineEdit->setText(text);
 
377
}
 
378
 
 
379
//    QLineEdit* uploadURLLineEdit;
 
380
QString DistpartDialog::getuploadURLLineEditText() {
 
381
    return  uploadURLLineEdit->text();
 
382
}
 
383
 
 
384
void DistpartDialog::setuploadURLLineEditText(QString text) {
 
385
     uploadURLLineEdit->setText(text);
 
386
}
 
387
 
 
388
//    QLineEdit* PackagerLineEdit;
 
389
QString DistpartDialog::getpackagerLineEditText() {
 
390
    return  packagerLineEdit->text();
 
391
}
 
392
 
 
393
void DistpartDialog::setpackagerLineEditText(QString text) {
 
394
     packagerLineEdit->setText(text);
 
395
}
 
396
 
 
397
//    QComboBox* archComboBox;
 
398
QString DistpartDialog::getarchComboBoxText() {
 
399
    return  archComboBox->currentText();
 
400
}
 
401
 
 
402
int DistpartDialog::getarchComboBoxItem() {
 
403
    return  archComboBox->currentItem();
 
404
}
 
405
 
 
406
void DistpartDialog::setarchComboBoxItem(int item) {
 
407
     archComboBox->setCurrentItem( item );
 
408
}
 
409
 
 
410
//    QListBox* uploadFileListBox;
 
411
QString DistpartDialog::getuploadFileListBoxText() {
 
412
    return  uploadFileListBox->currentText();
 
413
}
 
414
 
 
415
int DistpartDialog::getuploadFileListBoxItem() {
 
416
    return  uploadFileListBox->currentItem();
 
417
}
 
418
 
 
419
void DistpartDialog::setuploadFileListBoxItem(int item) {
 
420
     uploadFileListBox->setCurrentItem( item);
 
421
}
 
422
 
 
423
//    QListBox* srcDistFileListBox;
 
424
QString DistpartDialog::getsrcDistFileListBoxText() {
 
425
    return  srcDistFileListBox->currentText ();
 
426
}
 
427
 
 
428
int DistpartDialog::getsrcDistFileListBoxItem() {
 
429
    return  srcDistFileListBox->currentItem ();
 
430
}
 
431
 
 
432
void DistpartDialog::setsrcDistFileListBoxItem(int item) {
 
433
     srcDistFileListBox->setCurrentItem( item );
 
434
}
 
435
 
 
436
//    QMultiLineEdit* projectDescriptionMultilineEdit;
 
437
QString DistpartDialog::getprojectDescriptionMultilineEditText() {
 
438
    return  projectDescriptionMultilineEdit->text();
 
439
}
 
440
 
 
441
void DistpartDialog::setprojectDescriptionMultilineEditText(QString text) {
 
442
     projectDescriptionMultilineEdit->setText(text);
 
443
}
 
444
 
 
445
QString DistpartDialog::getprojectChangelogMultilineEditText() {
 
446
    return  projectChangelogMultilineEdit->text();
 
447
}
 
448
 
 
449
void DistpartDialog::setprojectChangelogMultilineEditText(QString text) {
 
450
     projectChangelogMultilineEdit->setText(text);
 
451
}
 
452
 
 
453
QString DistpartDialog::getSourceName() {
 
454
    QString name = (getcustomProjectCheckBoxState()) ? getarchNameFormatLineEditText() : QString("%n-%v");
 
455
    name += (getcustomProjectCheckBoxState() && getbzipCheckBoxState()) ? ".tar.bz2" : ".tar.gz";
 
456
    return name.replace(QRegExp("%n"),getappNameFormatLineEditText())
 
457
        .replace(QRegExp("%v"),getversionLineEditText())
 
458
        .replace(QRegExp("%d"),QDate::currentDate().toString("yyyyMMdd"));
 
459
}
 
460
 
 
461
void DistpartDialog::loadSettings() {
 
462
    QDomDocument &dom = *m_part->projectDom();
 
463
 
 
464
     srcDistFileListBox->insertStringList( m_part->project()->distFiles() );
 
465
 
 
466
    // First Tab
 
467
    setcustomProjectCheckBoxState(DomUtil::readBoolEntry(dom,"/dist/custom",false));
 
468
    slotcustomProjectCheckBoxChanged();
 
469
    setbzipCheckBoxState(DomUtil::readBoolEntry(dom,"/dist/bzip",false));
 
470
    setarchNameFormatLineEditText(DomUtil::readEntry(dom,"/dist/archname"));
 
471
 
 
472
 
 
473
    // Second Tab
 
474
    setappNameFormatLineEditText(DomUtil::readEntry(dom,"/dist/appname", m_part->project()->projectName() ));
 
475
    setversionLineEditText(DomUtil::readEntry(dom,"/dist/version",DomUtil::readEntry(dom,"/general/version")));
 
476
    setreleaseLineEditText(DomUtil::readEntry(dom,"/dist/release"));
 
477
    setvendorLineEditText(DomUtil::readEntry(dom,"/dist/vendor"));
 
478
    setlicenseLineEditText(DomUtil::readEntry(dom,"/dist/licence"));
 
479
    setsummaryLineEditText(DomUtil::readEntry(dom,"/dist/summary"));
 
480
    setgroupLineEditText(DomUtil::readEntry(dom,"/dist/group"));
 
481
    setpackagerLineEditText(DomUtil::readEntry(dom,"/dist/packager"));
 
482
    setprojectDescriptionMultilineEditText(DomUtil::readEntry(dom,"/dist/description",DomUtil::readEntry(dom,"/general/description")));
 
483
    setprojectChangelogMultilineEditText(DomUtil::readEntry(dom,"/dist/changelog"));
 
484
    setdevPackageCheckBoxState(DomUtil::readBoolEntry(dom,"/dist/devpackage"));
 
485
    setdocsPackageCheckBoxState(DomUtil::readBoolEntry(dom,"/dist/docspackage"));
 
486
    setappIconCheckBoxState(DomUtil::readBoolEntry(dom,"/dist/appicon"));
 
487
    setarchComboBoxItem(DomUtil::readIntEntry(dom,"/dist/arch"));
 
488
 
 
489
    // Third Tab
 
490
    setgenHTMLCheckBoxState(DomUtil::readBoolEntry(dom,"/dist/genHTML"));
 
491
    setuseRPMInfoCheckBoxState(DomUtil::readBoolEntry(dom,"/dist/useRPM"));
 
492
    setuploadftpkdeorgCheckBoxState(DomUtil::readBoolEntry(dom,"/dist/ftpkde"));
 
493
    setuploadAppsKDEcomCheckBoxState(DomUtil::readBoolEntry(dom,"/dist/appskde"));
 
494
    setuploadCustomCheckBoxState(DomUtil::readBoolEntry(dom,"/dist/custom"));
 
495
    slotuploadCustomCheckBoxChanged();
 
496
    setuploadURLLineEditText(DomUtil::readEntry(dom,"/dist/url"));
 
497
}
 
498
 
 
499
void DistpartDialog::storeSettings() {
 
500
    QDomDocument &dom = *m_part->projectDom();
 
501
 
 
502
    // First Tab
 
503
    DomUtil::writeBoolEntry(dom,"/dist/custom",getcustomProjectCheckBoxState());
 
504
    DomUtil::writeBoolEntry(dom,"/dist/bzip",getbzipCheckBoxState());
 
505
    DomUtil::writeEntry(dom,"/dist/archname",getarchNameFormatLineEditText());
 
506
 
 
507
    // Second Tab
 
508
    DomUtil::writeEntry(dom,"/dist/appname",getappNameFormatLineEditText());
 
509
    DomUtil::writeEntry(dom,"/dist/version",getversionLineEditText());
 
510
    DomUtil::writeEntry(dom,"/dist/release",getreleaseLineEditText());
 
511
    DomUtil::writeEntry(dom,"/dist/vendor",getvendorLineEditText());
 
512
    DomUtil::writeEntry(dom,"/dist/licence",getlicenseLineEditText());
 
513
    DomUtil::writeEntry(dom,"/dist/summary",getsummaryLineEditText());
 
514
    DomUtil::writeEntry(dom,"/dist/group",getgroupLineEditText());
 
515
    DomUtil::writeEntry(dom,"/dist/packager",getpackagerLineEditText());
 
516
    DomUtil::writeEntry(dom,"/dist/description",getprojectDescriptionMultilineEditText());
 
517
    DomUtil::writeEntry(dom,"/dist/changelog",getprojectChangelogMultilineEditText());
 
518
    DomUtil::writeBoolEntry(dom,"/dist/devpackage",getdevPackageCheckBoxState());
 
519
    DomUtil::writeBoolEntry(dom,"/dist/docspackage",getdocsPackageCheckBoxState());
 
520
    DomUtil::writeBoolEntry(dom,"/dist/appicon",getappIconCheckBoxState());
 
521
    DomUtil::writeIntEntry(dom,"/dist/arch",getarchComboBoxItem());
 
522
 
 
523
    // Third Tab
 
524
    DomUtil::writeBoolEntry(dom,"/dist/genHTML",getgenHTMLCheckBoxState());
 
525
    DomUtil::writeBoolEntry(dom,"/dist/useRPM",getuseRPMInfoCheckBoxState());
 
526
    DomUtil::writeBoolEntry(dom,"/dist/ftpkde",getuploadftpkdeorgCheckBoxState());
 
527
    DomUtil::writeBoolEntry(dom,"/dist/appskde",getuploadAppsKDEcomCheckBoxState());
 
528
    DomUtil::writeBoolEntry(dom,"/dist/custom",getuploadCustomCheckBoxState());
 
529
    DomUtil::writeEntry(dom,"/dist/url",getuploadURLLineEditText());
 
530
}
 
531
// Populate Spec Data from UI;
 
532
void DistpartDialog::setPackageData()
 
533
{
 
534
        m_spec->setAppRevision(  releaseLineEdit->text());
 
535
        m_spec->setAppName(  appNameLineEdit->text());
 
536
        m_spec->setAppVendor(  vendorLineEdit->text());
 
537
        m_spec->setAppLicense(  licenseLineEdit->text());
 
538
        m_spec->setAppSummary(  summaryLineEdit->text());
 
539
        m_spec->setAppPackager(  packagerLineEdit->text());
 
540
        m_spec->setAppVersion(  versionLineEdit->text());
 
541
        m_spec->setAppGroup(  groupLineEdit->text());
 
542
        m_spec->setAppDescription(  projectDescriptionMultilineEdit->text());
 
543
        m_spec->setAppChangelog(  projectChangelogMultilineEdit->text());
 
544
}
 
545
// Populate UI from Spec data;
 
546
void DistpartDialog::getPackageData()
 
547
{
 
548
         releaseLineEdit->setText(m_spec->getAppRevision());
 
549
         appNameLineEdit->setText(m_spec->getAppName());
 
550
         vendorLineEdit->setText(m_spec->getAppVendor());
 
551
         licenseLineEdit->setText(m_spec->getAppLicense( ));
 
552
         summaryLineEdit->setText(m_spec->getAppSummary( ));
 
553
         packagerLineEdit->setText(m_spec->getAppPackager( ));
 
554
         versionLineEdit->setText(m_spec->getAppVersion());
 
555
         groupLineEdit->setText(m_spec->getAppGroup( ));
 
556
         projectDescriptionMultilineEdit->setText(m_spec->getAppDescription( ));
 
557
         projectChangelogMultilineEdit->setText(m_spec->getAppChangelog( ));
 
558
}
 
559
void DistpartDialog::slotbuildAllPushButtonPressed( )
 
560
{
 
561
        setPackageData();
 
562
        m_spec->slotbuildAllPushButtonPressed();
 
563
}
 
564
 
 
565
void DistpartDialog::slotexportSPECPushButtonPressed( )
 
566
{
 
567
        setPackageData();
 
568
        m_spec->slotexportSPECPushButtonPressed();
 
569
}
 
570
 
 
571
void DistpartDialog::slotimportSPECPushButtonPressed( )
 
572
{
 
573
        m_spec->slotimportSPECPushButtonPressed();
 
574
        getPackageData();
 
575
}
 
576
 
 
577
void DistpartDialog::slotsrcPackagePushButtonPressed( )
 
578
{
 
579
        setPackageData();
 
580
        m_spec->slotsrcPackagePushButtonPressed();
 
581
}
 
582
 
 
583
 
 
584
#include "distpart_widget.moc"