Subversion Repositories Scribus

Rev

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

Rev Author Line No. Line
1579 tsoots 1
 /***************************************************************************
2
  *   Copyright (C) 2004 by Riku Leino                                      *
3
  *   tsoots@gmail.com                                                      *
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
 
21
#include "odtdia.h"
22
 
23
#ifdef HAVE_XML
24
 
25
#include "odtdia.moc"
26
#include <qtooltip.h>
2986 craig 27
#include "scribusapi.h"
1579 tsoots 28
 
2986 craig 29
extern QPixmap SCRIBUS_API loadIcon(QString nam);
1579 tsoots 30
 
31
OdtDialog::OdtDialog(bool update, bool prefix, bool pack) : QDialog(0, "sxwdia", true, 0)
32
{
2763 mrdocs 33
        setCaption(tr("OpenDocument Importer Options"));
1579 tsoots 34
        setIcon(loadIcon("AppIcon.png"));
35
 
36
        QBoxLayout* layout = new QVBoxLayout(this);
37
 
38
        QBoxLayout* hlayout = new QHBoxLayout(0, 5, 5, "hlayout");
2077 tsoots 39
        updateCheck = new QCheckBox(tr("Overwrite Paragraph Styles"), this,
40
"updateCheck");
1579 tsoots 41
        updateCheck->setChecked(update);
2126 cbradney 42
        QToolTip::add(updateCheck, "<qt>" + tr("Enabling this will overwrite existing styles in the current Scribus document") + "</qt>");
1579 tsoots 43
        hlayout->addWidget(updateCheck);
44
        layout->addLayout(hlayout);
45
 
46
        QBoxLayout* palayout = new QHBoxLayout(0,5,5, "palayout");
2063 mrdocs 47
        packCheck = new QCheckBox(tr("Merge Paragraph Styles"), this, "packCheck");
1579 tsoots 48
        packCheck->setChecked(pack);
2063 mrdocs 49
        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 50
        palayout->addWidget(packCheck);
51
        layout->addLayout(palayout);
52
 
53
        QBoxLayout* playout = new QHBoxLayout(0, 5, 5, "playout");
54
        prefixCheck = new QCheckBox(tr("Use document name as a prefix for paragraph styles"), this, "prefixCheck");
55
        prefixCheck->setChecked(prefix);
2063 mrdocs 56
        QToolTip::add(prefixCheck, "<qt>" + tr("Prepend the document name to the paragraph style name in Scribus.") +"</qt>");
1579 tsoots 57
        playout->addWidget(prefixCheck);
58
        layout->addLayout(playout);
59
 
60
        QBoxLayout* dlayout = new QHBoxLayout(0, 5, 5, "dlayout");
2077 tsoots 61
        doNotAskCheck = new QCheckBox(tr("Do not ask again"), this,
62
"doNotAskCheck");
1579 tsoots 63
        doNotAskCheck->setChecked(false);
2063 mrdocs 64
        QToolTip::add(doNotAskCheck, "<qt>" + tr("Make these settings the default and do not prompt again when importing an OASIS OpenDocument.") +"</qt>");
2166 cbradney 65
        //dlayout->addStretch(10);
1579 tsoots 66
        dlayout->addWidget(doNotAskCheck);
67
        layout->addLayout(dlayout);
68
 
69
        QBoxLayout* blayout = new QHBoxLayout(0, 5, 5, "blayout");
70
        blayout->addStretch(10);
71
        okButton = new QPushButton(tr("OK"), this, "okButton");
72
        blayout->addWidget(okButton);
3970 tsoots 73
        cancelButton = new QPushButton(tr("Cancel"), this, "cancelButton");
74
        blayout->addWidget(cancelButton);
1579 tsoots 75
        layout->addLayout(blayout);
76
 
77
        connect(okButton, SIGNAL(clicked()), this, SLOT(accept()));
3970 tsoots 78
        connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
1579 tsoots 79
}
80
 
81
bool OdtDialog::shouldUpdate()
82
{
83
        return updateCheck->isChecked();
84
}
85
 
86
bool OdtDialog::usePrefix()
87
{
88
        return prefixCheck->isChecked();
89
}
90
 
91
bool OdtDialog::askAgain()
92
{
93
        return !(doNotAskCheck->isChecked());
94
}
95
 
96
bool OdtDialog::packStyles()
97
{
98
        return packCheck->isChecked();
99
}
100
 
101
OdtDialog::~OdtDialog()
102
{
103
 
104
}
105
 
106
#endif // HAVE_XML