Subversion Repositories Scribus

Rev

Rev 10010 | Rev 10397 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4430 cbradney 1
/*
2
For general Scribus (>=1.3.2) copyright and licensing information please refer
3
to the COPYING file provided with the program. Following this notice may exist
4
a copyright and/or license notice that predates the release of Scribus 1.3.2
5
for which a new license (GPL+exception) is in place.
6
*/
1579 tsoots 7
 /***************************************************************************
8
  *   Copyright (C) 2004 by Riku Leino                                      *
9
  *   tsoots@gmail.com                                                      *
10
  *                                                                         *
11
  *   This program is free software; you can redistribute it and/or modify  *
12
  *   it under the terms of the GNU General Public License as published by  *
13
  *   the Free Software Foundation; either version 2 of the License, or     *
14
  *   (at your option) any later version.                                   *
15
  *                                                                         *
16
  *   This program is distributed in the hope that it will be useful,       *
17
  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
18
  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
19
  *   GNU General Public License for more details.                          *
20
  *                                                                         *
21
  *   You should have received a copy of the GNU General Public License     *
22
  *   along with this program; if not, write to the                         *
23
  *   Free Software Foundation, Inc.,                                       *
24
  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
25
 ***************************************************************************/
26
 
27
#include "odtdia.h"
28
 
29
#ifdef HAVE_XML
30
 
10010 fschmid 31
#include <QToolTip>
32
#include <QBoxLayout>
33
#include <QVBoxLayout>
8501 cbradney 34
#include <QPixmap>
10010 fschmid 35
#include <QHBoxLayout>
36
#include <QCheckBox>
37
#include <QPushButton>
2986 craig 38
#include "scribusapi.h"
10200 cbradney 39
#include "util_icon.h"
1579 tsoots 40
 
10010 fschmid 41
OdtDialog::OdtDialog(bool update, bool prefix, bool pack) : QDialog(0)
1579 tsoots 42
{
10010 fschmid 43
        setModal(true);
44
        setWindowIcon(QIcon(loadIcon ( "AppIcon.png" )));
45
        setWindowTitle( tr("OpenDocument Importer Options"));
1579 tsoots 46
 
10010 fschmid 47
        QBoxLayout* layout = new QVBoxLayout(this);
48
        layout->setMargin(0);
49
        layout->setSpacing(0);
1579 tsoots 50
 
10010 fschmid 51
        QBoxLayout* hlayout = new QHBoxLayout;
52
        hlayout->setMargin(5);
53
        hlayout->setSpacing(5);
54
        updateCheck = new QCheckBox( tr("Overwrite Paragraph Styles"), this);
1579 tsoots 55
        updateCheck->setChecked(update);
2126 cbradney 56
        QToolTip::add(updateCheck, "<qt>" + tr("Enabling this will overwrite existing styles in the current Scribus document") + "</qt>");
1579 tsoots 57
        hlayout->addWidget(updateCheck);
58
        layout->addLayout(hlayout);
59
 
10010 fschmid 60
        QBoxLayout* palayout = new QHBoxLayout;
61
        palayout->setMargin(5);
62
        palayout->setSpacing(5);
63
        packCheck = new QCheckBox( tr("Merge Paragraph Styles"), this);
1579 tsoots 64
        packCheck->setChecked(pack);
2063 mrdocs 65
        QToolTip::add(packCheck, "<qt>" + tr("Merge paragraph styles by attributes. This will result in fewer similar paragraph styles, will retain style attributes, even if the original document's styles are named differently.") +"</qt>");
1579 tsoots 66
        palayout->addWidget(packCheck);
67
        layout->addLayout(palayout);
68
 
10010 fschmid 69
        QBoxLayout* playout = new QHBoxLayout;
70
        playout->setMargin(5);
71
        playout->setSpacing(5);
72
        prefixCheck = new QCheckBox( tr("Use document name as a prefix for paragraph styles"), this);
1579 tsoots 73
        prefixCheck->setChecked(prefix);
2063 mrdocs 74
        QToolTip::add(prefixCheck, "<qt>" + tr("Prepend the document name to the paragraph style name in Scribus.") +"</qt>");
1579 tsoots 75
        playout->addWidget(prefixCheck);
76
        layout->addLayout(playout);
77
 
10010 fschmid 78
        QBoxLayout* dlayout = new QHBoxLayout;
79
        dlayout->setMargin(5);
80
        dlayout->setSpacing(5);
81
        doNotAskCheck = new QCheckBox( tr("Do not ask again"), this);
1579 tsoots 82
        doNotAskCheck->setChecked(false);
2063 mrdocs 83
        QToolTip::add(doNotAskCheck, "<qt>" + tr("Make these settings the default and do not prompt again when importing an OASIS OpenDocument.") +"</qt>");
2166 cbradney 84
        //dlayout->addStretch(10);
1579 tsoots 85
        dlayout->addWidget(doNotAskCheck);
86
        layout->addLayout(dlayout);
87
 
10010 fschmid 88
        QBoxLayout* blayout = new QHBoxLayout;
89
        blayout->setMargin(5);
90
        blayout->setSpacing(5);
1579 tsoots 91
        blayout->addStretch(10);
10010 fschmid 92
        okButton = new QPushButton( tr("OK"), this);
1579 tsoots 93
        blayout->addWidget(okButton);
10010 fschmid 94
        cancelButton = new QPushButton( tr("Cancel"), this);
3970 tsoots 95
        blayout->addWidget(cancelButton);
1579 tsoots 96
        layout->addLayout(blayout);
97
 
98
        connect(okButton, SIGNAL(clicked()), this, SLOT(accept()));
3970 tsoots 99
        connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
1579 tsoots 100
}
101
 
102
bool OdtDialog::shouldUpdate()
103
{
104
        return updateCheck->isChecked();
105
}
106
 
107
bool OdtDialog::usePrefix()
108
{
109
        return prefixCheck->isChecked();
110
}
111
 
112
bool OdtDialog::askAgain()
113
{
114
        return !(doNotAskCheck->isChecked());
115
}
116
 
117
bool OdtDialog::packStyles()
118
{
119
        return packCheck->isChecked();
120
}
121
 
122
OdtDialog::~OdtDialog()
123
{
124
 
125
}
126
 
127
#endif // HAVE_XML