summaryrefslogtreecommitdiff
authorpaule <paule>2007-01-13 07:23:35 (UTC)
committer paule <paule>2007-01-13 07:23:35 (UTC)
commit80d1934bbbfaea40ee08cf6be738c6517de9477c (patch) (unidiff)
tree58b8f41630b3ad81422c9b47fd0ef1fc0967a8c0
parentbccf96bb5b516d05df54dbcee8b8402ded815ed4 (diff)
downloadopie-80d1934bbbfaea40ee08cf6be738c6517de9477c.zip
opie-80d1934bbbfaea40ee08cf6be738c6517de9477c.tar.gz
opie-80d1934bbbfaea40ee08cf6be738c6517de9477c.tar.bz2
Delete configuration dialog object on closing
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/tinykate/libkate/view/kateview.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/noncore/apps/tinykate/libkate/view/kateview.cpp b/noncore/apps/tinykate/libkate/view/kateview.cpp
index c5673a5..b9ebb1a 100644
--- a/noncore/apps/tinykate/libkate/view/kateview.cpp
+++ b/noncore/apps/tinykate/libkate/view/kateview.cpp
@@ -2249,193 +2249,194 @@ void KateView::readSessionConfig(KateConfig *config)
2249 cursor.y = config->readNumEntry("CursorY"); 2249 cursor.y = config->readNumEntry("CursorY");
2250 myViewInternal->updateCursor(cursor); 2250 myViewInternal->updateCursor(cursor);
2251 myIconBorder = config->readBoolEntry("IconBorder on"); 2251 myIconBorder = config->readBoolEntry("IconBorder on");
2252 setIconBorder(myIconBorder); 2252 setIconBorder(myIconBorder);
2253} 2253}
2254 2254
2255void KateView::writeSessionConfig(KateConfig *config) 2255void KateView::writeSessionConfig(KateConfig *config)
2256{ 2256{
2257 config->writeEntry("XPos",myViewInternal->xPos); 2257 config->writeEntry("XPos",myViewInternal->xPos);
2258 config->writeEntry("YPos",myViewInternal->yPos); 2258 config->writeEntry("YPos",myViewInternal->yPos);
2259 config->writeEntry("CursorX",myViewInternal->cursor.x); 2259 config->writeEntry("CursorX",myViewInternal->cursor.x);
2260 config->writeEntry("CursorY",myViewInternal->cursor.y); 2260 config->writeEntry("CursorY",myViewInternal->cursor.y);
2261 config->writeEntry("IconBorder on", myIconBorder); 2261 config->writeEntry("IconBorder on", myIconBorder);
2262} 2262}
2263 2263
2264void KateView::configDialog() 2264void KateView::configDialog()
2265{ 2265{
2266 2266
2267#warning fixme 2267#warning fixme
2268 2268
2269#if 1 2269#if 1
2270 KDialogBase *kd = new KDialogBase(KDialogBase::IconList, 2270 KDialogBase *kd = new KDialogBase(KDialogBase::IconList,
2271 i18n("Configure Editor"), 2271 i18n("Configure Editor"),
2272 KDialogBase::Ok | KDialogBase::Cancel | 2272 KDialogBase::Ok | KDialogBase::Cancel |
2273 KDialogBase::Help , 2273 KDialogBase::Help ,
2274 KDialogBase::Ok, this, "tabdialog"); 2274 KDialogBase::Ok, this, "tabdialog");
2275 2275
2276 // color options 2276 // color options
2277 QFrame *page=kd->addPage(i18n("Colors")); 2277 QFrame *page=kd->addPage(i18n("Colors"));
2278 (new QVBoxLayout(page))->setAutoAdd(true); 2278 (new QVBoxLayout(page))->setAutoAdd(true);
2279 ColorConfig *colorConfig = new ColorConfig(page); 2279 ColorConfig *colorConfig = new ColorConfig(page);
2280 QColor* colors = getColors(); 2280 QColor* colors = getColors();
2281 colorConfig->setColors(colors); 2281 colorConfig->setColors(colors);
2282 2282
2283 page = kd->addPage(i18n("Fonts")); 2283 page = kd->addPage(i18n("Fonts"));
2284 (new QVBoxLayout(page))->setAutoAdd(true); 2284 (new QVBoxLayout(page))->setAutoAdd(true);
2285 2285
2286 FontConfig *fontConfig = new FontConfig(page); 2286 FontConfig *fontConfig = new FontConfig(page);
2287 fontConfig->setFont (myDoc->getFont()); 2287 fontConfig->setFont (myDoc->getFont());
2288 2288
2289 // indent options 2289 // indent options
2290 page=kd->addPage(i18n("Indent")); 2290 page=kd->addPage(i18n("Indent"));
2291 (new QVBoxLayout(page))->setAutoAdd(true); 2291 (new QVBoxLayout(page))->setAutoAdd(true);
2292 2292
2293 IndentConfigTab *indentConfig = new IndentConfigTab(page, this); 2293 IndentConfigTab *indentConfig = new IndentConfigTab(page, this);
2294 2294
2295 // select options 2295 // select options
2296 page=kd->addPage(i18n("Select")); 2296 page=kd->addPage(i18n("Select"));
2297 (new QVBoxLayout(page))->setAutoAdd(true); 2297 (new QVBoxLayout(page))->setAutoAdd(true);
2298 2298
2299 SelectConfigTab *selectConfig = new SelectConfigTab(page, this); 2299 SelectConfigTab *selectConfig = new SelectConfigTab(page, this);
2300 2300
2301 // edit options 2301 // edit options
2302 page=kd->addPage(i18n("Edit")); 2302 page=kd->addPage(i18n("Edit"));
2303 (new QVBoxLayout(page))->setAutoAdd(true); 2303 (new QVBoxLayout(page))->setAutoAdd(true);
2304 2304
2305 EditConfigTab *editConfig = new EditConfigTab(page, this); 2305 EditConfigTab *editConfig = new EditConfigTab(page, this);
2306 2306
2307 2307
2308 2308
2309 HighlightDialogPage *hlPage; 2309 HighlightDialogPage *hlPage;
2310 HlManager *hlManager; 2310 HlManager *hlManager;
2311 HlDataList hlDataList; 2311 HlDataList hlDataList;
2312 ItemStyleList defaultStyleList; 2312 ItemStyleList defaultStyleList;
2313 2313
2314 hlManager = HlManager::self(); 2314 hlManager = HlManager::self();
2315 2315
2316 defaultStyleList.setAutoDelete(true); 2316 defaultStyleList.setAutoDelete(true);
2317 hlManager->getDefaults(defaultStyleList); 2317 hlManager->getDefaults(defaultStyleList);
2318 2318
2319 hlDataList.setAutoDelete(true); 2319 hlDataList.setAutoDelete(true);
2320 //this gets the data from the KateConfig object 2320 //this gets the data from the KateConfig object
2321 hlManager->getHlDataList(hlDataList); 2321 hlManager->getHlDataList(hlDataList);
2322 2322
2323 page=kd->addPage(i18n("Highlighting")); 2323 page=kd->addPage(i18n("Highlighting"));
2324 (new QVBoxLayout(page))->setAutoAdd(true); 2324 (new QVBoxLayout(page))->setAutoAdd(true);
2325 2325
2326 hlPage = new HighlightDialogPage(hlManager, &defaultStyleList, &hlDataList, 0, page); 2326 hlPage = new HighlightDialogPage(hlManager, &defaultStyleList, &hlDataList, 0, page);
2327 if ( QPEApplication::execDialog( kd )) { 2327 if ( QPEApplication::execDialog( kd )) {
2328 // color options 2328 // color options
2329 colorConfig->getColors(colors); 2329 colorConfig->getColors(colors);
2330 myDoc->setFont (fontConfig->getFont()); 2330 myDoc->setFont (fontConfig->getFont());
2331 2331
2332 applyColors(); 2332 applyColors();
2333 // indent options 2333 // indent options
2334 indentConfig->getData(this); 2334 indentConfig->getData(this);
2335 // select options 2335 // select options
2336 selectConfig->getData(this); 2336 selectConfig->getData(this);
2337 // edit options 2337 // edit options
2338 editConfig->getData(this); 2338 editConfig->getData(this);
2339 // spell checker 2339 // spell checker
2340 hlManager->setHlDataList(hlDataList); 2340 hlManager->setHlDataList(hlDataList);
2341 hlManager->setDefaults(defaultStyleList); 2341 hlManager->setDefaults(defaultStyleList);
2342 hlPage->saveData(); 2342 hlPage->saveData();
2343 } 2343 }
2344 2344
2345// delete kd; 2345 qApp->processEvents();
2346 delete kd;
2346 2347
2347#endif 2348#endif
2348} 2349}
2349 2350
2350int KateView::getHl() { 2351int KateView::getHl() {
2351 return myDoc->highlightNum(); 2352 return myDoc->highlightNum();
2352} 2353}
2353 2354
2354void KateView::setDontChangeHlOnSave() 2355void KateView::setDontChangeHlOnSave()
2355{ 2356{
2356 myDoc->setDontChangeHlOnSave(); 2357 myDoc->setDontChangeHlOnSave();
2357} 2358}
2358 2359
2359void KateView::setHl(int n) { 2360void KateView::setHl(int n) {
2360 myDoc->setHighlight(n); 2361 myDoc->setHighlight(n);
2361 myDoc->setDontChangeHlOnSave(); 2362 myDoc->setDontChangeHlOnSave();
2362 myDoc->updateViews(); 2363 myDoc->updateViews();
2363} 2364}
2364 2365
2365int KateView::getEol() { 2366int KateView::getEol() {
2366 return myDoc->eolMode; 2367 return myDoc->eolMode;
2367} 2368}
2368 2369
2369void KateView::setEol(int eol) { 2370void KateView::setEol(int eol) {
2370 if (isReadOnly()) 2371 if (isReadOnly())
2371 return; 2372 return;
2372 2373
2373 myDoc->eolMode = eol; 2374 myDoc->eolMode = eol;
2374 myDoc->setModified(true); 2375 myDoc->setModified(true);
2375} 2376}
2376 2377
2377 2378
2378 2379
2379void KateView::paintEvent(QPaintEvent *e) { 2380void KateView::paintEvent(QPaintEvent *e) {
2380 int x, y; 2381 int x, y;
2381 2382
2382 QRect updateR = e->rect(); // update rectangle 2383 QRect updateR = e->rect(); // update rectangle
2383// debug("Update rect = ( %i, %i, %i, %i )", 2384// debug("Update rect = ( %i, %i, %i, %i )",
2384// updateR.x(),updateR.y(), updateR.width(), updateR.height() ); 2385// updateR.x(),updateR.y(), updateR.width(), updateR.height() );
2385 2386
2386 int ux1 = updateR.x(); 2387 int ux1 = updateR.x();
2387 int uy1 = updateR.y(); 2388 int uy1 = updateR.y();
2388 int ux2 = ux1 + updateR.width(); 2389 int ux2 = ux1 + updateR.width();
2389 int uy2 = uy1 + updateR.height(); 2390 int uy2 = uy1 + updateR.height();
2390 2391
2391 QPainter paint; 2392 QPainter paint;
2392 paint.begin(this); 2393 paint.begin(this);
2393 2394
2394 QColorGroup g = colorGroup(); 2395 QColorGroup g = colorGroup();
2395 x = width(); 2396 x = width();
2396 y = height(); 2397 y = height();
2397 2398
2398 paint.setPen(g.dark()); 2399 paint.setPen(g.dark());
2399 if (uy1 <= 0) paint.drawLine(0,0,x-2,0); 2400 if (uy1 <= 0) paint.drawLine(0,0,x-2,0);
2400 if (ux1 <= 0) paint.drawLine(0,1,0,y-2); 2401 if (ux1 <= 0) paint.drawLine(0,1,0,y-2);
2401 2402
2402 paint.setPen(black); 2403 paint.setPen(black);
2403 if (uy1 <= 1) paint.drawLine(1,1,x-3,1); 2404 if (uy1 <= 1) paint.drawLine(1,1,x-3,1);
2404 if (ux1 <= 1) paint.drawLine(1,2,1,y-3); 2405 if (ux1 <= 1) paint.drawLine(1,2,1,y-3);
2405 2406
2406 paint.setPen(g.midlight()); 2407 paint.setPen(g.midlight());
2407 if (uy2 >= y-1) paint.drawLine(1,y-2,x-3,y-2); 2408 if (uy2 >= y-1) paint.drawLine(1,y-2,x-3,y-2);
2408 if (ux2 >= x-1) paint.drawLine(x-2,1,x-2,y-2); 2409 if (ux2 >= x-1) paint.drawLine(x-2,1,x-2,y-2);
2409 2410
2410 paint.setPen(g.light()); 2411 paint.setPen(g.light());
2411 if (uy2 >= y) paint.drawLine(0,y-1,x-2,y-1); 2412 if (uy2 >= y) paint.drawLine(0,y-1,x-2,y-1);
2412 if (ux2 >= x) paint.drawLine(x-1,0,x-1,y-1); 2413 if (ux2 >= x) paint.drawLine(x-1,0,x-1,y-1);
2413 2414
2414 x -= 2 + 16; 2415 x -= 2 + 16;
2415 y -= 2 + 16; 2416 y -= 2 + 16;
2416 if (ux2 > x && uy2 > y) { 2417 if (ux2 > x && uy2 > y) {
2417 paint.fillRect(x,y,16,16,g.background()); 2418 paint.fillRect(x,y,16,16,g.background());
2418 } 2419 }
2419 paint.end(); 2420 paint.end();
2420} 2421}
2421 2422
2422void KateView::resizeEvent(QResizeEvent *) { 2423void KateView::resizeEvent(QResizeEvent *) {
2423 2424
2424// debug("Resize %d, %d",e->size().width(),e->size().height()); 2425// debug("Resize %d, %d",e->size().width(),e->size().height());
2425 2426
2426//myViewInternal->resize(width() -20, height() -20); 2427//myViewInternal->resize(width() -20, height() -20);
2427 myViewInternal->tagAll(); 2428 myViewInternal->tagAll();
2428 myViewInternal->updateView(0/*ufNoScroll*/); 2429 myViewInternal->updateView(0/*ufNoScroll*/);
2429} 2430}
2430 2431
2431 2432
2432// Applies a new pattern to the search context. 2433// Applies a new pattern to the search context.
2433void SConfig::setPattern(QString &newPattern) { 2434void SConfig::setPattern(QString &newPattern) {
2434 bool regExp = (flags & KateView::sfRegularExpression); 2435 bool regExp = (flags & KateView::sfRegularExpression);
2435 2436
2436 m_pattern = newPattern; 2437 m_pattern = newPattern;
2437 if (regExp) { 2438 if (regExp) {
2438 m_regExp.setCaseSensitive(flags & KateView::sfCaseSensitive); 2439 m_regExp.setCaseSensitive(flags & KateView::sfCaseSensitive);
2439 m_regExp.setPattern(m_pattern); 2440 m_regExp.setPattern(m_pattern);
2440 } 2441 }
2441} 2442}