author | paule <paule> | 2007-01-13 07:27:50 (UTC) |
---|---|---|
committer | paule <paule> | 2007-01-13 07:27:50 (UTC) |
commit | ee43ea083b2abea078507677ee30c7af88d248c4 (patch) (unidiff) | |
tree | e9c61153289247a67f043012c04022cd97ab4767 | |
parent | 4892c61a3e76c031d7b882854dcb0dfbd575f045 (diff) | |
download | opie-ee43ea083b2abea078507677ee30c7af88d248c4.zip opie-ee43ea083b2abea078507677ee30c7af88d248c4.tar.gz opie-ee43ea083b2abea078507677ee30c7af88d248c4.tar.bz2 |
Improve layout of Highlight Modes tab so that it fits on QVGA screens, allowing the OK/Cancel buttons on the dialog to be shown.
Fixes bug #1373.
-rw-r--r-- | noncore/apps/tinykate/libkate/document/katedialogs.cpp | 54 |
1 files changed, 25 insertions, 29 deletions
diff --git a/noncore/apps/tinykate/libkate/document/katedialogs.cpp b/noncore/apps/tinykate/libkate/document/katedialogs.cpp index f4edd7e..b492c26 100644 --- a/noncore/apps/tinykate/libkate/document/katedialogs.cpp +++ b/noncore/apps/tinykate/libkate/document/katedialogs.cpp | |||
@@ -35,62 +35,63 @@ | |||
35 | //FIXME #include <kcharsets.h> | 35 | //FIXME #include <kcharsets.h> |
36 | #include <kglobal.h> | 36 | #include <kglobal.h> |
37 | #include <qmap.h> | 37 | #include <qmap.h> |
38 | #include <kmessagebox.h> | 38 | #include <kmessagebox.h> |
39 | #include <kstddirs.h> | 39 | #include <kstddirs.h> |
40 | 40 | ||
41 | 41 | ||
42 | /******************************************************************************************************************* | 42 | /******************************************************************************************************************* |
43 | * Context Editor * | 43 | * Context Editor * |
44 | *******************************************************************************************************************/ | 44 | *******************************************************************************************************************/ |
45 | 45 | ||
46 | StyleChanger::StyleChanger( QWidget *parent ) | 46 | StyleChanger::StyleChanger( QWidget *parent ) |
47 | : QWidget(parent) | 47 | : QWidget(parent) |
48 | { | 48 | { |
49 | QLabel *label; | 49 | QLabel *label; |
50 | 50 | ||
51 | QGridLayout *glay = new QGridLayout( this, 4, 3, 0, KDialog::spacingHint() ); | 51 | QGridLayout *glay = new QGridLayout( this, 2, 6, 0, KDialog::spacingHint() ); |
52 | CHECK_PTR(glay); | 52 | CHECK_PTR(glay); |
53 | glay->addColSpacing( 1, KDialog::spacingHint() ); // Looks better | 53 | glay->addColSpacing( 1, KDialog::spacingHint() ); // Looks better |
54 | glay->setColStretch( 2, 10 ); | 54 | glay->addColSpacing( 3, KDialog::spacingHint() ); |
55 | glay->addColSpacing( 5, KDialog::spacingHint() ); | ||
55 | 56 | ||
56 | col = new KColorButton(this); | 57 | col = new KColorButton(this); |
57 | CHECK_PTR(col); | 58 | CHECK_PTR(col); |
58 | connect(col,SIGNAL(changed(const QColor&)),this,SLOT(changed())); | 59 | connect(col,SIGNAL(changed(const QColor&)),this,SLOT(changed())); |
59 | label = new QLabel(col,i18n("Normal:"),this); | 60 | label = new QLabel(col,i18n("Normal:"),this); |
60 | CHECK_PTR(label); | 61 | CHECK_PTR(label); |
61 | glay->addWidget(label,0,0); | 62 | glay->addWidget(label,0,0); |
62 | glay->addWidget(col,1,0); | 63 | glay->addWidget(col,1,0); |
63 | 64 | ||
64 | selCol = new KColorButton(this); | 65 | selCol = new KColorButton(this); |
65 | CHECK_PTR(selCol); | 66 | CHECK_PTR(selCol); |
66 | connect(selCol,SIGNAL(changed(const QColor&)),this,SLOT(changed())); | 67 | connect(selCol,SIGNAL(changed(const QColor&)),this,SLOT(changed())); |
67 | label = new QLabel(selCol,i18n("Selected:"),this); | 68 | label = new QLabel(selCol,i18n("Selected:"),this); |
68 | CHECK_PTR(label); | 69 | CHECK_PTR(label); |
69 | glay->addWidget(label,2,0); | 70 | glay->addWidget(label,0,2); |
70 | glay->addWidget(selCol,3,0); | 71 | glay->addWidget(selCol,1,2); |
71 | 72 | ||
72 | bold = new QCheckBox(i18n("Bold"),this); | 73 | bold = new QCheckBox(i18n("Bold"),this); |
73 | CHECK_PTR(bold); | 74 | CHECK_PTR(bold); |
74 | connect(bold,SIGNAL(clicked()),SLOT(changed())); | 75 | connect(bold,SIGNAL(clicked()),SLOT(changed())); |
75 | glay->addWidget(bold,1,2); | 76 | glay->addWidget(bold,0,4); |
76 | 77 | ||
77 | italic = new QCheckBox(i18n("Italic"),this); | 78 | italic = new QCheckBox(i18n("Italic"),this); |
78 | CHECK_PTR(italic); | 79 | CHECK_PTR(italic); |
79 | connect(italic,SIGNAL(clicked()),SLOT(changed())); | 80 | connect(italic,SIGNAL(clicked()),SLOT(changed())); |
80 | glay->addWidget(italic,2,2); | 81 | glay->addWidget(italic,1,4); |
81 | } | 82 | } |
82 | 83 | ||
83 | void StyleChanger::setRef(ItemStyle *s) { | 84 | void StyleChanger::setRef(ItemStyle *s) { |
84 | 85 | ||
85 | style = s; | 86 | style = s; |
86 | col->setColor(style->col); | 87 | col->setColor(style->col); |
87 | selCol->setColor(style->selCol); | 88 | selCol->setColor(style->selCol); |
88 | bold->setChecked(style->bold); | 89 | bold->setChecked(style->bold); |
89 | italic->setChecked(style->italic); | 90 | italic->setChecked(style->italic); |
90 | 91 | ||
91 | } | 92 | } |
92 | 93 | ||
93 | void StyleChanger::setEnabled(bool enable) { | 94 | void StyleChanger::setEnabled(bool enable) { |
94 | 95 | ||
95 | col->setEnabled(enable); | 96 | col->setEnabled(enable); |
96 | selCol->setEnabled(enable); | 97 | selCol->setEnabled(enable); |
@@ -143,70 +144,65 @@ HighlightDialogPage::HighlightDialogPage(HlManager *hlManager, ItemStyleList *st | |||
143 | QVGroupBox *dvbox1 = new QVGroupBox( i18n("Default Item Styles"), page1 ); | 144 | QVGroupBox *dvbox1 = new QVGroupBox( i18n("Default Item Styles"), page1 ); |
144 | /*QLabel *label = */new QLabel( i18n("Item:"), dvbox1 ); | 145 | /*QLabel *label = */new QLabel( i18n("Item:"), dvbox1 ); |
145 | QComboBox *styleCombo = new QComboBox( false, dvbox1 ); | 146 | QComboBox *styleCombo = new QComboBox( false, dvbox1 ); |
146 | defaultStyleChanger = new StyleChanger( dvbox1 ); | 147 | defaultStyleChanger = new StyleChanger( dvbox1 ); |
147 | for( int i = 0; i < hlManager->defaultStyles(); i++ ) { | 148 | for( int i = 0; i < hlManager->defaultStyles(); i++ ) { |
148 | styleCombo->insertItem(hlManager->defaultStyleName(i)); | 149 | styleCombo->insertItem(hlManager->defaultStyleName(i)); |
149 | } | 150 | } |
150 | connect(styleCombo, SIGNAL(activated(int)), this, SLOT(defaultChanged(int))); | 151 | connect(styleCombo, SIGNAL(activated(int)), this, SLOT(defaultChanged(int))); |
151 | grid->addWidget(dvbox1, 0,0); | 152 | grid->addWidget(dvbox1, 0,0); |
152 | 153 | ||
153 | defaultChanged(0); | 154 | defaultChanged(0); |
154 | 155 | ||
155 | // highlight modes ===================================================== | 156 | // highlight modes ===================================================== |
156 | 157 | ||
157 | QFrame *page2 = new QFrame(this); | 158 | QFrame *page2 = new QFrame(this); |
158 | addTab(page2,i18n("&Highlight Modes")); | 159 | addTab(page2,i18n("&Highlight Modes")); |
159 | //grid = new QGridLayout(page2,2,2); | ||
160 | QVBoxLayout *bl=new QVBoxLayout(page2); | 160 | QVBoxLayout *bl=new QVBoxLayout(page2); |
161 | bl->setAutoAdd(true); | 161 | bl->setAutoAdd(true); |
162 | QHGroupBox *hbox1 = new QHGroupBox( i18n("Config Select"), page2 ); | 162 | QGroupBox *gbox1 = new QGroupBox( 2, Qt::Horizontal, i18n("Config Select"), page2 ); |
163 | hbox1->layout()->setMargin(5); | 163 | gbox1->layout()->setMargin(5); |
164 | QVBox *vbox1=new QVBox(hbox1); | 164 | QGroupBox *gbox2 = new QGroupBox( 2, Qt::Horizontal, i18n("Item Style"), page2 ); |
165 | // grid->addMultiCellWidget(vbox1,0,0,0,1); | 165 | gbox2->layout()->setMargin(5); |
166 | QVGroupBox *vbox2 = new QVGroupBox( i18n("Item Style"), page2 ); | 166 | |
167 | // grid->addWidget(vbox2,1,0); | 167 | QLabel *label = new QLabel( i18n("Highlight:"), gbox1 ); |
168 | QVGroupBox *vbox3 = new QVGroupBox( i18n("Highlight Auto Select"), hbox1 ); | 168 | hlCombo = new QComboBox( false, gbox1 ); |
169 | //grid->addWidget(vbox3,1,1); | 169 | hlCombo->setSizePolicy( QSizePolicy( QSizePolicy::Maximum, QSizePolicy::Minimum ) ); |
170 | |||
171 | QLabel *label = new QLabel( i18n("Highlight:"), vbox1 ); | ||
172 | hlCombo = new QComboBox( false, vbox1 ); | ||
173 | QHBox *modHl = new QHBox(vbox1); | ||
174 | // connect(new QPushButton(i18n("New"),modHl),SIGNAL(clicked()),this,SLOT(hlNew())); | 170 | // connect(new QPushButton(i18n("New"),modHl),SIGNAL(clicked()),this,SLOT(hlNew())); |
175 | // connect(new QPushButton(i18n("Edit"),modHl),SIGNAL(clicked()),this,SLOT(hlEdit())); | 171 | // connect(new QPushButton(i18n("Edit"),modHl),SIGNAL(clicked()),this,SLOT(hlEdit())); |
176 | connect( hlCombo, SIGNAL(activated(int)), | 172 | connect( hlCombo, SIGNAL(activated(int)), |
177 | this, SLOT(hlChanged(int)) ); | 173 | this, SLOT(hlChanged(int)) ); |
178 | for( int i = 0; i < hlManager->highlights(); i++) { | 174 | for( int i = 0; i < hlManager->highlights(); i++) { |
179 | hlCombo->insertItem(hlManager->hlName(i)); | 175 | hlCombo->insertItem(hlManager->hlName(i)); |
180 | } | 176 | } |
181 | hlCombo->setCurrentItem(hlNumber); | 177 | hlCombo->setCurrentItem(hlNumber); |
182 | 178 | ||
179 | label = new QLabel( i18n("File Extensions:"), gbox1 ); | ||
180 | wildcards = new QLineEdit( gbox1 ); | ||
181 | label = new QLabel( i18n("Mime Types:"), gbox1 ); | ||
182 | mimetypes = new QLineEdit( gbox1 ); | ||
183 | 183 | ||
184 | label = new QLabel( i18n("Item:"), vbox2 ); | 184 | label = new QLabel( i18n("Item:"), gbox2 ); |
185 | itemCombo = new QComboBox( false, vbox2 ); | 185 | itemCombo = new QComboBox( false, gbox2 ); |
186 | connect( itemCombo, SIGNAL(activated(int)), this, SLOT(itemChanged(int)) ); | 186 | connect( itemCombo, SIGNAL(activated(int)), this, SLOT(itemChanged(int)) ); |
187 | 187 | ||
188 | label = new QLabel( i18n("File Extensions:"), vbox3 ); | 188 | styleDefault = new QCheckBox(i18n("Default"), gbox2 ); |
189 | wildcards = new QLineEdit( vbox3 ); | ||
190 | label = new QLabel( i18n("Mime Types:"), vbox3 ); | ||
191 | mimetypes = new QLineEdit( vbox3 ); | ||
192 | |||
193 | |||
194 | styleDefault = new QCheckBox(i18n("Default"), vbox2 ); | ||
195 | connect(styleDefault,SIGNAL(clicked()),SLOT(changed())); | 189 | connect(styleDefault,SIGNAL(clicked()),SLOT(changed())); |
196 | styleChanger = new StyleChanger( vbox2 ); | 190 | gbox2->addSpace(1); |
191 | gbox2->addSpace(1); | ||
192 | styleChanger = new StyleChanger( gbox2 ); | ||
197 | 193 | ||
198 | hlDataList = highlightDataList; | 194 | hlDataList = highlightDataList; |
199 | hlChanged(hlNumber); | 195 | hlChanged(hlNumber); |
200 | } | 196 | } |
201 | 197 | ||
202 | 198 | ||
203 | void HighlightDialogPage::defaultChanged(int z) | 199 | void HighlightDialogPage::defaultChanged(int z) |
204 | { | 200 | { |
205 | defaultStyleChanger->setRef(defaultItemStyleList->at(z)); | 201 | defaultStyleChanger->setRef(defaultItemStyleList->at(z)); |
206 | } | 202 | } |
207 | 203 | ||
208 | 204 | ||
209 | void HighlightDialogPage::hlChanged(int z) | 205 | void HighlightDialogPage::hlChanged(int z) |
210 | { | 206 | { |
211 | writeback(); | 207 | writeback(); |
212 | 208 | ||