summaryrefslogtreecommitdiff
path: root/noncore/apps/tinykate
authoralwin <alwin>2004-03-02 12:21:11 (UTC)
committer alwin <alwin>2004-03-02 12:21:11 (UTC)
commitb6b1c97559c0ed9f2e33632272426bf98f289232 (patch) (unidiff)
treed3a9987704770cdf5eb14e1136f6e3ecb2f36a04 /noncore/apps/tinykate
parent0d59c780513da78033f4d9040475dee9db0256d4 (diff)
downloadopie-b6b1c97559c0ed9f2e33632272426bf98f289232.zip
opie-b6b1c97559c0ed9f2e33632272426bf98f289232.tar.gz
opie-b6b1c97559c0ed9f2e33632272426bf98f289232.tar.bz2
applied the patch generated by the optimize_connect script from
TT.
Diffstat (limited to 'noncore/apps/tinykate') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/tinykate/libkate/document/katedialogs.cpp6
-rw-r--r--noncore/apps/tinykate/libkate/document/katedocument.cpp2
-rw-r--r--noncore/apps/tinykate/libkate/view/kateviewdialog.cpp6
-rw-r--r--noncore/apps/tinykate/tinykate.cpp2
4 files changed, 8 insertions, 8 deletions
diff --git a/noncore/apps/tinykate/libkate/document/katedialogs.cpp b/noncore/apps/tinykate/libkate/document/katedialogs.cpp
index 2f0ed7b..f4edd7e 100644
--- a/noncore/apps/tinykate/libkate/document/katedialogs.cpp
+++ b/noncore/apps/tinykate/libkate/document/katedialogs.cpp
@@ -1,481 +1,481 @@
1/*************************************************************************** 1/***************************************************************************
2 katedialogs.cpp - description 2 katedialogs.cpp - description
3 ------------------- 3 -------------------
4 copyright : (C) 2001 by The Kate Team 4 copyright : (C) 2001 by The Kate Team
5 (C) 2002 by Joseph Wenninger 5 (C) 2002 by Joseph Wenninger
6 email : kwrite-devel@kde.org 6 email : kwrite-devel@kde.org
7 jowenn@kde.org 7 jowenn@kde.org
8 8
9 ***************************************************************************/ 9 ***************************************************************************/
10 10
11/*************************************************************************** 11/***************************************************************************
12 * * 12 * *
13 * This program is free software; you can redistribute it and/or modify * 13 * This program is free software; you can redistribute it and/or modify *
14 * it under the terms of the GNU General Public License as published by * 14 * it under the terms of the GNU General Public License as published by *
15 * the Free Software Foundation; either version 2 of the License, or * 15 * the Free Software Foundation; either version 2 of the License, or *
16 * (at your option) any later version. * 16 * (at your option) any later version. *
17 * * 17 * *
18 ***************************************************************************/ 18 ***************************************************************************/
19#include "katedialogs.h" 19#include "katedialogs.h"
20#include <klocale.h> 20#include <klocale.h>
21#include <kdebug.h> 21#include <kdebug.h>
22#include <qgroupbox.h> 22#include <qgroupbox.h>
23#include <qvgroupbox.h> 23#include <qvgroupbox.h>
24#include <qhgroupbox.h> 24#include <qhgroupbox.h>
25#include <qhbox.h> 25#include <qhbox.h>
26#include <qvbox.h> 26#include <qvbox.h>
27#include <qlayout.h> 27#include <qlayout.h>
28#include <qpushbutton.h> 28#include <qpushbutton.h>
29#include <qwidgetstack.h> 29#include <qwidgetstack.h>
30#include <qlabel.h> 30#include <qlabel.h>
31#include <qlistview.h> 31#include <qlistview.h>
32#include <qlineedit.h> 32#include <qlineedit.h>
33#include <qcombobox.h> 33#include <qcombobox.h>
34#include <qcheckbox.h> 34#include <qcheckbox.h>
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
46StyleChanger::StyleChanger( QWidget *parent ) 46StyleChanger::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, 4, 3, 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->setColStretch( 2, 10 );
55 55
56 col = new KColorButton(this); 56 col = new KColorButton(this);
57 CHECK_PTR(col); 57 CHECK_PTR(col);
58 connect(col,SIGNAL(changed(const QColor &)),this,SLOT(changed())); 58 connect(col,SIGNAL(changed(const QColor&)),this,SLOT(changed()));
59 label = new QLabel(col,i18n("Normal:"),this); 59 label = new QLabel(col,i18n("Normal:"),this);
60 CHECK_PTR(label); 60 CHECK_PTR(label);
61 glay->addWidget(label,0,0); 61 glay->addWidget(label,0,0);
62 glay->addWidget(col,1,0); 62 glay->addWidget(col,1,0);
63 63
64 selCol = new KColorButton(this); 64 selCol = new KColorButton(this);
65 CHECK_PTR(selCol); 65 CHECK_PTR(selCol);
66 connect(selCol,SIGNAL(changed(const QColor &)),this,SLOT(changed())); 66 connect(selCol,SIGNAL(changed(const QColor&)),this,SLOT(changed()));
67 label = new QLabel(selCol,i18n("Selected:"),this); 67 label = new QLabel(selCol,i18n("Selected:"),this);
68 CHECK_PTR(label); 68 CHECK_PTR(label);
69 glay->addWidget(label,2,0); 69 glay->addWidget(label,2,0);
70 glay->addWidget(selCol,3,0); 70 glay->addWidget(selCol,3,0);
71 71
72 bold = new QCheckBox(i18n("Bold"),this); 72 bold = new QCheckBox(i18n("Bold"),this);
73 CHECK_PTR(bold); 73 CHECK_PTR(bold);
74 connect(bold,SIGNAL(clicked()),SLOT(changed())); 74 connect(bold,SIGNAL(clicked()),SLOT(changed()));
75 glay->addWidget(bold,1,2); 75 glay->addWidget(bold,1,2);
76 76
77 italic = new QCheckBox(i18n("Italic"),this); 77 italic = new QCheckBox(i18n("Italic"),this);
78 CHECK_PTR(italic); 78 CHECK_PTR(italic);
79 connect(italic,SIGNAL(clicked()),SLOT(changed())); 79 connect(italic,SIGNAL(clicked()),SLOT(changed()));
80 glay->addWidget(italic,2,2); 80 glay->addWidget(italic,2,2);
81} 81}
82 82
83void StyleChanger::setRef(ItemStyle *s) { 83void StyleChanger::setRef(ItemStyle *s) {
84 84
85 style = s; 85 style = s;
86 col->setColor(style->col); 86 col->setColor(style->col);
87 selCol->setColor(style->selCol); 87 selCol->setColor(style->selCol);
88 bold->setChecked(style->bold); 88 bold->setChecked(style->bold);
89 italic->setChecked(style->italic); 89 italic->setChecked(style->italic);
90 90
91} 91}
92 92
93void StyleChanger::setEnabled(bool enable) { 93void StyleChanger::setEnabled(bool enable) {
94 94
95 col->setEnabled(enable); 95 col->setEnabled(enable);
96 selCol->setEnabled(enable); 96 selCol->setEnabled(enable);
97 bold->setEnabled(enable); 97 bold->setEnabled(enable);
98 italic->setEnabled(enable); 98 italic->setEnabled(enable);
99} 99}
100 100
101void StyleChanger::changed() { 101void StyleChanger::changed() {
102 102
103 if (style) { 103 if (style) {
104 style->col = col->color(); 104 style->col = col->color();
105 style->selCol = selCol->color(); 105 style->selCol = selCol->color();
106 style->bold = bold->isChecked(); 106 style->bold = bold->isChecked();
107 style->italic = italic->isChecked(); 107 style->italic = italic->isChecked();
108 } 108 }
109} 109}
110 110
111HighlightDialog::HighlightDialog( HlManager *hlManager, ItemStyleList *styleList, 111HighlightDialog::HighlightDialog( HlManager *hlManager, ItemStyleList *styleList,
112 HlDataList *highlightDataList, 112 HlDataList *highlightDataList,
113 int hlNumber, QWidget *parent, 113 int hlNumber, QWidget *parent,
114 const char *name, bool modal ) 114 const char *name, bool modal )
115 :KDialogBase(parent,name,modal,i18n("Highlight Settings"), Ok|Cancel, Ok) 115 :KDialogBase(parent,name,modal,i18n("Highlight Settings"), Ok|Cancel, Ok)
116{ 116{
117// QVBox *page = makeVBoxMainWidget(); 117// QVBox *page = makeVBoxMainWidget();
118 QFrame *page=addPage("FIXME"); 118 QFrame *page=addPage("FIXME");
119 (new QVBoxLayout(page))->setAutoAdd(true); 119 (new QVBoxLayout(page))->setAutoAdd(true);
120 content=new HighlightDialogPage(hlManager,styleList,highlightDataList,hlNumber,page); 120 content=new HighlightDialogPage(hlManager,styleList,highlightDataList,hlNumber,page);
121} 121}
122 122
123void HighlightDialog::done(int r) 123void HighlightDialog::done(int r)
124{ 124{
125 kdDebug(13010)<<"HighlightDialod done"<<endl; 125 kdDebug(13010)<<"HighlightDialod done"<<endl;
126 content->saveData(); 126 content->saveData();
127 KDialogBase::done(r); 127 KDialogBase::done(r);
128} 128}
129 129
130HighlightDialogPage::HighlightDialogPage(HlManager *hlManager, ItemStyleList *styleList, 130HighlightDialogPage::HighlightDialogPage(HlManager *hlManager, ItemStyleList *styleList,
131 HlDataList* highlightDataList, 131 HlDataList* highlightDataList,
132 int hlNumber,QWidget *parent, const char *name) 132 int hlNumber,QWidget *parent, const char *name)
133 :QTabWidget(parent,name),defaultItemStyleList(styleList),hlData(0L) 133 :QTabWidget(parent,name),defaultItemStyleList(styleList),hlData(0L)
134 134
135{ 135{
136 136
137 // defaults ========================================================= 137 // defaults =========================================================
138 138
139 QFrame *page1 = new QFrame(this); 139 QFrame *page1 = new QFrame(this);
140 addTab(page1,i18n("&Defaults")); 140 addTab(page1,i18n("&Defaults"));
141 QGridLayout *grid = new QGridLayout(page1, 1, 1); 141 QGridLayout *grid = new QGridLayout(page1, 1, 1);
142 142
143 QVGroupBox *dvbox1 = new QVGroupBox( i18n("Default Item Styles"), page1 ); 143 QVGroupBox *dvbox1 = new QVGroupBox( i18n("Default Item Styles"), page1 );
144 /*QLabel *label = */new QLabel( i18n("Item:"), dvbox1 ); 144 /*QLabel *label = */new QLabel( i18n("Item:"), dvbox1 );
145 QComboBox *styleCombo = new QComboBox( false, dvbox1 ); 145 QComboBox *styleCombo = new QComboBox( false, dvbox1 );
146 defaultStyleChanger = new StyleChanger( dvbox1 ); 146 defaultStyleChanger = new StyleChanger( dvbox1 );
147 for( int i = 0; i < hlManager->defaultStyles(); i++ ) { 147 for( int i = 0; i < hlManager->defaultStyles(); i++ ) {
148 styleCombo->insertItem(hlManager->defaultStyleName(i)); 148 styleCombo->insertItem(hlManager->defaultStyleName(i));
149 } 149 }
150 connect(styleCombo, SIGNAL(activated(int)), this, SLOT(defaultChanged(int))); 150 connect(styleCombo, SIGNAL(activated(int)), this, SLOT(defaultChanged(int)));
151 grid->addWidget(dvbox1, 0,0); 151 grid->addWidget(dvbox1, 0,0);
152 152
153 defaultChanged(0); 153 defaultChanged(0);
154 154
155 // highlight modes ===================================================== 155 // highlight modes =====================================================
156 156
157 QFrame *page2 = new QFrame(this); 157 QFrame *page2 = new QFrame(this);
158 addTab(page2,i18n("&Highlight Modes")); 158 addTab(page2,i18n("&Highlight Modes"));
159 //grid = new QGridLayout(page2,2,2); 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 QHGroupBox *hbox1 = new QHGroupBox( i18n("Config Select"), page2 );
163 hbox1->layout()->setMargin(5); 163 hbox1->layout()->setMargin(5);
164 QVBox *vbox1=new QVBox(hbox1); 164 QVBox *vbox1=new QVBox(hbox1);
165// grid->addMultiCellWidget(vbox1,0,0,0,1); 165// grid->addMultiCellWidget(vbox1,0,0,0,1);
166 QVGroupBox *vbox2 = new QVGroupBox( i18n("Item Style"), page2 ); 166 QVGroupBox *vbox2 = new QVGroupBox( i18n("Item Style"), page2 );
167// grid->addWidget(vbox2,1,0); 167// grid->addWidget(vbox2,1,0);
168 QVGroupBox *vbox3 = new QVGroupBox( i18n("Highlight Auto Select"), hbox1 ); 168 QVGroupBox *vbox3 = new QVGroupBox( i18n("Highlight Auto Select"), hbox1 );
169 //grid->addWidget(vbox3,1,1); 169 //grid->addWidget(vbox3,1,1);
170 170
171 QLabel *label = new QLabel( i18n("Highlight:"), vbox1 ); 171 QLabel *label = new QLabel( i18n("Highlight:"), vbox1 );
172 hlCombo = new QComboBox( false, vbox1 ); 172 hlCombo = new QComboBox( false, vbox1 );
173 QHBox *modHl = new QHBox(vbox1); 173 QHBox *modHl = new QHBox(vbox1);
174// connect(new QPushButton(i18n("New"),modHl),SIGNAL(clicked()),this,SLOT(hlNew())); 174// connect(new QPushButton(i18n("New"),modHl),SIGNAL(clicked()),this,SLOT(hlNew()));
175// connect(new QPushButton(i18n("Edit"),modHl),SIGNAL(clicked()),this,SLOT(hlEdit())); 175// connect(new QPushButton(i18n("Edit"),modHl),SIGNAL(clicked()),this,SLOT(hlEdit()));
176 connect( hlCombo, SIGNAL(activated(int)), 176 connect( hlCombo, SIGNAL(activated(int)),
177 this, SLOT(hlChanged(int)) ); 177 this, SLOT(hlChanged(int)) );
178 for( int i = 0; i < hlManager->highlights(); i++) { 178 for( int i = 0; i < hlManager->highlights(); i++) {
179 hlCombo->insertItem(hlManager->hlName(i)); 179 hlCombo->insertItem(hlManager->hlName(i));
180 } 180 }
181 hlCombo->setCurrentItem(hlNumber); 181 hlCombo->setCurrentItem(hlNumber);
182 182
183 183
184 label = new QLabel( i18n("Item:"), vbox2 ); 184 label = new QLabel( i18n("Item:"), vbox2 );
185 itemCombo = new QComboBox( false, vbox2 ); 185 itemCombo = new QComboBox( false, vbox2 );
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 label = new QLabel( i18n("File Extensions:"), vbox3 );
189 wildcards = new QLineEdit( vbox3 ); 189 wildcards = new QLineEdit( vbox3 );
190 label = new QLabel( i18n("Mime Types:"), vbox3 ); 190 label = new QLabel( i18n("Mime Types:"), vbox3 );
191 mimetypes = new QLineEdit( vbox3 ); 191 mimetypes = new QLineEdit( vbox3 );
192 192
193 193
194 styleDefault = new QCheckBox(i18n("Default"), vbox2 ); 194 styleDefault = new QCheckBox(i18n("Default"), vbox2 );
195 connect(styleDefault,SIGNAL(clicked()),SLOT(changed())); 195 connect(styleDefault,SIGNAL(clicked()),SLOT(changed()));
196 styleChanger = new StyleChanger( vbox2 ); 196 styleChanger = new StyleChanger( vbox2 );
197 197
198 hlDataList = highlightDataList; 198 hlDataList = highlightDataList;
199 hlChanged(hlNumber); 199 hlChanged(hlNumber);
200} 200}
201 201
202 202
203void HighlightDialogPage::defaultChanged(int z) 203void HighlightDialogPage::defaultChanged(int z)
204{ 204{
205 defaultStyleChanger->setRef(defaultItemStyleList->at(z)); 205 defaultStyleChanger->setRef(defaultItemStyleList->at(z));
206} 206}
207 207
208 208
209void HighlightDialogPage::hlChanged(int z) 209void HighlightDialogPage::hlChanged(int z)
210{ 210{
211 writeback(); 211 writeback();
212 212
213 hlData = hlDataList->at(z); 213 hlData = hlDataList->at(z);
214 214
215 wildcards->setText(hlData->wildcards); 215 wildcards->setText(hlData->wildcards);
216 mimetypes->setText(hlData->mimetypes); 216 mimetypes->setText(hlData->mimetypes);
217 217
218 itemCombo->clear(); 218 itemCombo->clear();
219 for (ItemData *itemData = hlData->itemDataList.first(); itemData != 0L; 219 for (ItemData *itemData = hlData->itemDataList.first(); itemData != 0L;
220 itemData = hlData->itemDataList.next()) { 220 itemData = hlData->itemDataList.next()) {
221 kdDebug(13010) << itemData->name << endl; 221 kdDebug(13010) << itemData->name << endl;
222 itemCombo->insertItem(i18n(itemData->name.latin1())); 222 itemCombo->insertItem(i18n(itemData->name.latin1()));
223 } 223 }
224 224
225 itemChanged(0); 225 itemChanged(0);
226} 226}
227 227
228void HighlightDialogPage::itemChanged(int z) 228void HighlightDialogPage::itemChanged(int z)
229{ 229{
230 itemData = hlData->itemDataList.at(z); 230 itemData = hlData->itemDataList.at(z);
231 231
232 styleDefault->setChecked(itemData->defStyle); 232 styleDefault->setChecked(itemData->defStyle);
233 styleChanger->setRef(itemData); 233 styleChanger->setRef(itemData);
234} 234}
235 235
236void HighlightDialogPage::changed() 236void HighlightDialogPage::changed()
237{ 237{
238 itemData->defStyle = styleDefault->isChecked(); 238 itemData->defStyle = styleDefault->isChecked();
239} 239}
240 240
241void HighlightDialogPage::writeback() { 241void HighlightDialogPage::writeback() {
242 if (hlData) { 242 if (hlData) {
243 hlData->wildcards = wildcards->text(); 243 hlData->wildcards = wildcards->text();
244 hlData->mimetypes = mimetypes->text(); 244 hlData->mimetypes = mimetypes->text();
245 } 245 }
246} 246}
247 247
248void HighlightDialogPage::saveData() { 248void HighlightDialogPage::saveData() {
249 kdDebug(13010)<<"HighlightDialogPage::saveData()"<<endl; 249 kdDebug(13010)<<"HighlightDialogPage::saveData()"<<endl;
250 writeback(); 250 writeback();
251} 251}
252 252
253 253
254void HighlightDialogPage::hlEdit() { 254void HighlightDialogPage::hlEdit() {
255 HlEditDialog diag(0,0,"hlEdit", true,hlData); 255 HlEditDialog diag(0,0,"hlEdit", true,hlData);
256 diag.show(); 256 diag.show();
257} 257}
258 258
259void HighlightDialogPage::hlNew() { 259void HighlightDialogPage::hlNew() {
260 HlEditDialog diag(0,0,"hlEdit",true,0); 260 HlEditDialog diag(0,0,"hlEdit",true,0);
261 diag.show(); 261 diag.show();
262} 262}
263 263
264 264
265HlEditDialog::HlEditDialog(HlManager *,QWidget *parent, const char *name, bool modal,HlData *data) 265HlEditDialog::HlEditDialog(HlManager *,QWidget *parent, const char *name, bool modal,HlData *data)
266 :KDialogBase(KDialogBase::Swallow, i18n("Highlight Conditions"), Ok|Cancel, Ok, parent, name, modal) 266 :KDialogBase(KDialogBase::Swallow, i18n("Highlight Conditions"), Ok|Cancel, Ok, parent, name, modal)
267{ 267{
268 currentItem=0; 268 currentItem=0;
269 transTableCnt=0; 269 transTableCnt=0;
270 QHBox *wid=new QHBox(this); 270 QHBox *wid=new QHBox(this);
271 QVBox *lbox=new QVBox(wid); 271 QVBox *lbox=new QVBox(wid);
272 contextList=new KListView(lbox); 272 contextList=new KListView(lbox);
273 contextList->setRootIsDecorated(true); 273 contextList->setRootIsDecorated(true);
274 contextList->addColumn(i18n("Syntax structure")); 274 contextList->addColumn(i18n("Syntax structure"));
275 contextList->setSorting(-1); 275 contextList->setSorting(-1);
276 QHBox *bbox=new QHBox(lbox); 276 QHBox *bbox=new QHBox(lbox);
277 QPushButton *addContext=new QPushButton(i18n("New Context"),bbox); 277 QPushButton *addContext=new QPushButton(i18n("New Context"),bbox);
278 QPushButton *addItem=new QPushButton(i18n("New Item"),bbox); 278 QPushButton *addItem=new QPushButton(i18n("New Item"),bbox);
279 QVGroupBox *opt = new QVGroupBox( i18n("Options"), wid); 279 QVGroupBox *opt = new QVGroupBox( i18n("Options"), wid);
280 stack=new QWidgetStack(opt); 280 stack=new QWidgetStack(opt);
281 initContextOptions(contextOptions=new QVBox(stack)); 281 initContextOptions(contextOptions=new QVBox(stack));
282 stack->addWidget(contextOptions,HlEContext); 282 stack->addWidget(contextOptions,HlEContext);
283 initItemOptions(itemOptions=new QVBox(stack)); 283 initItemOptions(itemOptions=new QVBox(stack));
284 stack->addWidget(itemOptions,HlEItem); 284 stack->addWidget(itemOptions,HlEItem);
285 stack->raiseWidget(HlEContext); 285 stack->raiseWidget(HlEContext);
286 setMainWidget(wid); 286 setMainWidget(wid);
287 if (data!=0) loadFromDocument(data); 287 if (data!=0) loadFromDocument(data);
288 else newDocument(); 288 else newDocument();
289 connect(contextList,SIGNAL(currentChanged( QListViewItem*)),this,SLOT(currentSelectionChanged ( QListViewItem * ))); 289 connect(contextList,SIGNAL(currentChanged(QListViewItem*)),this,SLOT(currentSelectionChanged(QListViewItem*)));
290 connect(addContext,SIGNAL(clicked()),this,SLOT(contextAddNew())); 290 connect(addContext,SIGNAL(clicked()),this,SLOT(contextAddNew()));
291 connect(addItem,SIGNAL(clicked()),this,SLOT(ItemAddNew())); 291 connect(addItem,SIGNAL(clicked()),this,SLOT(ItemAddNew()));
292 } 292 }
293 293
294void HlEditDialog::newDocument() 294void HlEditDialog::newDocument()
295{ 295{
296 KStandardDirs *dirs = KGlobal::dirs(); 296 KStandardDirs *dirs = KGlobal::dirs();
297 QStringList list=dirs->findAllResources("data","kate/syntax/syntax.template",false,true); 297 QStringList list=dirs->findAllResources("data","kate/syntax/syntax.template",false,true);
298 for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) 298 for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it )
299 { 299 {
300 HlData data("","",*it); 300 HlData data("","",*it);
301 loadFromDocument(&data); 301 loadFromDocument(&data);
302 return; 302 return;
303 } 303 }
304 KMessageBox::error(this,i18n("Can't find template file")); 304 KMessageBox::error(this,i18n("Can't find template file"));
305} 305}
306 306
307 307
308void HlEditDialog::initContextOptions(QVBox *co) 308void HlEditDialog::initContextOptions(QVBox *co)
309{ 309{
310 if( co!=0) 310 if( co!=0)
311 { 311 {
312 QHBox *tmp = new QHBox(co); 312 QHBox *tmp = new QHBox(co);
313 (void) new QLabel(i18n("Description:"),tmp); 313 (void) new QLabel(i18n("Description:"),tmp);
314 ContextDescr=new QLineEdit(tmp); 314 ContextDescr=new QLineEdit(tmp);
315 tmp= new QHBox(co); 315 tmp= new QHBox(co);
316 (void) new QLabel(i18n("Attribute:"),tmp); 316 (void) new QLabel(i18n("Attribute:"),tmp);
317 ContextAttribute=new QComboBox(tmp); 317 ContextAttribute=new QComboBox(tmp);
318 tmp= new QHBox(co); 318 tmp= new QHBox(co);
319 (void) new QLabel(i18n("LineEnd:"),tmp); 319 (void) new QLabel(i18n("LineEnd:"),tmp);
320 ContextLineEnd = new QComboBox(tmp); 320 ContextLineEnd = new QComboBox(tmp);
321 connect(ContextDescr,SIGNAL(textChanged(const QString&)),this,SLOT(contextDescrChanged(const QString&))); 321 connect(ContextDescr,SIGNAL(textChanged(const QString&)),this,SLOT(contextDescrChanged(const QString&)));
322 connect(ContextLineEnd,SIGNAL(activated(int)),this,SLOT(contextLineEndChanged(int))); 322 connect(ContextLineEnd,SIGNAL(activated(int)),this,SLOT(contextLineEndChanged(int)));
323 connect(ContextAttribute,SIGNAL(activated(int)),this,SLOT(contextAttributeChanged(int))); 323 connect(ContextAttribute,SIGNAL(activated(int)),this,SLOT(contextAttributeChanged(int)));
324 } 324 }
325 else 325 else
326 kdDebug(13010)<<"initContextOptions: Widget is 0"<<endl; 326 kdDebug(13010)<<"initContextOptions: Widget is 0"<<endl;
327} 327}
328 328
329 329
330void HlEditDialog::insertTranslationList(QString tag, QString trans,int length) 330void HlEditDialog::insertTranslationList(QString tag, QString trans,int length)
331 { 331 {
332 ItemInfo data(trans,length); 332 ItemInfo data(trans,length);
333 id2tag.insert(transTableCnt,tag); 333 id2tag.insert(transTableCnt,tag);
334 id2info.insert(transTableCnt,data); 334 id2info.insert(transTableCnt,data);
335 tag2id.insert(tag,transTableCnt); 335 tag2id.insert(tag,transTableCnt);
336 transTableCnt++; 336 transTableCnt++;
337 } 337 }
338 338
339 339
340void HlEditDialog::initItemOptions(QVBox *co) 340void HlEditDialog::initItemOptions(QVBox *co)
341{ 341{
342 if (co!=0) 342 if (co!=0)
343 { 343 {
344 QHBox *tmp = new QHBox(co); 344 QHBox *tmp = new QHBox(co);
345 (void) new QLabel(i18n("Type:"),tmp); 345 (void) new QLabel(i18n("Type:"),tmp);
346 ItemType = new QComboBox(tmp); 346 ItemType = new QComboBox(tmp);
347 tmp= new QHBox(co); 347 tmp= new QHBox(co);
348 (void) new QLabel(i18n("Parameter:"),tmp); 348 (void) new QLabel(i18n("Parameter:"),tmp);
349 ItemParameter= new QLineEdit(tmp); 349 ItemParameter= new QLineEdit(tmp);
350 tmp= new QHBox(co); 350 tmp= new QHBox(co);
351 (void) new QLabel(i18n("Attribute:"),tmp); 351 (void) new QLabel(i18n("Attribute:"),tmp);
352 ItemAttribute= new QComboBox(tmp); 352 ItemAttribute= new QComboBox(tmp);
353 (void) new QLabel(i18n("Context switch:"),tmp); 353 (void) new QLabel(i18n("Context switch:"),tmp);
354 ItemContext = new QComboBox(tmp); 354 ItemContext = new QComboBox(tmp);
355 co->setSpacing(15); 355 co->setSpacing(15);
356 QPushButton *delItem=new QPushButton(i18n("Delete this item"),co); 356 QPushButton *delItem=new QPushButton(i18n("Delete this item"),co);
357 357
358 /* init translation lists */ 358 /* init translation lists */
359 insertTranslationList("CharDetect","CharDetect",1); 359 insertTranslationList("CharDetect","CharDetect",1);
360 insertTranslationList("2CharDetect","2CharDetect",2); 360 insertTranslationList("2CharDetect","2CharDetect",2);
361 insertTranslationList("RangeDetect","RangeDetect",2); 361 insertTranslationList("RangeDetect","RangeDetect",2);
362 insertTranslationList("StringDetect","StringDetect",-1); 362 insertTranslationList("StringDetect","StringDetect",-1);
363 insertTranslationList("AnyChar","AnyChar",-1); 363 insertTranslationList("AnyChar","AnyChar",-1);
364 insertTranslationList("RegExpr","RegExpr",-1); 364 insertTranslationList("RegExpr","RegExpr",-1);
365 insertTranslationList("Int","Int",0); 365 insertTranslationList("Int","Int",0);
366 insertTranslationList("Float","Float",0); 366 insertTranslationList("Float","Float",0);
367 insertTranslationList("keyword","keyword",0); 367 insertTranslationList("keyword","keyword",0);
368 insertTranslationList("dataType","dataType",0); 368 insertTranslationList("dataType","dataType",0);
369 ItemType->clear(); 369 ItemType->clear();
370 for (int i=0; i<transTableCnt; i++) ItemType->insertItem(id2info[i].trans_i18n); 370 for (int i=0; i<transTableCnt; i++) ItemType->insertItem(id2info[i].trans_i18n);
371 connect(ItemType,SIGNAL(activated(int)),this,SLOT(ItemTypeChanged(int))); 371 connect(ItemType,SIGNAL(activated(int)),this,SLOT(ItemTypeChanged(int)));
372 connect(ItemParameter,SIGNAL(textChanged(const QString&)),this,SLOT(ItemParameterChanged(const QString&))); 372 connect(ItemParameter,SIGNAL(textChanged(const QString&)),this,SLOT(ItemParameterChanged(const QString&)));
373 connect(ItemAttribute,SIGNAL(activated(int)),this,SLOT(ItemAttributeChanged(int))); 373 connect(ItemAttribute,SIGNAL(activated(int)),this,SLOT(ItemAttributeChanged(int)));
374 connect(ItemContext,SIGNAL(activated(int)),this,SLOT(ItemContextChanged(int))); 374 connect(ItemContext,SIGNAL(activated(int)),this,SLOT(ItemContextChanged(int)));
375 } 375 }
376 else 376 else
377 kdDebug(13010)<<"initItemOptions: Widget is 0"<<endl; 377 kdDebug(13010)<<"initItemOptions: Widget is 0"<<endl;
378} 378}
379 379
380void HlEditDialog::loadFromDocument(HlData *hl) 380void HlEditDialog::loadFromDocument(HlData *hl)
381{ 381{
382 struct syntaxContextData *data; 382 struct syntaxContextData *data;
383 QListViewItem *last=0,*lastsub=0; 383 QListViewItem *last=0,*lastsub=0;
384 384
385 HlManager::self()->syntax->setIdentifier(hl->identifier); 385 HlManager::self()->syntax->setIdentifier(hl->identifier);
386 data=HlManager::self()->syntax->getGroupInfo("highlighting","context"); 386 data=HlManager::self()->syntax->getGroupInfo("highlighting","context");
387 int i=0; 387 int i=0;
388 if (data) 388 if (data)
389 { 389 {
390 while (HlManager::self()->syntax->nextGroup(data)) //<context tags> 390 while (HlManager::self()->syntax->nextGroup(data)) //<context tags>
391 { 391 {
392 kdDebug(13010)<< "Adding context to list"<<endl; 392 kdDebug(13010)<< "Adding context to list"<<endl;
393 last= new QListViewItem(contextList,last, 393 last= new QListViewItem(contextList,last,
394 HlManager::self()->syntax->groupData(data,QString("name")), 394 HlManager::self()->syntax->groupData(data,QString("name")),
395 QString("%1").arg(i), 395 QString("%1").arg(i),
396 HlManager::self()->syntax->groupData(data,QString("attribute")), 396 HlManager::self()->syntax->groupData(data,QString("attribute")),
397 HlManager::self()->syntax->groupData(data,QString("lineEndContext"))); 397 HlManager::self()->syntax->groupData(data,QString("lineEndContext")));
398 i++; 398 i++;
399 lastsub=0; 399 lastsub=0;
400 while (HlManager::self()->syntax->nextItem(data)) 400 while (HlManager::self()->syntax->nextItem(data))
401 { 401 {
402 kdDebug(13010)<< "Adding item to list"<<endl; 402 kdDebug(13010)<< "Adding item to list"<<endl;
403 lastsub=addContextItem(last,lastsub,data); 403 lastsub=addContextItem(last,lastsub,data);
404 } 404 }
405 405
406 406
407 } 407 }
408 if (data) HlManager::self()->syntax->freeGroupInfo(data); 408 if (data) HlManager::self()->syntax->freeGroupInfo(data);
409 } 409 }
410 ContextAttribute->clear(); 410 ContextAttribute->clear();
411 ItemAttribute->clear(); 411 ItemAttribute->clear();
412 data=HlManager::self()->syntax->getGroupInfo("highlighting","itemData"); 412 data=HlManager::self()->syntax->getGroupInfo("highlighting","itemData");
413 while (HlManager::self()->syntax->nextGroup(data)) 413 while (HlManager::self()->syntax->nextGroup(data))
414 { 414 {
415 ContextAttribute->insertItem(HlManager::self()->syntax->groupData(data,QString("name"))); 415 ContextAttribute->insertItem(HlManager::self()->syntax->groupData(data,QString("name")));
416 ItemAttribute->insertItem(HlManager::self()->syntax->groupData(data,QString("name"))); 416 ItemAttribute->insertItem(HlManager::self()->syntax->groupData(data,QString("name")));
417 } 417 }
418 if (data) HlManager::self()->syntax->freeGroupInfo(data); 418 if (data) HlManager::self()->syntax->freeGroupInfo(data);
419} 419}
420 420
421QListViewItem *HlEditDialog::addContextItem(QListViewItem *_parent,QListViewItem *prev,struct syntaxContextData *data) 421QListViewItem *HlEditDialog::addContextItem(QListViewItem *_parent,QListViewItem *prev,struct syntaxContextData *data)
422 { 422 {
423 423
424 kdDebug(13010)<<HlManager::self()->syntax->groupItemData(data,QString("name")) << endl; 424 kdDebug(13010)<<HlManager::self()->syntax->groupItemData(data,QString("name")) << endl;
425 425
426 QString dataname=HlManager::self()->syntax->groupItemData(data,QString("")); 426 QString dataname=HlManager::self()->syntax->groupItemData(data,QString(""));
427 QString attr=(HlManager::self()->syntax->groupItemData(data,QString("attribute"))); 427 QString attr=(HlManager::self()->syntax->groupItemData(data,QString("attribute")));
428 QString context=(HlManager::self()->syntax->groupItemData(data,QString("context"))); 428 QString context=(HlManager::self()->syntax->groupItemData(data,QString("context")));
429 char chr; 429 char chr;
430 if (! HlManager::self()->syntax->groupItemData(data,QString("char")).isEmpty()) 430 if (! HlManager::self()->syntax->groupItemData(data,QString("char")).isEmpty())
431 chr= (HlManager::self()->syntax->groupItemData(data,QString("char")).latin1())[0]; 431 chr= (HlManager::self()->syntax->groupItemData(data,QString("char")).latin1())[0];
432 else 432 else
433 chr=0; 433 chr=0;
434 QString stringdata=HlManager::self()->syntax->groupItemData(data,QString("String")); 434 QString stringdata=HlManager::self()->syntax->groupItemData(data,QString("String"));
435 char chr1; 435 char chr1;
436 if (! HlManager::self()->syntax->groupItemData(data,QString("char1")).isEmpty()) 436 if (! HlManager::self()->syntax->groupItemData(data,QString("char1")).isEmpty())
437 chr1= (HlManager::self()->syntax->groupItemData(data,QString("char1")).latin1())[0]; 437 chr1= (HlManager::self()->syntax->groupItemData(data,QString("char1")).latin1())[0];
438 else 438 else
439 chr1=0; 439 chr1=0;
440 bool insensitive=(HlManager::self()->syntax->groupItemData(data,QString("insensitive"))==QString("TRUE")); 440 bool insensitive=(HlManager::self()->syntax->groupItemData(data,QString("insensitive"))==QString("TRUE"));
441 QString param(""); 441 QString param("");
442 if ((dataname=="keyword") || (dataname=="dataType")) param=dataname; 442 if ((dataname=="keyword") || (dataname=="dataType")) param=dataname;
443 else if (dataname=="CharDetect") param=chr; 443 else if (dataname=="CharDetect") param=chr;
444 else if ((dataname=="2CharDetect") || (dataname=="RangeDetect")) param=QString("%1%2").arg(chr).arg(chr1); 444 else if ((dataname=="2CharDetect") || (dataname=="RangeDetect")) param=QString("%1%2").arg(chr).arg(chr1);
445 else if ((dataname=="StringDetect") || (dataname=="AnyChar") || (dataname=="RegExpr")) param=stringdata; 445 else if ((dataname=="StringDetect") || (dataname=="AnyChar") || (dataname=="RegExpr")) param=stringdata;
446 else kdDebug(13010)<<"***********************************"<<endl<<"Unknown entry for Context:"<<dataname<<endl; 446 else kdDebug(13010)<<"***********************************"<<endl<<"Unknown entry for Context:"<<dataname<<endl;
447 kdDebug(13010)<<dataname << endl; 447 kdDebug(13010)<<dataname << endl;
448 return new QListViewItem(_parent,prev,i18n(dataname.latin1())+" "+param,dataname,param,attr,context); 448 return new QListViewItem(_parent,prev,i18n(dataname.latin1())+" "+param,dataname,param,attr,context);
449 } 449 }
450 450
451 451
452void HlEditDialog::currentSelectionChanged ( QListViewItem *it) 452void HlEditDialog::currentSelectionChanged ( QListViewItem *it)
453 { 453 {
454 kdDebug(13010)<<"Update data view"<<endl<<"Depth:"<<it->depth()<<endl; 454 kdDebug(13010)<<"Update data view"<<endl<<"Depth:"<<it->depth()<<endl;
455 currentItem=it; 455 currentItem=it;
456 if (it->depth()==0) showContext(); 456 if (it->depth()==0) showContext();
457 else showItem(); 457 else showItem();
458 } 458 }
459 459
460 460
461/****************************************************************************/ 461/****************************************************************************/
462/* CONTEXTS */ 462/* CONTEXTS */
463/****************************************************************************/ 463/****************************************************************************/
464 464
465 465
466void HlEditDialog::showContext() 466void HlEditDialog::showContext()
467 { 467 {
468 stack->raiseWidget(HlEContext); 468 stack->raiseWidget(HlEContext);
469 ContextDescr->setText(currentItem->text(0)); 469 ContextDescr->setText(currentItem->text(0));
470 ContextAttribute->setCurrentItem(currentItem->text(2).toInt()); 470 ContextAttribute->setCurrentItem(currentItem->text(2).toInt());
471 ContextLineEnd->clear(); 471 ContextLineEnd->clear();
472 for (QListViewItem *it=contextList->firstChild();it;it=it->nextSibling()) 472 for (QListViewItem *it=contextList->firstChild();it;it=it->nextSibling())
473 ContextLineEnd->insertItem(it->text(0)); 473 ContextLineEnd->insertItem(it->text(0));
474 ContextLineEnd->setCurrentItem(currentItem->text(3).toInt()); 474 ContextLineEnd->setCurrentItem(currentItem->text(3).toInt());
475// ContextAttribute->setText(currentItem->text(1)); 475// ContextAttribute->setText(currentItem->text(1));
476// ContextLineEnd->setText(currentItem->text(2)); 476// ContextLineEnd->setText(currentItem->text(2));
477 } 477 }
478 478
479void HlEditDialog::contextDescrChanged(const QString& name) 479void HlEditDialog::contextDescrChanged(const QString& name)
480 { 480 {
481 if (currentItem) 481 if (currentItem)
diff --git a/noncore/apps/tinykate/libkate/document/katedocument.cpp b/noncore/apps/tinykate/libkate/document/katedocument.cpp
index f05e21a..0c742d7 100644
--- a/noncore/apps/tinykate/libkate/document/katedocument.cpp
+++ b/noncore/apps/tinykate/libkate/document/katedocument.cpp
@@ -1,363 +1,363 @@
1/*************************************************************************** 1/***************************************************************************
2 katedocument.cpp - description 2 katedocument.cpp - description
3 ------------------- 3 -------------------
4 begin : Mon Jan 15 2001 4 begin : Mon Jan 15 2001
5 copyright : (C) 2001 by Christoph "Crossfire" Cullmann 5 copyright : (C) 2001 by Christoph "Crossfire" Cullmann
6 (C) 2002 by Joseph Wenninger 6 (C) 2002 by Joseph Wenninger
7 email : crossfire@babylon2k.de 7 email : crossfire@babylon2k.de
8 jowenn@kde.org 8 jowenn@kde.org
9 9
10***************************************************************************/ 10***************************************************************************/
11 11
12/*************************************************************************** 12/***************************************************************************
13 * * 13 * *
14 * This program is free software; you can redistribute it and/or modify * 14 * This program is free software; you can redistribute it and/or modify *
15 * it under the terms of the GNU General Public License as published by * 15 * it under the terms of the GNU General Public License as published by *
16 * the Free Software Foundation; either version 2 of the License, or * 16 * the Free Software Foundation; either version 2 of the License, or *
17 * (at your option) any later version. * 17 * (at your option) any later version. *
18 * * 18 * *
19 ***************************************************************************/ 19 ***************************************************************************/
20 20
21/* 21/*
22 Copyright (C) 1998, 1999 Jochen Wilhelmy 22 Copyright (C) 1998, 1999 Jochen Wilhelmy
23 digisnap@cs.tu-berlin.de 23 digisnap@cs.tu-berlin.de
24 24
25 This library is free software; you can redistribute it and/or 25 This library is free software; you can redistribute it and/or
26 modify it under the terms of the GNU Library General Public 26 modify it under the terms of the GNU Library General Public
27 License as published by the Free Software Foundation; either 27 License as published by the Free Software Foundation; either
28 version 2 of the License, or (at your option) any later version. 28 version 2 of the License, or (at your option) any later version.
29 29
30 This library is distributed in the hope that it will be useful, 30 This library is distributed in the hope that it will be useful,
31 but WITHOUT ANY WARRANTY; without even the implied warranty of 31 but WITHOUT ANY WARRANTY; without even the implied warranty of
32 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 32 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
33 Library General Public License for more details. 33 Library General Public License for more details.
34 34
35 You should have received a copy of the GNU Library General Public License 35 You should have received a copy of the GNU Library General Public License
36 along with this library; see the file COPYING.LIB. If not, write to 36 along with this library; see the file COPYING.LIB. If not, write to
37 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 37 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
38 Boston, MA 02111-1307, USA. 38 Boston, MA 02111-1307, USA.
39*/ 39*/
40 40
41#include "katedocument.h" 41#include "katedocument.h"
42 42
43 43
44#include <qfileinfo.h> 44#include <qfileinfo.h>
45#include <qdatetime.h> 45#include <qdatetime.h>
46 46
47#include <kmessagebox.h> 47#include <kmessagebox.h>
48#include <qpe/config.h> 48#include <qpe/config.h>
49#include <qstring.h> 49#include <qstring.h>
50 50
51#include <sys/time.h> 51#include <sys/time.h>
52#include <unistd.h> 52#include <unistd.h>
53 53
54#include <stdio.h> 54#include <stdio.h>
55 55
56#include <qtimer.h> 56#include <qtimer.h>
57#include <qobject.h> 57#include <qobject.h>
58#include <qapplication.h> 58#include <qapplication.h>
59#include <qclipboard.h> 59#include <qclipboard.h>
60#include <qfont.h> 60#include <qfont.h>
61#include <qpainter.h> 61#include <qpainter.h>
62#include <qfile.h> 62#include <qfile.h>
63#include <qtextstream.h> 63#include <qtextstream.h>
64#include <qtextcodec.h> 64#include <qtextcodec.h>
65#include <kglobal.h> 65#include <kglobal.h>
66 66
67//#include <kcharsets.h> 67//#include <kcharsets.h>
68#include <kdebug.h> 68#include <kdebug.h>
69//#include <kinstance.h> 69//#include <kinstance.h>
70 70
71#include <kglobalsettings.h> 71#include <kglobalsettings.h>
72//#include <kaction.h> 72//#include <kaction.h>
73//#include <kstdaction.h> 73//#include <kstdaction.h>
74 74
75#include "../view/kateview.h" 75#include "../view/kateview.h"
76#include "katebuffer.h" 76#include "katebuffer.h"
77#include "katetextline.h" 77#include "katetextline.h"
78 78
79#include "katecmd.h" 79#include "katecmd.h"
80 80
81KateAction::KateAction(Action a, PointStruc &cursor, int len, const QString &text) 81KateAction::KateAction(Action a, PointStruc &cursor, int len, const QString &text)
82 : action(a), cursor(cursor), len(len), text(text) { 82 : action(a), cursor(cursor), len(len), text(text) {
83} 83}
84 84
85KateActionGroup::KateActionGroup(PointStruc &aStart, int type) 85KateActionGroup::KateActionGroup(PointStruc &aStart, int type)
86 : start(aStart), action(0L), undoType(type) { 86 : start(aStart), action(0L), undoType(type) {
87} 87}
88 88
89KateActionGroup::~KateActionGroup() { 89KateActionGroup::~KateActionGroup() {
90 KateAction *current, *next; 90 KateAction *current, *next;
91 91
92 current = action; 92 current = action;
93 while (current) { 93 while (current) {
94 next = current->next; 94 next = current->next;
95 delete current; 95 delete current;
96 current = next; 96 current = next;
97 } 97 }
98} 98}
99 99
100void KateActionGroup::insertAction(KateAction *a) { 100void KateActionGroup::insertAction(KateAction *a) {
101 a->next = action; 101 a->next = action;
102 action = a; 102 action = a;
103} 103}
104 104
105const char * KateActionGroup::typeName(int type) 105const char * KateActionGroup::typeName(int type)
106{ 106{
107 // return a short text description of the given undo group type suitable for a menu 107 // return a short text description of the given undo group type suitable for a menu
108 // not the lack of i18n's, the caller is expected to handle translation 108 // not the lack of i18n's, the caller is expected to handle translation
109 switch (type) { 109 switch (type) {
110 case ugPaste : return "Paste Text"; 110 case ugPaste : return "Paste Text";
111 case ugDelBlock : return "Selection Overwrite"; 111 case ugDelBlock : return "Selection Overwrite";
112 case ugIndent : return "Indent"; 112 case ugIndent : return "Indent";
113 case ugUnindent : return "Unindent"; 113 case ugUnindent : return "Unindent";
114 case ugComment : return "Comment"; 114 case ugComment : return "Comment";
115 case ugUncomment : return "Uncomment"; 115 case ugUncomment : return "Uncomment";
116 case ugReplace : return "Text Replace"; 116 case ugReplace : return "Text Replace";
117 case ugSpell : return "Spell Check"; 117 case ugSpell : return "Spell Check";
118 case ugInsChar : return "Typing"; 118 case ugInsChar : return "Typing";
119 case ugDelChar : return "Delete Text"; 119 case ugDelChar : return "Delete Text";
120 case ugInsLine : return "New Line"; 120 case ugInsLine : return "New Line";
121 case ugDelLine : return "Delete Line"; 121 case ugDelLine : return "Delete Line";
122 } 122 }
123 return ""; 123 return "";
124} 124}
125 125
126const int KateDocument::maxAttribs = 32; 126const int KateDocument::maxAttribs = 32;
127 127
128QStringList KateDocument::searchForList = QStringList(); 128QStringList KateDocument::searchForList = QStringList();
129QStringList KateDocument::replaceWithList = QStringList(); 129QStringList KateDocument::replaceWithList = QStringList();
130 130
131uint KateDocument::uniqueID = 0; 131uint KateDocument::uniqueID = 0;
132 132
133QPtrDict<KateDocument::KateDocPrivate>* KateDocument::d_ptr = 0; 133QPtrDict<KateDocument::KateDocPrivate>* KateDocument::d_ptr = 0;
134 134
135 135
136KateDocument::KateDocument(bool bSingleViewMode, bool bBrowserView, 136KateDocument::KateDocument(bool bSingleViewMode, bool bBrowserView,
137 QWidget *parentWidget, const char *widgetName, 137 QWidget *parentWidget, const char *widgetName,
138 QObject *, const char *) 138 QObject *, const char *)
139 : Kate::Document (), 139 : Kate::Document (),
140 myFont(KGlobalSettings::generalFont()), myFontBold(KGlobalSettings::generalFont()), myFontItalic(KGlobalSettings::generalFont()), myFontBI(KGlobalSettings::generalFont()), 140 myFont(KGlobalSettings::generalFont()), myFontBold(KGlobalSettings::generalFont()), myFontItalic(KGlobalSettings::generalFont()), myFontBI(KGlobalSettings::generalFont()),
141 myFontMetrics (myFont), myFontMetricsBold (myFontBold), myFontMetricsItalic (myFontItalic), myFontMetricsBI (myFontBI), 141 myFontMetrics (myFont), myFontMetricsBold (myFontBold), myFontMetricsItalic (myFontItalic), myFontMetricsBI (myFontBI),
142 hlManager(HlManager::self ()) 142 hlManager(HlManager::self ())
143{ 143{
144 144
145 d(this)->hlSetByUser = false; 145 d(this)->hlSetByUser = false;
146 PreHighlightedTill=0; 146 PreHighlightedTill=0;
147 RequestPreHighlightTill=0; 147 RequestPreHighlightTill=0;
148 148
149 m_bSingleViewMode=bSingleViewMode; 149 m_bSingleViewMode=bSingleViewMode;
150 m_bBrowserView = bBrowserView; 150 m_bBrowserView = bBrowserView;
151 151
152 m_url = QString::null; 152 m_url = QString::null;
153 153
154 // NOTE: QFont::CharSet doesn't provide all the charsets KDE supports 154 // NOTE: QFont::CharSet doesn't provide all the charsets KDE supports
155 // (esp. it doesn't distinguish between UTF-8 and iso10646-1) 155 // (esp. it doesn't distinguish between UTF-8 and iso10646-1)
156 156
157 myEncoding = QString::fromLatin1(QTextCodec::codecForLocale()->name()); 157 myEncoding = QString::fromLatin1(QTextCodec::codecForLocale()->name());
158 158
159 maxLength = -1; 159 maxLength = -1;
160 160
161 setFont (KGlobalSettings::generalFont()); 161 setFont (KGlobalSettings::generalFont());
162 162
163 myDocID = uniqueID; 163 myDocID = uniqueID;
164 uniqueID++; 164 uniqueID++;
165 165
166 myDocName = QString (""); 166 myDocName = QString ("");
167 fileInfo = new QFileInfo (); 167 fileInfo = new QFileInfo ();
168 168
169 myCmd = new KateCmd (this); 169 myCmd = new KateCmd (this);
170 170
171 connect(this,SIGNAL(modifiedChanged ()),this,SLOT(slotModChanged ())); 171 connect(this,SIGNAL(modifiedChanged()),this,SLOT(slotModChanged()));
172 172
173 buffer = new KWBuffer; 173 buffer = new KWBuffer;
174 connect(buffer, SIGNAL(linesChanged(int)), this, SLOT(slotBufferChanged())); 174 connect(buffer, SIGNAL(linesChanged(int)), this, SLOT(slotBufferChanged()));
175// connect(buffer, SIGNAL(textChanged()), this, SIGNAL(textChanged())); 175// connect(buffer, SIGNAL(textChanged()), this, SIGNAL(textChanged()));
176 connect(buffer, SIGNAL(needHighlight(long,long)),this,SLOT(slotBufferHighlight(long,long))); 176 connect(buffer, SIGNAL(needHighlight(long,long)),this,SLOT(slotBufferHighlight(long,long)));
177 177
178 colors[0] = KGlobalSettings::baseColor(); 178 colors[0] = KGlobalSettings::baseColor();
179 colors[1] = KGlobalSettings::highlightColor(); 179 colors[1] = KGlobalSettings::highlightColor();
180 180
181 m_attribs = new Attribute[maxAttribs]; 181 m_attribs = new Attribute[maxAttribs];
182 182
183 m_highlight = 0L; 183 m_highlight = 0L;
184 tabChars = 8; 184 tabChars = 8;
185 185
186 m_singleSelection = false; 186 m_singleSelection = false;
187 187
188 newDocGeometry = false; 188 newDocGeometry = false;
189 readOnly = false; 189 readOnly = false;
190 newDoc = false; 190 newDoc = false;
191 191
192 modified = false; 192 modified = false;
193 193
194 undoList.setAutoDelete(true); 194 undoList.setAutoDelete(true);
195 undoState = 0; 195 undoState = 0;
196 undoSteps = 50; 196 undoSteps = 50;
197 197
198 pseudoModal = 0L; 198 pseudoModal = 0L;
199 clear(); 199 clear();
200 200
201 setHighlight(0); //calls updateFontData() 201 setHighlight(0); //calls updateFontData()
202 // if the user changes the highlight with the dialog, notify the doc 202 // if the user changes the highlight with the dialog, notify the doc
203 connect(hlManager,SIGNAL(changed()),SLOT(hlChanged())); 203 connect(hlManager,SIGNAL(changed()),SLOT(hlChanged()));
204 204
205 newDocGeometry = false; 205 newDocGeometry = false;
206 206
207 readConfig(); 207 readConfig();
208 208
209 setReadOnly(false); 209 setReadOnly(false);
210} 210}
211 211
212void KateDocument::setDontChangeHlOnSave() 212void KateDocument::setDontChangeHlOnSave()
213{ 213{
214 d(this)->hlSetByUser = true; 214 d(this)->hlSetByUser = true;
215} 215}
216 216
217void KateDocument::setFont (QFont font) 217void KateDocument::setFont (QFont font)
218{ 218{
219 kdDebug()<<"Kate:: setFont"<<endl; 219 kdDebug()<<"Kate:: setFont"<<endl;
220 int oldwidth=myFontMetrics.width('W'); //Quick & Dirty Hack (by JoWenn) //Remove in KDE 3.0 220 int oldwidth=myFontMetrics.width('W'); //Quick & Dirty Hack (by JoWenn) //Remove in KDE 3.0
221 myFont = font; 221 myFont = font;
222 myFontBold = QFont (font); 222 myFontBold = QFont (font);
223 myFontBold.setBold (true); 223 myFontBold.setBold (true);
224 224
225 myFontItalic = QFont (font); 225 myFontItalic = QFont (font);
226 myFontItalic.setItalic (true); 226 myFontItalic.setItalic (true);
227 227
228 myFontBI = QFont (font); 228 myFontBI = QFont (font);
229 myFontBI.setBold (true); 229 myFontBI.setBold (true);
230 myFontBI.setItalic (true); 230 myFontBI.setItalic (true);
231 231
232 myFontMetrics = CachedFontMetrics (myFont); 232 myFontMetrics = CachedFontMetrics (myFont);
233 myFontMetricsBold = CachedFontMetrics (myFontBold); 233 myFontMetricsBold = CachedFontMetrics (myFontBold);
234 myFontMetricsItalic = CachedFontMetrics (myFontItalic); 234 myFontMetricsItalic = CachedFontMetrics (myFontItalic);
235 myFontMetricsBI = CachedFontMetrics (myFontBI); 235 myFontMetricsBI = CachedFontMetrics (myFontBI);
236 int newwidth=myFontMetrics.width('W'); //Quick & Dirty Hack (by JoWenn) //Remove in KDE 3.0 236 int newwidth=myFontMetrics.width('W'); //Quick & Dirty Hack (by JoWenn) //Remove in KDE 3.0
237 maxLength=maxLength*(float)newwidth/(float)oldwidth; //Quick & Dirty Hack (by JoWenn) //Remove in KDE 3.0 237 maxLength=maxLength*(float)newwidth/(float)oldwidth; //Quick & Dirty Hack (by JoWenn) //Remove in KDE 3.0
238 238
239 updateFontData(); 239 updateFontData();
240 updateViews(); //Quick & Dirty Hack (by JoWenn) //Remove in KDE 3.0 240 updateViews(); //Quick & Dirty Hack (by JoWenn) //Remove in KDE 3.0
241 241
242} 242}
243 243
244long KateDocument::needPreHighlight(long till) 244long KateDocument::needPreHighlight(long till)
245{ 245{
246 int max=numLines()-1; 246 int max=numLines()-1;
247 if (till>max) 247 if (till>max)
248 { 248 {
249 till=max; 249 till=max;
250 } 250 }
251 if (PreHighlightedTill>=till) return -1; 251 if (PreHighlightedTill>=till) return -1;
252 252
253 long tmp=RequestPreHighlightTill; 253 long tmp=RequestPreHighlightTill;
254 if (RequestPreHighlightTill<till) 254 if (RequestPreHighlightTill<till)
255 { 255 {
256 RequestPreHighlightTill=till; 256 RequestPreHighlightTill=till;
257 if (tmp<=PreHighlightedTill) QTimer::singleShot(10,this,SLOT(doPreHighlight())); 257 if (tmp<=PreHighlightedTill) QTimer::singleShot(10,this,SLOT(doPreHighlight()));
258 } 258 }
259 return RequestPreHighlightTill; 259 return RequestPreHighlightTill;
260} 260}
261 261
262void KateDocument::doPreHighlight() 262void KateDocument::doPreHighlight()
263{ 263{
264 int from = PreHighlightedTill; 264 int from = PreHighlightedTill;
265 int till = PreHighlightedTill+200; 265 int till = PreHighlightedTill+200;
266 int max = numLines()-1; 266 int max = numLines()-1;
267 if (till > max) 267 if (till > max)
268 { 268 {
269 till = max; 269 till = max;
270 } 270 }
271 PreHighlightedTill = till; 271 PreHighlightedTill = till;
272 updateLines(from,till); 272 updateLines(from,till);
273 emit preHighlightChanged(PreHighlightedTill); 273 emit preHighlightChanged(PreHighlightedTill);
274 if (PreHighlightedTill<RequestPreHighlightTill) 274 if (PreHighlightedTill<RequestPreHighlightTill)
275 QTimer::singleShot(10,this,SLOT(doPreHighlight())); 275 QTimer::singleShot(10,this,SLOT(doPreHighlight()));
276} 276}
277 277
278KateDocument::~KateDocument() 278KateDocument::~KateDocument()
279{ 279{
280 m_highlight->release(); 280 m_highlight->release();
281 writeConfig(); 281 writeConfig();
282 282
283 if ( !m_bSingleViewMode ) 283 if ( !m_bSingleViewMode )
284 { 284 {
285 m_views.setAutoDelete( true ); 285 m_views.setAutoDelete( true );
286 m_views.clear(); 286 m_views.clear();
287 m_views.setAutoDelete( false ); 287 m_views.setAutoDelete( false );
288 } 288 }
289 delete_d(this); 289 delete_d(this);
290} 290}
291 291
292void KateDocument::openURL(const QString &filename) 292void KateDocument::openURL(const QString &filename)
293{ 293{
294 294
295 m_file=filename; 295 m_file=filename;
296 fileInfo->setFile (m_file); 296 fileInfo->setFile (m_file);
297 setMTime(); 297 setMTime();
298 298
299 if (!fileInfo->exists() || !fileInfo->isReadable()) 299 if (!fileInfo->exists() || !fileInfo->isReadable())
300 { 300 {
301 qDebug("File doesn't exit or couldn't be read"); 301 qDebug("File doesn't exit or couldn't be read");
302 return ; 302 return ;
303 } 303 }
304 304
305 buffer->clear(); 305 buffer->clear();
306#warning fixme 306#warning fixme
307// buffer->insertFile(0, m_file, KGlobal::charsets()->codecForName(myEncoding)); 307// buffer->insertFile(0, m_file, KGlobal::charsets()->codecForName(myEncoding));
308 qDebug("Telling buffer to open file"); 308 qDebug("Telling buffer to open file");
309 buffer->insertFile(0, m_file, QTextCodec::codecForLocale()); 309 buffer->insertFile(0, m_file, QTextCodec::codecForLocale());
310 310
311 setMTime(); 311 setMTime();
312 312
313 if (myWordWrap) 313 if (myWordWrap)
314 wrapText (myWordWrapAt); 314 wrapText (myWordWrapAt);
315 315
316 int hl = hlManager->wildcardFind( m_file ); 316 int hl = hlManager->wildcardFind( m_file );
317 317
318 setHighlight(hl); 318 setHighlight(hl);
319 319
320 updateLines(); 320 updateLines();
321 updateViews(); 321 updateViews();
322 322
323 emit fileNameChanged(); 323 emit fileNameChanged();
324 324
325 return ; 325 return ;
326} 326}
327 327
328bool KateDocument::saveFile() 328bool KateDocument::saveFile()
329{ 329{
330 330
331 QFile f( m_file ); 331 QFile f( m_file );
332 if ( !f.open( IO_WriteOnly ) ) 332 if ( !f.open( IO_WriteOnly ) )
333 return false; // Error 333 return false; // Error
334 334
335 QTextStream stream(&f); 335 QTextStream stream(&f);
336 336
337 stream.setEncoding(QTextStream::RawUnicode); // disable Unicode headers 337 stream.setEncoding(QTextStream::RawUnicode); // disable Unicode headers
338#warning fixme 338#warning fixme
339// stream.setCodec(KGlobal::charsets()->codecForName(myEncoding)); 339// stream.setCodec(KGlobal::charsets()->codecForName(myEncoding));
340 stream.setCodec(QTextCodec::codecForLocale()); // this line sets the mapper to the correct codec 340 stream.setCodec(QTextCodec::codecForLocale()); // this line sets the mapper to the correct codec
341 341
342 int maxLine = numLines(); 342 int maxLine = numLines();
343 int line = 0; 343 int line = 0;
344 while(true) 344 while(true)
345 { 345 {
346 stream << getTextLine(line)->getString(); 346 stream << getTextLine(line)->getString();
347 line++; 347 line++;
348 if (line >= maxLine) break; 348 if (line >= maxLine) break;
349 349
350 if (eolMode == KateDocument::eolUnix) stream << "\n"; 350 if (eolMode == KateDocument::eolUnix) stream << "\n";
351 else if (eolMode == KateDocument::eolDos) stream << "\r\n"; 351 else if (eolMode == KateDocument::eolDos) stream << "\r\n";
352 else if (eolMode == KateDocument::eolMacintosh) stream << '\r'; 352 else if (eolMode == KateDocument::eolMacintosh) stream << '\r';
353 }; 353 };
354 f.close(); 354 f.close();
355 355
356 fileInfo->setFile (m_file); 356 fileInfo->setFile (m_file);
357 setMTime(); 357 setMTime();
358 358
359 if (!(d(this)->hlSetByUser)) 359 if (!(d(this)->hlSetByUser))
360 { 360 {
361 int hl = hlManager->wildcardFind( m_file ); 361 int hl = hlManager->wildcardFind( m_file );
362 362
363 setHighlight(hl); 363 setHighlight(hl);
diff --git a/noncore/apps/tinykate/libkate/view/kateviewdialog.cpp b/noncore/apps/tinykate/libkate/view/kateviewdialog.cpp
index a85fb87..8e68262 100644
--- a/noncore/apps/tinykate/libkate/view/kateviewdialog.cpp
+++ b/noncore/apps/tinykate/libkate/view/kateviewdialog.cpp
@@ -346,226 +346,226 @@ void SelectConfigTab::getData(KateView *view) {
346 if (opt[z]->isChecked()) configFlags |= flags[z]; // set flag if checked 346 if (opt[z]->isChecked()) configFlags |= flags[z]; // set flag if checked
347 } 347 }
348 view->setConfig(configFlags); 348 view->setConfig(configFlags);
349} 349}
350 350
351const int EditConfigTab::flags[] = {KateView::cfWordWrap, KateView::cfReplaceTabs, KateView::cfRemoveSpaces, 351const int EditConfigTab::flags[] = {KateView::cfWordWrap, KateView::cfReplaceTabs, KateView::cfRemoveSpaces,
352 KateView::cfAutoBrackets, KateView::cfGroupUndo, KateView::cfShowTabs, KateView::cfSmartHome, 352 KateView::cfAutoBrackets, KateView::cfGroupUndo, KateView::cfShowTabs, KateView::cfSmartHome,
353 KateView::cfPageUDMovesCursor, KateView::cfWrapCursor}; 353 KateView::cfPageUDMovesCursor, KateView::cfWrapCursor};
354 354
355EditConfigTab::EditConfigTab(QWidget *parent, KateView *view) 355EditConfigTab::EditConfigTab(QWidget *parent, KateView *view)
356 : QWidget(parent, 0L) { 356 : QWidget(parent, 0L) {
357 357
358 QHBoxLayout *mainLayout; 358 QHBoxLayout *mainLayout;
359 QVBoxLayout *cbLayout, *leLayout; 359 QVBoxLayout *cbLayout, *leLayout;
360 int configFlags; 360 int configFlags;
361 361
362 mainLayout = new QHBoxLayout(this, 0, KDialog::spacingHint() ); 362 mainLayout = new QHBoxLayout(this, 0, KDialog::spacingHint() );
363 363
364 // checkboxes 364 // checkboxes
365 cbLayout = new QVBoxLayout( mainLayout ); 365 cbLayout = new QVBoxLayout( mainLayout );
366 configFlags = view->config(); 366 configFlags = view->config();
367 367
368 opt[0] = new QCheckBox(i18n("&Word wrap"), this); 368 opt[0] = new QCheckBox(i18n("&Word wrap"), this);
369 cbLayout->addWidget(opt[0], 0, AlignLeft); 369 cbLayout->addWidget(opt[0], 0, AlignLeft);
370 opt[0]->setChecked(view->doc()->wordWrap()); 370 opt[0]->setChecked(view->doc()->wordWrap());
371 371
372 opt[1] = new QCheckBox(i18n("Replace &tabs with spaces"), this); 372 opt[1] = new QCheckBox(i18n("Replace &tabs with spaces"), this);
373 cbLayout->addWidget(opt[1], 0, AlignLeft); 373 cbLayout->addWidget(opt[1], 0, AlignLeft);
374 opt[1]->setChecked(configFlags & flags[1]); 374 opt[1]->setChecked(configFlags & flags[1]);
375 375
376 opt[2] = new QCheckBox(i18n("&Remove trailing spaces"), this); 376 opt[2] = new QCheckBox(i18n("&Remove trailing spaces"), this);
377 cbLayout->addWidget(opt[2], 0, AlignLeft); 377 cbLayout->addWidget(opt[2], 0, AlignLeft);
378 opt[2]->setChecked(configFlags & flags[2]); 378 opt[2]->setChecked(configFlags & flags[2]);
379 379
380 opt[3] = new QCheckBox(i18n("&Auto brackets"), this); 380 opt[3] = new QCheckBox(i18n("&Auto brackets"), this);
381 cbLayout->addWidget(opt[3], 0, AlignLeft); 381 cbLayout->addWidget(opt[3], 0, AlignLeft);
382 opt[3]->setChecked(configFlags & flags[3]); 382 opt[3]->setChecked(configFlags & flags[3]);
383 383
384 opt[4] = new QCheckBox(i18n("Group &undos"), this); 384 opt[4] = new QCheckBox(i18n("Group &undos"), this);
385 cbLayout->addWidget(opt[4], 0, AlignLeft); 385 cbLayout->addWidget(opt[4], 0, AlignLeft);
386 opt[4]->setChecked(configFlags & flags[4]); 386 opt[4]->setChecked(configFlags & flags[4]);
387 387
388 opt[5] = new QCheckBox(i18n("&Show tabs"), this); 388 opt[5] = new QCheckBox(i18n("&Show tabs"), this);
389 cbLayout->addWidget(opt[5], 0, AlignLeft); 389 cbLayout->addWidget(opt[5], 0, AlignLeft);
390 opt[5]->setChecked(configFlags & flags[5]); 390 opt[5]->setChecked(configFlags & flags[5]);
391 391
392 opt[6] = new QCheckBox(i18n("Smart &home"), this); 392 opt[6] = new QCheckBox(i18n("Smart &home"), this);
393 cbLayout->addWidget(opt[6], 0, AlignLeft); 393 cbLayout->addWidget(opt[6], 0, AlignLeft);
394 opt[6]->setChecked(configFlags & flags[6]); 394 opt[6]->setChecked(configFlags & flags[6]);
395 395
396 opt[7] = new QCheckBox(i18n("&Page up/down moves cursor"), this); 396 opt[7] = new QCheckBox(i18n("&Page up/down moves cursor"), this);
397 cbLayout->addWidget(opt[7], 0, AlignLeft); 397 cbLayout->addWidget(opt[7], 0, AlignLeft);
398 opt[7]->setChecked(configFlags & flags[7]); 398 opt[7]->setChecked(configFlags & flags[7]);
399 399
400 opt[8] = new QCheckBox(i18n("Wrap &cursor"), this); 400 opt[8] = new QCheckBox(i18n("Wrap &cursor"), this);
401 cbLayout->addWidget(opt[8], 0, AlignLeft); 401 cbLayout->addWidget(opt[8], 0, AlignLeft);
402 opt[8]->setChecked(configFlags & flags[8]); 402 opt[8]->setChecked(configFlags & flags[8]);
403 403
404 cbLayout->addStretch(); 404 cbLayout->addStretch();
405 405
406 // edit lines 406 // edit lines
407 leLayout = new QVBoxLayout(); 407 leLayout = new QVBoxLayout();
408 mainLayout->addLayout(leLayout,10); 408 mainLayout->addLayout(leLayout,10);
409 409
410 e1 = new QSpinBox(this); 410 e1 = new QSpinBox(this);
411 e1->setMinValue(20); 411 e1->setMinValue(20);
412 e1->setMaxValue( 200); 412 e1->setMaxValue( 200);
413 e1->setValue((int)(view->doc()->wordWrapAt())); 413 e1->setValue((int)(view->doc()->wordWrapAt()));
414#warning fixme e1->setLabel(i18n("Wrap Words At:")); 414#warning fixme e1->setLabel(i18n("Wrap Words At:"));
415 415
416 e2 = new QSpinBox(this); 416 e2 = new QSpinBox(this);
417 e2->setMinValue(1); 417 e2->setMinValue(1);
418 e2->setMaxValue(16); 418 e2->setMaxValue(16);
419 e2->setValue((int)view->tabWidth()); 419 e2->setValue((int)view->tabWidth());
420 420
421#warning fixme e2->setLabel(i18n("Tab/Indent Width:")); 421#warning fixme e2->setLabel(i18n("Tab/Indent Width:"));
422 422
423 e3 = new QSpinBox(this); 423 e3 = new QSpinBox(this);
424 e3->setMinValue(5); 424 e3->setMinValue(5);
425 e3->setMaxValue( 30000); 425 e3->setMaxValue( 30000);
426#warning fixme e3->setLabel(i18n("Undo steps:")); 426#warning fixme e3->setLabel(i18n("Undo steps:"));
427 e3->setValue((int)view->undoSteps()); 427 e3->setValue((int)view->undoSteps());
428 428
429 leLayout->addWidget(e1, 0, AlignLeft); 429 leLayout->addWidget(e1, 0, AlignLeft);
430 leLayout->addWidget(e2, 0, AlignLeft); 430 leLayout->addWidget(e2, 0, AlignLeft);
431 leLayout->addWidget(e3, 0, AlignLeft); 431 leLayout->addWidget(e3, 0, AlignLeft);
432 432
433 433
434 QVBox *box = new QVBox (this); 434 QVBox *box = new QVBox (this);
435 leLayout->addWidget (box, 0, AlignLeft); 435 leLayout->addWidget (box, 0, AlignLeft);
436 436
437 new QLabel (i18n("Encoding:"), box); 437 new QLabel (i18n("Encoding:"), box);
438 438
439 encoding = new QComboBox(box); 439 encoding = new QComboBox(box);
440#warning fixme 440#warning fixme
441#if 0 441#if 0
442 encoding->insertStringList (KGlobal::charsets()->availableEncodingNames()); 442 encoding->insertStringList (KGlobal::charsets()->availableEncodingNames());
443 encoding->setCurrentItem (KGlobal::charsets()->availableEncodingNames().findIndex(view->doc()->encoding())); 443 encoding->setCurrentItem (KGlobal::charsets()->availableEncodingNames().findIndex(view->doc()->encoding()));
444#endif 444#endif
445 leLayout->addStretch(); 445 leLayout->addStretch();
446 446
447 // What is this? help 447 // What is this? help
448 QWhatsThis::add(opt[0], i18n("Word wrap is a feature that causes the editor to automatically start a new line of text and move (wrap) the cursor to the beginning of that new line. KateView will automatically start a new line of text when the current line reaches the length specified by the Wrap Words At: option.<p><b>NOTE:<b> Word Wrap will not change existing lines or wrap them for easy reading as in some applications.")); 448 QWhatsThis::add(opt[0], i18n("Word wrap is a feature that causes the editor to automatically start a new line of text and move (wrap) the cursor to the beginning of that new line. KateView will automatically start a new line of text when the current line reaches the length specified by the Wrap Words At: option.<p><b>NOTE:<b> Word Wrap will not change existing lines or wrap them for easy reading as in some applications."));
449 QWhatsThis::add(e1, i18n("If the Word Wrap option is selected this entry determines the length (in characters) at which the editor will automatically start a new line.")); 449 QWhatsThis::add(e1, i18n("If the Word Wrap option is selected this entry determines the length (in characters) at which the editor will automatically start a new line."));
450 QWhatsThis::add(opt[1], i18n("KateView will replace any tabs with the number of spaces indicated in the Tab Width: entry.")); 450 QWhatsThis::add(opt[1], i18n("KateView will replace any tabs with the number of spaces indicated in the Tab Width: entry."));
451 QWhatsThis::add(e2, i18n("If the Replace Tabs By Spaces option is selected this entry determines the number of spaces with which the editor will automatically replace tabs.")); 451 QWhatsThis::add(e2, i18n("If the Replace Tabs By Spaces option is selected this entry determines the number of spaces with which the editor will automatically replace tabs."));
452 QWhatsThis::add(opt[2], i18n("KateView will automatically eliminate extra spaces at the ends of lines of text.")); 452 QWhatsThis::add(opt[2], i18n("KateView will automatically eliminate extra spaces at the ends of lines of text."));
453 QWhatsThis::add(opt[3], i18n("When the user types a left bracket ([,(, or {) KateView automatically enters the right bracket (}, ), or ]) to the right of the cursor.")); 453 QWhatsThis::add(opt[3], i18n("When the user types a left bracket ([,(, or {) KateView automatically enters the right bracket (}, ), or ]) to the right of the cursor."));
454 QWhatsThis::add(opt[4], i18n("Checking this will cause sequences of similar actions to be undone at once.")); 454 QWhatsThis::add(opt[4], i18n("Checking this will cause sequences of similar actions to be undone at once."));
455 QWhatsThis::add(opt[5], i18n("The editor will display a symbol to indicate the presence of a tab in the text.")); 455 QWhatsThis::add(opt[5], i18n("The editor will display a symbol to indicate the presence of a tab in the text."));
456 QWhatsThis::add(opt[6], i18n("Not yet implemented.")); 456 QWhatsThis::add(opt[6], i18n("Not yet implemented."));
457 QWhatsThis::add(opt[7], i18n("If this is selected, the insertion cursor will be moved to the first/last line when pressing the page up/down buttons.<p>If not selected, it will remain at it's relative position in the visible text.")); 457 QWhatsThis::add(opt[7], i18n("If this is selected, the insertion cursor will be moved to the first/last line when pressing the page up/down buttons.<p>If not selected, it will remain at it's relative position in the visible text."));
458 QWhatsThis::add(e3, i18n("Sets the number of undo/redo steps to record. More steps uses more memory.")); 458 QWhatsThis::add(e3, i18n("Sets the number of undo/redo steps to record. More steps uses more memory."));
459 QWhatsThis::add(opt[8], i18n("When on, moving the insertion cursor using the <b>Left</b> and <b>Right</b> keys will go on to previous/next line at beginning/end of the line, similar to most editors.<p>When off, the insertion cursor cannot be moved left of the line start, but it can be moved off the line end, which can be very handy for programmers.")); 459 QWhatsThis::add(opt[8], i18n("When on, moving the insertion cursor using the <b>Left</b> and <b>Right</b> keys will go on to previous/next line at beginning/end of the line, similar to most editors.<p>When off, the insertion cursor cannot be moved left of the line start, but it can be moved off the line end, which can be very handy for programmers."));
460} 460}
461 461
462void EditConfigTab::getData(KateView *view) 462void EditConfigTab::getData(KateView *view)
463{ 463{
464 int configFlags, z; 464 int configFlags, z;
465 465
466 configFlags = view->config(); 466 configFlags = view->config();
467 for (z = 1; z < numFlags; z++) { 467 for (z = 1; z < numFlags; z++) {
468 configFlags &= ~flags[z]; 468 configFlags &= ~flags[z];
469 if (opt[z]->isChecked()) configFlags |= flags[z]; 469 if (opt[z]->isChecked()) configFlags |= flags[z];
470 } 470 }
471 view->setConfig(configFlags); 471 view->setConfig(configFlags);
472 472
473 view->setEncoding (encoding->currentText()); 473 view->setEncoding (encoding->currentText());
474 view->doc()->setWordWrapAt(e1->value()); 474 view->doc()->setWordWrapAt(e1->value());
475 view->doc()->setWordWrap (opt[0]->isChecked()); 475 view->doc()->setWordWrap (opt[0]->isChecked());
476 view->setTabWidth(e2->value()); 476 view->setTabWidth(e2->value());
477 view->setUndoSteps(e3->value()); 477 view->setUndoSteps(e3->value());
478} 478}
479 479
480ColorConfig::ColorConfig( QWidget *parent, char *name ) 480ColorConfig::ColorConfig( QWidget *parent, char *name )
481 : QWidget( parent, name ) 481 : QWidget( parent, name )
482{ 482{
483 QGridLayout *glay = new QGridLayout( this, 6, 2, 0, KDialog::spacingHint()); 483 QGridLayout *glay = new QGridLayout( this, 6, 2, 0, KDialog::spacingHint());
484 glay->setColStretch(1,1); 484 glay->setColStretch(1,1);
485 glay->setRowStretch(5,1); 485 glay->setRowStretch(5,1);
486 486
487 QLabel *label; 487 QLabel *label;
488 488
489 label = new QLabel( i18n("Background:"), this); 489 label = new QLabel( i18n("Background:"), this);
490 label->setAlignment( AlignRight|AlignVCenter ); 490 label->setAlignment( AlignRight|AlignVCenter );
491 m_back = new KColorButton( this ); 491 m_back = new KColorButton( this );
492 glay->addWidget( label, 0, 0 ); 492 glay->addWidget( label, 0, 0 );
493 glay->addWidget( m_back, 0, 1 ); 493 glay->addWidget( m_back, 0, 1 );
494 494
495 label = new QLabel( i18n("Selected:"), this); 495 label = new QLabel( i18n("Selected:"), this);
496 label->setAlignment( AlignRight|AlignVCenter ); 496 label->setAlignment( AlignRight|AlignVCenter );
497 m_selected = new KColorButton( this ); 497 m_selected = new KColorButton( this );
498 glay->addWidget( label, 2, 0 ); 498 glay->addWidget( label, 2, 0 );
499 glay->addWidget( m_selected, 2, 1 ); 499 glay->addWidget( m_selected, 2, 1 );
500 500
501 // QWhatsThis help 501 // QWhatsThis help
502 QWhatsThis::add(m_back, i18n("Sets the background color of the editing area")); 502 QWhatsThis::add(m_back, i18n("Sets the background color of the editing area"));
503 QWhatsThis::add(m_selected, i18n("Sets the background color of the selection. To set the text color for selected text, use the &quot;<b>Configure Highlighting</b>&quot; dialog.")); 503 QWhatsThis::add(m_selected, i18n("Sets the background color of the selection. To set the text color for selected text, use the &quot;<b>Configure Highlighting</b>&quot; dialog."));
504} 504}
505 505
506 506
507ColorConfig::~ColorConfig() 507ColorConfig::~ColorConfig()
508{ 508{
509} 509}
510 510
511void ColorConfig::setColors(QColor *colors) 511void ColorConfig::setColors(QColor *colors)
512{ 512{
513 m_back->setColor( colors[0] ); 513 m_back->setColor( colors[0] );
514 m_selected->setColor( colors[1] ); 514 m_selected->setColor( colors[1] );
515} 515}
516 516
517void ColorConfig::getColors(QColor *colors) 517void ColorConfig::getColors(QColor *colors)
518{ 518{
519 colors[0] = m_back->color(); 519 colors[0] = m_back->color();
520 colors[1] = m_selected->color(); 520 colors[1] = m_selected->color();
521} 521}
522 522
523FontConfig::FontConfig( QWidget *parent, char *name ) 523FontConfig::FontConfig( QWidget *parent, char *name )
524 : QWidget( parent, name ) 524 : QWidget( parent, name )
525{ 525{
526 // sizemanagment 526 // sizemanagment
527 QGridLayout *grid = new QGridLayout( this, 1, 1 ); 527 QGridLayout *grid = new QGridLayout( this, 1, 1 );
528// QString familyStr = cfg. readEntry ( "FontFamily", "Helvetica" ); 528// QString familyStr = cfg. readEntry ( "FontFamily", "Helvetica" );
529// QString styleStr = cfg. readEntry ( "FontStyle", "Regular" ); 529// QString styleStr = cfg. readEntry ( "FontStyle", "Regular" );
530// int size = cfg. readNumEntry ( "FontSize", 10 ); 530// int size = cfg. readNumEntry ( "FontSize", 10 );
531// OFontSelector *m_fontselect; 531// OFontSelector *m_fontselect;
532 532
533 m_fontselect = new Opie::OFontSelector ( false, this, "FontTab" ); 533 m_fontselect = new Opie::OFontSelector ( false, this, "FontTab" );
534// m_fontselect-> setSelectedFont ( familyStr, styleStr, size ); 534// m_fontselect-> setSelectedFont ( familyStr, styleStr, size );
535// QWhatsThis::add( m_fontselect, 535// QWhatsThis::add( m_fontselect,
536// tr( "Select the desired name, style and size of the default font applications will use." ) ); 536// tr( "Select the desired name, style and size of the default font applications will use." ) );
537 537
538 connect( m_fontselect, SIGNAL( fontSelected ( const QFont & )), 538 connect( m_fontselect, SIGNAL( fontSelected(const QFont&)),
539 this, SLOT( slotFontSelected( const QFont & ))); 539 this, SLOT( slotFontSelected(const QFont&)));
540 grid->addWidget( m_fontselect, 0, 0); 540 grid->addWidget( m_fontselect, 0, 0);
541 541
542 542
543// #if 0 543// #if 0
544// m_fontchooser = new KFontChooser ( this ); 544// m_fontchooser = new KFontChooser ( this );
545// m_fontchooser->enableColumn(KFontChooser::StyleList, false); 545// m_fontchooser->enableColumn(KFontChooser::StyleList, false);
546// grid->addWidget( m_fontchooser, 0, 0); 546// grid->addWidget( m_fontchooser, 0, 0);
547 547
548// connect (m_fontchooser, SIGNAL (fontSelected( const QFont & )), this, SLOT (slotFontSelected( const QFont & ))); 548// connect (m_fontchooser, SIGNAL (fontSelected(const QFont&)), this, SLOT (slotFontSelected(const QFont&)));
549// #endif 549// #endif
550} 550}
551 551
552FontConfig::~FontConfig() 552FontConfig::~FontConfig()
553{ 553{
554} 554}
555 555
556void FontConfig::setFont ( const QFont &font ) 556void FontConfig::setFont ( const QFont &font )
557{ 557{
558//#if 0 558//#if 0
559m_fontselect->setFont (font); 559m_fontselect->setFont (font);
560 myFont = font; 560 myFont = font;
561//#endif 561//#endif
562} 562}
563 563
564void FontConfig::slotFontSelected( const QFont &font ) 564void FontConfig::slotFontSelected( const QFont &font )
565{ 565{
566 myFont = font; 566 myFont = font;
567} 567}
568 568
569 569
570 570
571 571
diff --git a/noncore/apps/tinykate/tinykate.cpp b/noncore/apps/tinykate/tinykate.cpp
index 19a0127..32c1eab 100644
--- a/noncore/apps/tinykate/tinykate.cpp
+++ b/noncore/apps/tinykate/tinykate.cpp
@@ -1,237 +1,237 @@
1/*************************************************************************** 1/***************************************************************************
2 tinykate.cpp 2 tinykate.cpp
3 Tiny KATE mainwindow 3 Tiny KATE mainwindow
4 ------------------- 4 -------------------
5 begin : November 2002 5 begin : November 2002
6 copyright : (C) 2002 by Joseph Wenninger <jowenn@kde.org> 6 copyright : (C) 2002 by Joseph Wenninger <jowenn@kde.org>
7 ***************************************************************************/ 7 ***************************************************************************/
8 8
9/*************************************************************************** 9/***************************************************************************
10 * * 10 * *
11 * This program is free softwaSre; you can redistribute it and/or modify * 11 * This program is free softwaSre; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by * 12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation. * 13 * the Free Software Foundation. *
14 * ONLY VERSION 2 OF THE LICENSE IS APPLICABLE * 14 * ONLY VERSION 2 OF THE LICENSE IS APPLICABLE *
15 * * 15 * *
16 ***************************************************************************/ 16 ***************************************************************************/
17#include <qaction.h> 17#include <qaction.h>
18#include <qtoolbutton.h> 18#include <qtoolbutton.h>
19#include <qmenubar.h> 19#include <qmenubar.h>
20#include <qpe/resource.h> 20#include <qpe/resource.h>
21#include <qpe/qpeapplication.h> 21#include <qpe/qpeapplication.h>
22 22
23#include <opie2/ofiledialog.h> 23#include <opie2/ofiledialog.h>
24 24
25#include "tinykate.h" 25#include "tinykate.h"
26 26
27#include <katedocument.h> 27#include <katedocument.h>
28#include <kglobal.h> 28#include <kglobal.h>
29 29
30TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) : 30TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) :
31 QMainWindow( parent, name, f ) 31 QMainWindow( parent, name, f )
32{ 32{
33 shutDown=false; 33 shutDown=false;
34 nextUnnamed=0; 34 nextUnnamed=0;
35 currentView=0; 35 currentView=0;
36 viewCount=0; 36 viewCount=0;
37 setCaption(tr("TinyKATE")); 37 setCaption(tr("TinyKATE"));
38 KGlobal::setAppName("TinyKATE"); 38 KGlobal::setAppName("TinyKATE");
39 39
40 QMenuBar *mb = new QMenuBar( this ); 40 QMenuBar *mb = new QMenuBar( this );
41 mb->setMargin( 0 ); 41 mb->setMargin( 0 );
42 42
43 tabwidget=new OTabWidget(this); 43 tabwidget=new OTabWidget(this);
44 setCentralWidget(tabwidget); 44 setCentralWidget(tabwidget);
45 connect(tabwidget,SIGNAL(currentChanged( QWidget *)),this,SLOT(slotCurrentChanged(QWidget *))); 45 connect(tabwidget,SIGNAL(currentChanged(QWidget*)),this,SLOT(slotCurrentChanged(QWidget*)));
46 46
47//FILE ACTIONS 47//FILE ACTIONS
48 QPopupMenu *popup = new QPopupMenu( this ); 48 QPopupMenu *popup = new QPopupMenu( this );
49 49
50 // Action for creating a new document 50 // Action for creating a new document
51 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); 51 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 );
52 a->addTo( popup ); 52 a->addTo( popup );
53 connect(a, SIGNAL(activated()), this, SLOT(slotNew())); 53 connect(a, SIGNAL(activated()), this, SLOT(slotNew()));
54 54
55 // Action for opening an exisiting document 55 // Action for opening an exisiting document
56 a = new QAction( tr( "Open" ),Resource::loadPixmap( "fileopen" ) , QString::null, 0, this, 0 ); 56 a = new QAction( tr( "Open" ),Resource::loadPixmap( "fileopen" ) , QString::null, 0, this, 0 );
57 a->addTo(popup); 57 a->addTo(popup);
58 connect(a, SIGNAL(activated()), this, SLOT(slotOpen())); 58 connect(a, SIGNAL(activated()), this, SLOT(slotOpen()));
59 59
60 60
61 // Action for saving document 61 // Action for saving document
62 a = new QAction( tr( "Save" ), Resource::loadPixmap( "save" ) , QString::null, 0, this, 0 ); 62 a = new QAction( tr( "Save" ), Resource::loadPixmap( "save" ) , QString::null, 0, this, 0 );
63 a->addTo(popup); 63 a->addTo(popup);
64 connect(a, SIGNAL(activated()), this, SLOT(slotSave())); 64 connect(a, SIGNAL(activated()), this, SLOT(slotSave()));
65 65
66 // Action for saving document to a new name 66 // Action for saving document to a new name
67 a = new QAction( tr( "Save As" ),Resource::loadPixmap( "save" ) , QString::null, 0, this, 0 ); 67 a = new QAction( tr( "Save As" ),Resource::loadPixmap( "save" ) , QString::null, 0, this, 0 );
68 a->addTo(popup); 68 a->addTo(popup);
69 connect(a, SIGNAL(activated()), this, SLOT(slotSaveAs())); 69 connect(a, SIGNAL(activated()), this, SLOT(slotSaveAs()));
70 70
71 // Action for closing the currently active document 71 // Action for closing the currently active document
72 a = new QAction( tr( "Close" ), Resource::loadPixmap( "quit_icon" ) , QString::null, 0, this, 0 ); 72 a = new QAction( tr( "Close" ), Resource::loadPixmap( "quit_icon" ) , QString::null, 0, this, 0 );
73 a->addTo(popup); 73 a->addTo(popup);
74 connect(a, SIGNAL(activated()), this, SLOT(slotClose())); 74 connect(a, SIGNAL(activated()), this, SLOT(slotClose()));
75 75
76 76
77 mb->insertItem(tr("File"),popup); 77 mb->insertItem(tr("File"),popup);
78 78
79//EDIT ACTIONS 79//EDIT ACTIONS
80 80
81 // Action for cutting text 81 // Action for cutting text
82 editCut = new QToolButton( 0 ); 82 editCut = new QToolButton( 0 );
83 editCut->setAutoRaise( true ); 83 editCut->setAutoRaise( true );
84 editCut->setIconSet( Resource::loadPixmap( "cut" ) ); 84 editCut->setIconSet( Resource::loadPixmap( "cut" ) );
85 85
86 // Action for Copying text 86 // Action for Copying text
87 editCopy = new QToolButton( 0 ); 87 editCopy = new QToolButton( 0 );
88 editCopy->setAutoRaise( true ); 88 editCopy->setAutoRaise( true );
89 editCopy->setIconSet( Resource::loadPixmap( "copy" ) ); 89 editCopy->setIconSet( Resource::loadPixmap( "copy" ) );
90 90
91 // Action for pasting text 91 // Action for pasting text
92 editPaste = new QToolButton( 0 ); 92 editPaste = new QToolButton( 0 );
93 editPaste->setAutoRaise( true ); 93 editPaste->setAutoRaise( true );
94 editPaste->setIconSet( Resource::loadPixmap( "paste" ) ); 94 editPaste->setIconSet( Resource::loadPixmap( "paste" ) );
95 95
96 // Action for finding / replacing text 96 // Action for finding / replacing text
97 editFindReplace = new QToolButton( 0 ); 97 editFindReplace = new QToolButton( 0 );
98 editFindReplace->setAutoRaise( true ); 98 editFindReplace->setAutoRaise( true );
99 editFindReplace->setIconSet( Resource::loadPixmap("find") ); 99 editFindReplace->setIconSet( Resource::loadPixmap("find") );
100 100
101 // Action for undo 101 // Action for undo
102 editUndo = new QToolButton( 0 ); 102 editUndo = new QToolButton( 0 );
103 editUndo->setAutoRaise( true ); 103 editUndo->setAutoRaise( true );
104 editUndo->setIconSet( Resource::loadPixmap( "undo" ) ); 104 editUndo->setIconSet( Resource::loadPixmap( "undo" ) );
105 105
106 // Action for redo 106 // Action for redo
107 editRedo = new QToolButton( 0 ); 107 editRedo = new QToolButton( 0 );
108 editRedo->setAutoRaise( true ); 108 editRedo->setAutoRaise( true );
109 editRedo->setIconSet( Resource::loadPixmap( "redo" ) ); 109 editRedo->setIconSet( Resource::loadPixmap( "redo" ) );
110 110
111//VIEW ACITONS 111//VIEW ACITONS
112 popup = new QPopupMenu( this ); 112 popup = new QPopupMenu( this );
113 113
114 viewIncFontSizes = new QAction( tr( "Font +" ), QString::null, 0, this, 0 ); 114 viewIncFontSizes = new QAction( tr( "Font +" ), QString::null, 0, this, 0 );
115 viewIncFontSizes->addTo( popup ); 115 viewIncFontSizes->addTo( popup );
116 116
117 viewDecFontSizes = new QAction( tr( "Font -" ), QString::null, 0, this, 0 ); 117 viewDecFontSizes = new QAction( tr( "Font -" ), QString::null, 0, this, 0 );
118 viewDecFontSizes->addTo( popup ); 118 viewDecFontSizes->addTo( popup );
119 119
120 mb->insertItem(tr("View"),popup); 120 mb->insertItem(tr("View"),popup);
121 121
122 popup = new QPopupMenu( this ); 122 popup = new QPopupMenu( this );
123 mb->insertItem(tr("Utils"),popup); 123 mb->insertItem(tr("Utils"),popup);
124 124
125 125
126 mb->insertItem( editCut ); 126 mb->insertItem( editCut );
127 mb->insertItem( editCopy ); 127 mb->insertItem( editCopy );
128 mb->insertItem( editPaste ); 128 mb->insertItem( editPaste );
129 mb->insertItem( editFindReplace ); 129 mb->insertItem( editFindReplace );
130 mb->insertItem( editUndo ); 130 mb->insertItem( editUndo );
131 mb->insertItem( editRedo ); 131 mb->insertItem( editRedo );
132 132
133 133
134//Highlight management 134//Highlight management
135 hlmenu=new QPopupMenu(this); 135 hlmenu=new QPopupMenu(this);
136 HlManager *hlm=HlManager::self(); 136 HlManager *hlm=HlManager::self();
137 for (int i=0;i<hlm->highlights();i++) 137 for (int i=0;i<hlm->highlights();i++)
138 { 138 {
139 hlmenu->insertItem(hlm->hlName(i),i); 139 hlmenu->insertItem(hlm->hlName(i),i);
140 } 140 }
141 popup->insertItem(tr("Highlighting"),hlmenu); 141 popup->insertItem(tr("Highlighting"),hlmenu);
142 142
143 143
144 utilSettings = new QAction( tr( "Settings" ), QString::null, 0, this, 0 ); 144 utilSettings = new QAction( tr( "Settings" ), QString::null, 0, this, 0 );
145 utilSettings->addTo( popup); 145 utilSettings->addTo( popup);
146 146
147 if( qApp->argc() > 1) open(qApp->argv()[1]); 147 if( qApp->argc() > 1) open(qApp->argv()[1]);
148 else slotNew(); 148 else slotNew();
149 149
150} 150}
151 151
152TinyKate::~TinyKate( ) 152TinyKate::~TinyKate( )
153{ 153{
154 qWarning("TinyKate destructor\n"); 154 qWarning("TinyKate destructor\n");
155 155
156 shutDown=true; 156 shutDown=true;
157 while (currentView!=0) { 157 while (currentView!=0) {
158 slotClose(); 158 slotClose();
159 } 159 }
160 160
161 if( KGlobal::config() != 0 ) { 161 if( KGlobal::config() != 0 ) {
162 qWarning("deleting KateConfig object..\n"); 162 qWarning("deleting KateConfig object..\n");
163 delete KGlobal::config(); 163 delete KGlobal::config();
164 } 164 }
165} 165}
166 166
167void TinyKate::slotOpen( ) 167void TinyKate::slotOpen( )
168{ 168{
169 QString filename = Opie::OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL, 169 QString filename = Opie::OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL,
170 QString::null); 170 QString::null);
171 if (!filename.isEmpty()) { 171 if (!filename.isEmpty()) {
172 open(filename); 172 open(filename);
173 } 173 }
174} 174}
175 175
176void TinyKate::open(const QString & filename) 176void TinyKate::open(const QString & filename)
177{ 177{
178 KateDocument *kd= new KateDocument(false, false, this,0,this); 178 KateDocument *kd= new KateDocument(false, false, this,0,this);
179 KTextEditor::View *kv; 179 KTextEditor::View *kv;
180 QFileInfo fi(filename); 180 QFileInfo fi(filename);
181 QString filenamed = fi.fileName(); 181 QString filenamed = fi.fileName();
182 tabwidget->addTab(kv=kd->createView(tabwidget,"bLAH"),"tinykate/tinykate", filenamed ); 182 tabwidget->addTab(kv=kd->createView(tabwidget,"bLAH"),"tinykate/tinykate", filenamed );
183 qDebug(filename); 183 qDebug(filename);
184 184
185 kd->setDocName( filenamed); 185 kd->setDocName( filenamed);
186 kd->open( filename ); 186 kd->open( filename );
187 viewCount++; 187 viewCount++;
188} 188}
189 189
190void TinyKate::setDocument(const QString& fileref) 190void TinyKate::setDocument(const QString& fileref)
191{ 191{
192 open( fileref ); 192 open( fileref );
193} 193}
194 194
195void TinyKate::slotCurrentChanged( QWidget * view) 195void TinyKate::slotCurrentChanged( QWidget * view)
196{ 196{
197 if (currentView) { 197 if (currentView) {
198 198
199 disconnect(editCopy,SIGNAL(activated()),currentView,SLOT(copy())); 199 disconnect(editCopy,SIGNAL(activated()),currentView,SLOT(copy()));
200 disconnect(editCut,SIGNAL(activated()),currentView,SLOT(cut())); 200 disconnect(editCut,SIGNAL(activated()),currentView,SLOT(cut()));
201 disconnect(editPaste,SIGNAL(activated()),currentView,SLOT(paste())); 201 disconnect(editPaste,SIGNAL(activated()),currentView,SLOT(paste()));
202 disconnect(editUndo,SIGNAL(activated()),currentView,SLOT(undo())); 202 disconnect(editUndo,SIGNAL(activated()),currentView,SLOT(undo()));
203 disconnect(editRedo,SIGNAL(activated()),currentView,SLOT(redo())); 203 disconnect(editRedo,SIGNAL(activated()),currentView,SLOT(redo()));
204 disconnect(viewIncFontSizes,SIGNAL(activated()), currentView,SLOT(slotIncFontSizes())); 204 disconnect(viewIncFontSizes,SIGNAL(activated()), currentView,SLOT(slotIncFontSizes()));
205 disconnect(viewDecFontSizes,SIGNAL(activated()), currentView,SLOT(slotDecFontSizes())); 205 disconnect(viewDecFontSizes,SIGNAL(activated()), currentView,SLOT(slotDecFontSizes()));
206 disconnect(hlmenu,SIGNAL(activated(int)), currentView,SLOT(setHl(int))); 206 disconnect(hlmenu,SIGNAL(activated(int)), currentView,SLOT(setHl(int)));
207 disconnect(utilSettings,SIGNAL(activated()), currentView,SLOT(configDialog())); 207 disconnect(utilSettings,SIGNAL(activated()), currentView,SLOT(configDialog()));
208 } 208 }
209 209
210 currentView=(KTextEditor::View*)view; 210 currentView=(KTextEditor::View*)view;
211 211
212 connect(editCopy,SIGNAL(clicked()),currentView,SLOT(copy())); 212 connect(editCopy,SIGNAL(clicked()),currentView,SLOT(copy()));
213 connect(editCut,SIGNAL(clicked()),currentView,SLOT(cut())); 213 connect(editCut,SIGNAL(clicked()),currentView,SLOT(cut()));
214 connect(editPaste,SIGNAL(clicked()),currentView,SLOT(paste())); 214 connect(editPaste,SIGNAL(clicked()),currentView,SLOT(paste()));
215 connect(editUndo,SIGNAL(clicked()),currentView,SLOT(undo())); 215 connect(editUndo,SIGNAL(clicked()),currentView,SLOT(undo()));
216 connect(editRedo,SIGNAL(clicked()),currentView,SLOT(redo())); 216 connect(editRedo,SIGNAL(clicked()),currentView,SLOT(redo()));
217 connect(viewIncFontSizes,SIGNAL(activated()), currentView,SLOT(slotIncFontSizes())); 217 connect(viewIncFontSizes,SIGNAL(activated()), currentView,SLOT(slotIncFontSizes()));
218 connect(viewDecFontSizes,SIGNAL(activated()), currentView,SLOT(slotDecFontSizes())); 218 connect(viewDecFontSizes,SIGNAL(activated()), currentView,SLOT(slotDecFontSizes()));
219 connect(hlmenu,SIGNAL(activated(int)), currentView,SLOT(setHl(int))); 219 connect(hlmenu,SIGNAL(activated(int)), currentView,SLOT(setHl(int)));
220 connect(utilSettings,SIGNAL(activated()), currentView,SLOT(configDialog())); 220 connect(utilSettings,SIGNAL(activated()), currentView,SLOT(configDialog()));
221 221
222} 222}
223 223
224void TinyKate::slotNew( ) 224void TinyKate::slotNew( )
225{ 225{
226 KateDocument *kd= new KateDocument(false, false, this,0,this); 226 KateDocument *kd= new KateDocument(false, false, this,0,this);
227 KTextEditor::View *kv; 227 KTextEditor::View *kv;
228 tabwidget->addTab(kv=kd->createView(tabwidget,"BLAH"), 228 tabwidget->addTab(kv=kd->createView(tabwidget,"BLAH"),
229 "tinykate/tinykate", 229 "tinykate/tinykate",
230 tr("Unnamed %1").arg(nextUnnamed++)); 230 tr("Unnamed %1").arg(nextUnnamed++));
231 viewCount++; 231 viewCount++;
232} 232}
233 233
234void TinyKate::slotClose( ) 234void TinyKate::slotClose( )
235{ 235{
236 if (currentView==0) return; 236 if (currentView==0) return;
237 KTextEditor::View *dv=currentView; 237 KTextEditor::View *dv=currentView;