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.
10
#include <QHBoxLayout>
11
#include <QVBoxLayout>
13
#include <QPushButton>
17
#include "util_icon.h"
19
WortEdit::WortEdit ( QWidget* parent ) : QLineEdit ( parent )
22
void WortEdit::keyPressEvent ( QKeyEvent *k )
24
int p = cursorPosition();
25
QChar cc = text() [p];
26
if ( ( k->key() == Qt::Key_Left ) || ( k->key() == Qt::Key_Right ) )
27
QLineEdit::keyPressEvent ( k );
28
if ( k->key() == Qt::Key_Delete )
31
QLineEdit::keyPressEvent ( k );
32
setCursorPosition ( p );
34
if ( ( k->key() == Qt::Key_Backspace ) && ( p != 0 ) )
38
QLineEdit::keyPressEvent ( k );
39
setCursorPosition ( p-1 );
41
if ( k->key() == Qt::Key_Minus )
42
QLineEdit::keyPressEvent ( k );
45
HyAsk::HyAsk ( QWidget* parent, QString HWort ) : QDialog ( parent )
48
setWindowTitle( tr( "Possible Hyphenation" ));
49
setWindowIcon(QIcon(loadIcon ( "AppIcon.png" )));
50
HyAskLayout = new QVBoxLayout(this);
51
HyAskLayout->setMargin(10);
52
HyAskLayout->setSpacing(5);
54
Wort = new WortEdit ( this );
55
Wort->setMinimumSize ( QSize ( 300, 0 ) );
56
Wort->setDragEnabled ( false );
57
Wort->setText ( HWort );
58
HyAskLayout->addWidget ( Wort );
60
Layout1 = new QHBoxLayout;
61
Layout1->setMargin(0);
62
Layout1->setSpacing(5);
64
vboxLayout1 = new QVBoxLayout();
65
vboxLayout1->setSpacing(5);
66
vboxLayout1->setMargin(0);
67
OK = new QPushButton(this);
68
OK->setText( tr("Accept"));
70
vboxLayout1->addWidget(OK);
71
hboxLayout1 = new QHBoxLayout();
72
hboxLayout1->setSpacing(0);
73
hboxLayout1->setMargin(0);
74
addToExceptionList = new QCheckBox(this);
75
hboxLayout1->addWidget(addToExceptionList);
76
addToExceptionListText = new QLabel(this);
77
addToExceptionListText->setText( tr("Add to the\nException List"));
78
hboxLayout1->addWidget(addToExceptionListText);
79
vboxLayout1->addLayout(hboxLayout1);
80
Layout1->addLayout(vboxLayout1);
81
addToExceptionList->setEnabled(false);
82
addToExceptionListText->setEnabled(false);
83
addToExceptionList->setChecked(false);
85
vboxLayout2 = new QVBoxLayout();
86
vboxLayout2->setSpacing(5);
87
vboxLayout2->setMargin(0);
88
Skip = new QPushButton(this);
89
Skip->setText( tr("Skip"));
90
vboxLayout2->addWidget(Skip);
91
hboxLayout2 = new QHBoxLayout();
92
hboxLayout2->setSpacing(0);
93
hboxLayout2->setMargin(0);
94
addToIgnoreList = new QCheckBox(this);
95
hboxLayout2->addWidget(addToIgnoreList);
96
addToIgnoreListText = new QLabel(this);
97
addToIgnoreListText->setText( tr("Add to the\nIgnore List"));
98
hboxLayout2->addWidget(addToIgnoreListText);
99
vboxLayout2->addLayout(hboxLayout2);
100
Layout1->addLayout(vboxLayout2);
101
addToIgnoreList->setChecked(false);
103
vboxLayout3 = new QVBoxLayout();
104
vboxLayout3->setSpacing(5);
105
vboxLayout3->setMargin(0);
106
Cancel = new QPushButton(this);
107
Cancel->setText( tr("Cancel"));
108
vboxLayout3->addWidget(Cancel);
109
QSpacerItem* spacer = new QSpacerItem(2, 2, QSizePolicy::Minimum, QSizePolicy::Expanding);
110
vboxLayout3->addItem(spacer);
111
Layout1->addLayout(vboxLayout3);
112
HyAskLayout->addLayout ( Layout1 );
114
connect ( OK, SIGNAL ( clicked() ), this, SLOT ( accept() ) );
115
connect ( Cancel, SIGNAL ( clicked() ), this, SLOT ( reject() ) );
116
connect ( Skip, SIGNAL ( clicked() ), this, SLOT ( DoSkip() ) );
117
connect ( Wort, SIGNAL ( textChanged ( const QString & ) ), this, SLOT ( Check() ) );
118
resize(minimumSizeHint());
137
disconnect ( Wort, SIGNAL ( textChanged ( const QString & ) ), this, SLOT ( Check() ) );
138
QString in = Wort->text();
139
QString out = in.replace ( QRegExp ( "(-)+" ), "-" );
140
Wort->setText ( out );
141
addToExceptionList->setEnabled(true);
142
addToExceptionListText->setEnabled(true);
143
connect ( Wort, SIGNAL ( textChanged ( const QString & ) ), this, SLOT ( Check() ) );
148
disconnect ( Wort, SIGNAL ( textChanged ( const QString & ) ), this, SLOT ( Check() ) );
149
QString in = Wort->text();
150
QString out = in.replace ( QRegExp ( "(-)+" ), "" );
151
Wort->setText ( out );