1
/***************************************************************************
2
* Copyright (C) 2003 by Stephen Allewell *
3
* stephen@mirramar.fsnet.co.uk *
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
***************************************************************************/
13
#include <qpushbutton.h>
14
#include <kapplication.h>
17
#include "addcolordialog.h"
18
#include "newcolordialog.h"
19
#include "schememanager.h"
20
#include "flossscheme.h"
21
#include "flosslistboxitem.h"
23
AddColorDialog::AddColorDialog(QWidget *parent, QString schemeName)
24
: AddColorDlg(parent,"AddColorDialog",true),
25
m_schemeName(schemeName)
27
setCaption(i18n("Add Colors"));
28
SchemeName->setText(QString(i18n("Add colors from %1 scheme")).arg(schemeName));
29
connect(NewColorButton,SIGNAL(clicked()),this,SLOT(slotNewColor()));
30
connect(HelpButton,SIGNAL(clicked()),this,SLOT(slotContextHelp()));
33
AddColorDialog::~AddColorDialog()
38
void AddColorDialog::slotContextHelp()
40
kapp->invokeHelp("AddColorDialog");
43
void AddColorDialog::slotNewColor()
45
Floss* floss = NewColorDialog::getFloss(m_schemeName);
48
m_addedColors.append(floss);
49
new FlossListBoxItem(ColorList, floss);
53
void AddColorDialog::accept()
55
FlossScheme* scheme = ((KXStitchApplication*)kapp)->scheme(m_schemeName);
56
if (!m_addedColors.isEmpty())
58
for (Floss* f = m_addedColors.first() ; f ; f = m_addedColors.next())
60
((KXStitchApplication*)kapp)->writeScheme(m_schemeName);
65
void AddColorDialog::reject()
67
m_addedColors.setAutoDelete(true);