diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 4aed2c8219774f5d797760606b8489a92ddc5163 (patch) | |
tree | 3f8c130f7d269626bf6a9447407ef6c35954426a /kcontrol/konsole | |
download | tdebase-4aed2c8219774f5d797760606b8489a92ddc5163.tar.gz tdebase-4aed2c8219774f5d797760606b8489a92ddc5163.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kcontrol/konsole')
-rw-r--r-- | kcontrol/konsole/AUTHORS | 2 | ||||
-rw-r--r-- | kcontrol/konsole/Makefile.am | 18 | ||||
-rw-r--r-- | kcontrol/konsole/kcmkonsole.cpp | 191 | ||||
-rw-r--r-- | kcontrol/konsole/kcmkonsole.desktop | 185 | ||||
-rw-r--r-- | kcontrol/konsole/kcmkonsole.h | 46 | ||||
-rw-r--r-- | kcontrol/konsole/kcmkonsoledialog.ui | 390 | ||||
-rw-r--r-- | kcontrol/konsole/schemadialog.ui | 631 | ||||
-rw-r--r-- | kcontrol/konsole/schemaeditor.cpp | 708 | ||||
-rw-r--r-- | kcontrol/konsole/schemaeditor.h | 84 | ||||
-rw-r--r-- | kcontrol/konsole/sessiondialog.ui | 446 | ||||
-rw-r--r-- | kcontrol/konsole/sessioneditor.cpp | 383 | ||||
-rw-r--r-- | kcontrol/konsole/sessioneditor.h | 68 |
12 files changed, 3152 insertions, 0 deletions
diff --git a/kcontrol/konsole/AUTHORS b/kcontrol/konsole/AUTHORS new file mode 100644 index 000000000..a515139f9 --- /dev/null +++ b/kcontrol/konsole/AUTHORS @@ -0,0 +1,2 @@ +Andrea Rizzi <rizzi@kde.org> April 2001 +Stephan Binner <stephan.binner@gmx.de> October 2001 diff --git a/kcontrol/konsole/Makefile.am b/kcontrol/konsole/Makefile.am new file mode 100644 index 000000000..622e7fa71 --- /dev/null +++ b/kcontrol/konsole/Makefile.am @@ -0,0 +1,18 @@ +kde_module_LTLIBRARIES = kcm_konsole.la + +kcm_konsole_la_SOURCES = schemaeditor.cpp sessioneditor.cpp kcmkonsole.cpp \ + schemadialog.ui sessiondialog.ui kcmkonsoledialog.ui + +kcm_konsole_la_LDFLAGS = $(all_libraries) -module -avoid-version -no-undefined +kcm_konsole_la_LIBADD = -lkdeui $(LIB_KIO) +AM_CPPFLAGS = $(all_includes) + +METASOURCES = AUTO + +noinst_HEADERS = kcmkonsole.h schemaeditor.h sessioneditor.h schemadialog.h sessiondialog.h kcmkonsoledialog.h + +kcmkonsole_data_DATA = kcmkonsole.desktop +kcmkonsole_datadir = $(kde_appsdir)/.hidden + +messages: rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/kcmkonsole.pot diff --git a/kcontrol/konsole/kcmkonsole.cpp b/kcontrol/konsole/kcmkonsole.cpp new file mode 100644 index 000000000..19b547366 --- /dev/null +++ b/kcontrol/konsole/kcmkonsole.cpp @@ -0,0 +1,191 @@ +/*************************************************************************** + kcmkonsole.cpp - control module for konsole + ------------------- + begin : mar apr 17 16:44:59 CEST 2001 + copyright : (C) 2001 by Andrea Rizzi + email : rizzi@kde.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include <qcheckbox.h> +#include <qlayout.h> +#include <qstringlist.h> +#include <qtabwidget.h> + +#include <dcopclient.h> + +#include <kaboutdata.h> +#include <kconfig.h> +#include <kdebug.h> +#include <kfontdialog.h> +#include <kgenericfactory.h> +#include <kmessagebox.h> + +#include "schemaeditor.h" +#include "sessioneditor.h" +#include "kcmkonsole.h" + +typedef KGenericFactory<KCMKonsole, QWidget> ModuleFactory; +K_EXPORT_COMPONENT_FACTORY( kcm_konsole, ModuleFactory("kcmkonsole") ) + +KCMKonsole::KCMKonsole(QWidget * parent, const char *name, const QStringList&) +:KCModule(ModuleFactory::instance(), parent, name) +{ + + setQuickHelp( i18n("<h1>Konsole</h1> With this module you can configure Konsole, the KDE terminal" + " application. You can configure the generic Konsole options (which can also be " + "configured using the RMB) and you can edit the schemas and sessions " + "available to Konsole.")); + + QVBoxLayout *topLayout = new QVBoxLayout(this); + dialog = new KCMKonsoleDialog(this); + dialog->line_spacingSB->setRange(0, 8, 1, false); + dialog->line_spacingSB->setSpecialValueText(i18n("normal line spacing", "Normal")); + dialog->show(); + topLayout->add(dialog); + load(); + + KAboutData *ab=new KAboutData( "kcmkonsole", I18N_NOOP("KCM Konsole"), + "0.2",I18N_NOOP("KControl module for Konsole configuration"), KAboutData::License_GPL, + "(c) 2001, Andrea Rizzi", 0, 0, "rizzi@kde.org"); + + ab->addAuthor("Andrea Rizzi",0, "rizzi@kde.org"); + setAboutData( ab ); + + connect(dialog->terminalSizeHintCB,SIGNAL(toggled(bool)), SLOT( changed() )); + connect(dialog->warnCB,SIGNAL(toggled(bool)), SLOT( changed() )); + connect(dialog->ctrldragCB,SIGNAL(toggled(bool)), SLOT( changed() )); + connect(dialog->cutToBeginningOfLineCB,SIGNAL(toggled(bool)), SLOT( changed() )); + connect(dialog->allowResizeCB,SIGNAL(toggled(bool)), SLOT( changed() )); + connect(dialog->bidiCB,SIGNAL(toggled(bool)), SLOT( changed() )); + connect(dialog->xonXoffCB,SIGNAL(toggled(bool)), SLOT( changed() )); + connect(dialog->blinkingCB,SIGNAL(toggled(bool)), SLOT( changed() )); + connect(dialog->frameCB,SIGNAL(toggled(bool)), SLOT( changed() )); + connect(dialog->line_spacingSB,SIGNAL(valueChanged(int)), SLOT( changed() )); + connect(dialog->matchTabWinTitleCB,SIGNAL(toggled(bool)), SLOT( changed() )); + connect(dialog->silence_secondsSB,SIGNAL(valueChanged(int)), SLOT( changed() )); + connect(dialog->word_connectorLE,SIGNAL(textChanged(const QString &)), SLOT( changed() )); + connect(dialog->SchemaEditor1, SIGNAL(changed()), SLOT( changed() )); + connect(dialog->SessionEditor1, SIGNAL(changed()), SLOT( changed() )); + connect(dialog->SchemaEditor1, SIGNAL(schemaListChanged(const QStringList &,const QStringList &)), + dialog->SessionEditor1, SLOT(schemaListChanged(const QStringList &,const QStringList &))); + connect(dialog->SessionEditor1, SIGNAL(getList()), dialog->SchemaEditor1, SLOT(getList())); +} + +void KCMKonsole::load() +{ + load(false); +} + +void KCMKonsole::load(bool useDefaults) +{ + KConfig config("konsolerc", true); + config.setDesktopGroup(); + config.setReadDefaults(useDefaults); + + dialog->terminalSizeHintCB->setChecked(config.readBoolEntry("TerminalSizeHint",false)); + bidiOrig = config.readBoolEntry("EnableBidi",false); + dialog->bidiCB->setChecked(bidiOrig); + dialog->matchTabWinTitleCB->setChecked(config.readBoolEntry("MatchTabWinTitle",false)); + dialog->warnCB->setChecked(config.readBoolEntry("WarnQuit",true)); + dialog->ctrldragCB->setChecked(config.readBoolEntry("CtrlDrag",true)); + dialog->cutToBeginningOfLineCB->setChecked(config.readBoolEntry("CutToBeginningOfLine",false)); + dialog->allowResizeCB->setChecked(config.readBoolEntry("AllowResize",false)); + xonXoffOrig = config.readBoolEntry("XonXoff",false); + dialog->xonXoffCB->setChecked(xonXoffOrig); + dialog->blinkingCB->setChecked(config.readBoolEntry("BlinkingCursor",false)); + dialog->frameCB->setChecked(config.readBoolEntry("has frame",true)); + dialog->line_spacingSB->setValue(config.readUnsignedNumEntry( "LineSpacing", 0 )); + dialog->silence_secondsSB->setValue(config.readUnsignedNumEntry( "SilenceSeconds", 10 )); + dialog->word_connectorLE->setText(config.readEntry("wordseps",":@-./_~")); + + dialog->SchemaEditor1->setSchema(config.readEntry("schema")); + + emit changed(useDefaults); +} + +void KCMKonsole::save() +{ + if (dialog->SchemaEditor1->isModified()) + { + dialog->TabWidget2->showPage(dialog->tab_2); + dialog->SchemaEditor1->querySave(); + } + + if (dialog->SessionEditor1->isModified()) + { + dialog->TabWidget2->showPage(dialog->tab_3); + dialog->SessionEditor1->querySave(); + } + + KConfig config("konsolerc"); + config.setDesktopGroup(); + + config.writeEntry("TerminalSizeHint", dialog->terminalSizeHintCB->isChecked()); + bool bidiNew = dialog->bidiCB->isChecked(); + config.writeEntry("EnableBidi", bidiNew); + config.writeEntry("MatchTabWinTitle", dialog->matchTabWinTitleCB->isChecked()); + config.writeEntry("WarnQuit", dialog->warnCB->isChecked()); + config.writeEntry("CtrlDrag", dialog->ctrldragCB->isChecked()); + config.writeEntry("CutToBeginningOfLine", dialog->cutToBeginningOfLineCB->isChecked()); + config.writeEntry("AllowResize", dialog->allowResizeCB->isChecked()); + bool xonXoffNew = dialog->xonXoffCB->isChecked(); + config.writeEntry("XonXoff", xonXoffNew); + config.writeEntry("BlinkingCursor", dialog->blinkingCB->isChecked()); + config.writeEntry("has frame", dialog->frameCB->isChecked()); + config.writeEntry("LineSpacing" , dialog->line_spacingSB->value()); + config.writeEntry("SilenceSeconds" , dialog->silence_secondsSB->value()); + config.writeEntry("wordseps", dialog->word_connectorLE->text()); + + config.writeEntry("schema", dialog->SchemaEditor1->schema()); + + config.sync(); + + emit changed(false); + + DCOPClient *dcc = kapp->dcopClient(); + dcc->send("konsole-*", "konsole", "reparseConfiguration()", QByteArray()); + dcc->send("kdesktop", "default", "configure()", QByteArray()); + dcc->send("klauncher", "klauncher", "reparseConfiguration()", QByteArray()); + + if (xonXoffOrig != xonXoffNew) + { + xonXoffOrig = xonXoffNew; + KMessageBox::information(this, i18n("The Ctrl+S/Ctrl+Q flow control setting will only affect " + "newly started Konsole sessions.\n" + "The 'stty' command can be used to change the flow control " + "settings of existing Konsole sessions.")); + } + + if (bidiNew && !bidiOrig) + { + KMessageBox::information(this, i18n("You have chosen to enable " + "bidirectional text rendering by " + "default.\n" + "Note that bidirectional text may " + "not always be shown correctly, " + "especially when selecting parts of " + "text written right-to-left. This " + "is a known issue which cannot be " + "resolved at the moment due to the " + "nature of text handling in " + "console-based applications.")); + } + bidiOrig = bidiNew; + +} + +void KCMKonsole::defaults() +{ + load(true); +} + +#include "kcmkonsole.moc" diff --git a/kcontrol/konsole/kcmkonsole.desktop b/kcontrol/konsole/kcmkonsole.desktop new file mode 100644 index 000000000..8aa6aecf1 --- /dev/null +++ b/kcontrol/konsole/kcmkonsole.desktop @@ -0,0 +1,185 @@ +[Desktop Entry] +Icon=konsole +Type=Application +Exec=kcmshell kcmkonsole +DocPath=kcontrol/kcmkonsole/index.html + +X-KDE-Library=konsole +X-KDE-ParentApp=kcontrol +Name=Konsole +Name[ar]=طرفية التحكم +Name[az]=Konsol +Name[be]=Кансоль +Name[bg]=Конзола +Name[bn]=কনসোল +Name[bs]=Konzola +Name[ca]=Consola +Name[csb]=Kònsola +Name[el]=Κονσόλα +Name[eo]=Konzolo +Name[et]=Konsool +Name[eu]=Kontsola +Name[he]=מסוף +Name[hi]=कंसोल +Name[hr]=Konzola +Name[is]=Skjáhermir +Name[ka]=კონსოლი +Name[lo]=ຄອນໂຊລ - K +Name[mk]=Конзола +Name[mn]=Консол +Name[nb]=Konsoll +Name[ne]=कन्सोल +Name[nn]=Konsoll +Name[pa]=ਕੰਨਸੋਲ +Name[pl]=Konsola +Name[ro]=Consolă +Name[se]=Konsolla +Name[sk]=Konzola +Name[sl]=Konzola +Name[ta]=கான்சோல் +Name[te]=కాన్సోల్ +Name[tg]=Консол +Name[th]=คอนโซล K +Name[zu]=Ikhonsoli +Comment=Konsole configuration module +Comment[af]=Konsole opstelling module +Comment[ar]=وحدة إعداد طرفية التحكم +Comment[az]=Konsol quraşdırma modulu +Comment[be]=Модуль настаўлення кансолі +Comment[bg]=Настройване на конзолата +Comment[bn]=কনসোল কনফিগারেশন মডিউল +Comment[br]=Mollad kefluniadur Konsole +Comment[bs]=Modul sa podešavanje konzole +Comment[ca]=Mòdul de configuració de la consola +Comment[cs]=Konfigurační modul terminálu konsole +Comment[csb]=Mòduł kònfigùracëji kònsolë +Comment[cy]=Modiwl ffurfweddu Konsole +Comment[da]=Konsole-indstillingsmodul +Comment[de]=Modul zur Einrichtung von Konsole +Comment[el]=Άρθρωμα ρύθμισης Κονσόλας +Comment[eo]=Agordo de Konzolo +Comment[es]=Módulo de configuración de Konsole +Comment[et]=Terminaliemulaatori seadistamine +Comment[eu]=Kontsola konfiguratzeko modulua +Comment[fa]=پیمانۀ پیکربندی Konsole +Comment[fi]=Konsolen asetukset +Comment[fr]=Configuration de Konsole +Comment[fy]=Konsole-ynstellingsmodule +Comment[ga]=Modúl Cumraíochta Konsole +Comment[gl]=Módulo de configuración de Konsole +Comment[he]=שינוי הגדרות המסוף +Comment[hi]=कंसोल कॉन्फ़िगरेशन मोड +Comment[hr]=Modul za konfiguriranje konzole +Comment[hu]=A Konsole parancsértelmező beállításai +Comment[is]=Skjáhermisstillingar +Comment[it]=Modulo di configurazione di Konsole +Comment[ja]=Konsole の設定モジュール +Comment[ka]=კონსოლის კონფიგურაციის მოდული +Comment[kk]=Konsole модулін баптау +Comment[km]=ម៉ូឌុលកំណត់រចនាសម្ព័ន្ធ Konsole +Comment[lo]=ໂມດູນປັບແຕ່ງຄອນໂຊນ - K +Comment[lt]=Konsole konfigūravimo įrankis +Comment[lv]=Konsoles konfigurācijas modulis +Comment[mk]=Модул за конфигурација на конзолата +Comment[mn]=Консол тохируулгын модул +Comment[ms]=Konsol modul konfigurasi +Comment[mt]=Konfigurazzjoni ta' Konsole +Comment[nb]=Verktøy for å tilpasse Konsole +Comment[nds]=Moduul för't Instellen vun Konsole +Comment[ne]=कन्सोल कन्फिगरेसन मोड्युल +Comment[nl]=Konsole-configuratiemodule +Comment[nn]=Oppsettmodul for Konsole +Comment[nso]=Seripa sa peakanyo ya konsole +Comment[pa]=ਕੰਨਸੋਲ ਸੰਰਚਨਾ ਮੈਡੀਊਲ +Comment[pl]=Moduł konfiguracji konsoli +Comment[pt]=Módulo de configuração do Konsole +Comment[pt_BR]=Módulo de configuração do Konsole +Comment[ro]=Modul de configurare Konsole +Comment[ru]=Модуль настройки Konsole +Comment[rw]=Igice cy'iboneza rya Konsole +Comment[se]=Konsole:a heivehanmoduvla +Comment[sk]=Konfiguračný modul konzole +Comment[sl]=Modul za nastavitve konzole +Comment[sr]=Модул за подешавање Konsole +Comment[sr@Latn]=Modul za podešavanje Konsole +Comment[sv]=Anpassa Konsole +Comment[ta]=கான்சோல் வடிவமைப்பு பகுதி +Comment[tg]=Модули танзимоти Konsole +Comment[th]=โมดูลปรับแต่งคอนโซล K +Comment[tr]=Konsole Yapılandırma modülü +Comment[tt]=Konsol caylaw modulı +Comment[uk]=Засіб конфігурації модуля Konsole +Comment[uz]=Terminalni moslash moduli +Comment[uz@cyrillic]=Терминални мослаш модули +Comment[ven]=Modulu wa nzudzanyo wa Konsole +Comment[vi]=Cấu hình Konsole +Comment[wa]=Module d' apontiaedje do terminå di KDE Konsole +Comment[xh]=Umnqongo woqwalaselo we Konsole +Comment[zh_CN]=Konsole 配置模块 +Comment[zh_TW]=Konsole 組態模組 +Comment[zu]=Ingxenye yokuhlanganisela ikhonsoli +Keywords=konsole,schema,konsole background,colors,background,terminal application,terminal +Keywords[az]=konsol,sxem,konsol arxa planı,rənglər,arxa plan,terminal proqramı,terminal +Keywords[be]=Кансоль,Схема,Фон кансолі,Колеры,Фон,Тэрмінальная праграма,Тэрмінал,Эмулятар тэрміналу,konsole,schema,konsole background,colors,background,terminal application,terminal +Keywords[bg]=конзола, терминал, konsole, schema, konsole background, colors, background, terminal application, terminal +Keywords[ca]=consola,esquema,fons de la consola,colors,fons,aplicació de terminal,terminal +Keywords[cs]=konsole,schéma,pozadí konsole,barvy,pozadí,terminálová aplikace,terminál +Keywords[csb]=kònsola,schemat,spòdlé kònsolë,farwë,spòdlé,programa terminala,terminal +Keywords[cy]=konsole,sgema,cefndir konsole,lliwiau,cefndir,cymhwysiadau terfynell,terfynell +Keywords[da]=konsole,sammensætning,konsole-baggrund,farver,baggrund,terminalprogram,terminal +Keywords[de]=Konsole,Farbschema,Hintergrund,Farben,Terminal +Keywords[el]=κονσόλα,σχήμα,φόντο κονσόλας,χρώματα,φόντο,εφαρμογή τερματικού,τερματικό +Keywords[en_GB]=konsole,schema,konsole background,colours,background,terminal application,terminal +Keywords[eo]=Konzolo,koloraro,fono,koloro,konzolofono,terminaaplikaĵo,terminalo +Keywords[es]=konsole,esquema,fondo de konsole,colores,fondo,aplicación de terminal,terminal +Keywords[et]=konsool,skeem,konsooli taust,värvid,taust,terminal,terminaliemulaator +Keywords[eu]=konsole,eskema,kontsolaren atzeko planoa,koloreak,atzeko planoa,terminal aplikazioa,terminala +Keywords[fa]=konsole، طرحواره، زمینه konsole، رنگها، زمینه، کاربرد پایانه، پایانه +Keywords[fi]=konsole,teema,konsolen tausta,värit,tausta,pääteohjelma,pääte,komento,komentikkuna +Keywords[fr]=konsole,modèle,fond,couleurs,terminal +Keywords[fy]=konsole,skema,konsole eftergrûn,colors,kleuren,background,eftergrûn,terminal applikaasje,terminal +Keywords[ga]=konsole,scéimre,cúlra konsole,dathanna,cúlra,clár teirminéil,teirminéal +Keywords[gl]=konsole,esquema,fondo de konsole,cores,fondo,aplicación de terminal,terminal +Keywords[he]=מסוף,יישום מסוף,רקע,צבעים,רקע המסוף,תבנית, konsole,schema,konsole background,colors,background,terminal application,terminal +Keywords[hi]=कंसोल,योजना,कंसोल पृष्ठभूमि,रंग,पृष्ठ भूमि,टर्मिनल अनुप्रयोग,टर्मिनल +Keywords[hr]=konsole,schema,konsole background,colors,background,terminal application,terminal,konzola,shema,pozadina konzole,boje,pozadina,terminalska aplikacija +Keywords[hu]=Konsole,kinézet,terminál-háttér,színek,háttér,terminálalkalmazás,terminál +Keywords[is]=konsole,skjáhermir,skjáhermissbakgrunnur,litir,bakgrunnur,terminal application,terminal +Keywords[it]=konsole,schema,sfondo di konsole,colori,sfondo,terminale,shell +Keywords[ja]=konsole,schema,konsole 背景,色,背景,ターミナルアプリケーション,ターミナル +Keywords[km]=កុងសូល,គ្រោងការណ៍,ផ្ទៃខាងក្រោយកុងសូល,ពណ៌,ផ្ទៃខាងក្រោយ,កម្មវិធីស្ថានីយ,ស្ថានីយ +Keywords[lt]=konsole,schema,konsole background,colors,background,terminal application,terminal, konsolė, schema, konsolės fono spalva, spalvos, fono spalva, terminalinė programa, terminalas +Keywords[lv]=konsole,shēma,konsoles fons,krāsas,fons,termināla aplikācija,termināls +Keywords[mk]=konsole,schema,konsole background,colors,background,terminal application,terminal,конзола,шема,подлога на конзола,позадина на конзола,бои,подлога,позадина,терминалска апликација,терминал +Keywords[mn]=Консол,Өнгөний схем,Дэвсгэр,Өнгө,Терминал +Keywords[mt]=konsole,schema,konsole background,colors,background,terminal application,terminal,skema,sfond,kuluri,emulatur +Keywords[nb]=konsole,oppsett,konsoll,konsollbakgrunn,farger,bakgrunn,terminal +Keywords[nds]=Konsole,Muster,Klören,Achtergrund,Terminalprogramm,Terminal +Keywords[ne]=कन्सोल, स्कीमा, कन्सोल पृष्ठभूमि, रङहरू, पृष्ठभूमि, टर्मिनल अनुप्रयोग, टर्मिनल +Keywords[nn]=konsoll,oppsett,konsollbakgrunn,fargar,bakgrunn,terminal +Keywords[nso]=konsole,schema,bokamorago bja konsole,mebala,bokamorago,tshomiso ya terminal,terminal +Keywords[pa]=konsole,schema,konsole background,colors,background,terminal application,terminal,ਕੰਨਸੋਲ,ਸਕੀਮ,ਰੰਗ,ਟਰਮੀਨਲ +Keywords[pl]=konsola,schemat,tło konsoli,kolory,tło,program terminala,terminal +Keywords[pt]=konsole,esquema,fundo do konsole,cores,fundo,aplicação de terminal,terminal +Keywords[pt_BR]=konsole,esquema,fundo do konsole,cores,segundo plano,aplicativo de terminal, terminal +Keywords[ro]=consolă,konsole,schemă,fundal,terminal,aplicație terminal +Keywords[rw]=Konsole,igishushanyombonera ,mbuganyuma ya konsole,amabara , mbuganyuma ,Porogaramu Igihera, Igihera +Keywords[se]=konsolla,heivehus,konsolladuogás,ivnnit,duogáš,terminála +Keywords[sk]=konsole,schéma,pozadie konzole,konzola,farby,pozadie,terminálová aplikácia,terminál +Keywords[sl]=konsola,shema,ozadje konzole,barve,ozadje,terminalski program,terminal +Keywords[sr]=konsole,schema,konsole background,colors,background,terminal application,terminal,терминал,боје,позадина,шема +Keywords[sr@Latn]=konsole,schema,konsole background,colors,background,terminal application,terminal,terminal,boje,pozadina,šema +Keywords[sv]=konsole,konsoll,schema,konsol bakgrund,färger,bakgrund,terminalprogram,terminal +Keywords[ta]=கான்சோல்,அமைப்பு,கான்சோல் பின்ன்ணி,வண்ணங்கள்,பின்ன்ணி,கடைசி பயன்பாடு,கடைசி +Keywords[th]=คอนโซล K,ชุดรูปแบบ,พื้นหลังคอนโซล,สี,พื้นหลัง,แอพพลิเคชันเทอร์มินัล,เทอร์มินัล +Keywords[tr]=konsol,şema,konsol arkaplanı,renkler,arkaplan,terminal,konsole +Keywords[uk]=konsole,схема,тло konsole,кольори,тло,програма терміналу,термінал +Keywords[uz]=terminalning orqa foni,ranglar,orqa fon,terminal dasturi,terminal +Keywords[uz@cyrillic]=терминалнинг орқа фони,ранглар,орқа фон,терминал дастури,терминал +Keywords[ven]=konsole,tshikimu,vhuvha ha konsole,mivhala ya konsole,theminala,apulifikhesheni ya theminala,theminala +Keywords[vi]=konsole,schema,ảnh nền của konsole,màu,nền,trình đầu cuối,thiết bị cuối +Keywords[wa]=konsole,arindjmint,fond del konsole,coleurs,fond,prgrame terminå,terminå +Keywords[xh]=konsole,schema,imvelaphi ye konsole,imibala,imvelaphi,isicelo sesiphelo sendlela,isiphelo sendlela +Keywords[zh_CN]=konsole,schema,konsole background,colors,background,terminal application,terminal,颜色,背景色,终端程序,终端 +Keywords[zh_TW]=konsole,schema,konsole background,colors,background,terminal application,terminal,配色,konsole 背景,顏色,背景,終端機應用程式,終端機 +Keywords[zu]=konsole,iplani,inkundla yekhonsoli,imibala,inkundla, umyaleli wangaphandle,ithuluzi langaphandle diff --git a/kcontrol/konsole/kcmkonsole.h b/kcontrol/konsole/kcmkonsole.h new file mode 100644 index 000000000..ae6ee069b --- /dev/null +++ b/kcontrol/konsole/kcmkonsole.h @@ -0,0 +1,46 @@ +/*************************************************************************** + kcmkonsole.h + ------------------- + begin : mar apr 17 16:44:59 CEST 2001 + copyright : (C) 2001 by Andrea Rizzi + email : rizzi@kde.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef KCMKONSOLE_H +#define KCMKONSOLE_H + +#include <kcmodule.h> + +#include "kcmkonsoledialog.h" + +class QFont; +class QStringList; + +class KCMKonsole + : public KCModule +{ + Q_OBJECT + +public: + KCMKonsole (QWidget *parent = 0, const char *name = 0, const QStringList& = 0); + + void load(); + void load(bool useDefaults); + void save(); + void defaults(); +private: + KCMKonsoleDialog *dialog; + bool xonXoffOrig; + bool bidiOrig; +}; + +#endif diff --git a/kcontrol/konsole/kcmkonsoledialog.ui b/kcontrol/konsole/kcmkonsoledialog.ui new file mode 100644 index 000000000..bb805ed4b --- /dev/null +++ b/kcontrol/konsole/kcmkonsoledialog.ui @@ -0,0 +1,390 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>KCMKonsoleDialog</class> +<widget class="QWidget"> + <property name="name"> + <cstring>KCMKonsoleDialog</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>507</width> + <height>490</height> + </rect> + </property> + <property name="layoutMargin" stdset="0"> + </property> + <property name="layoutSpacing" stdset="0"> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QTabWidget" row="0" column="0"> + <property name="name"> + <cstring>TabWidget2</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="layoutMargin" stdset="0"> + </property> + <property name="layoutSpacing" stdset="0"> + </property> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>&General</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer row="2" column="0"> + <property name="name"> + <cstring>Spacer3</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QGroupBox" row="1" column="0"> + <property name="name"> + <cstring>GroupBox3</cstring> + </property> + <property name="title"> + <string>Double Click</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>TextLabel1_3</cstring> + </property> + <property name="text"> + <string>Consider the following characters &part of a word when double clicking:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>word_connectorLE</cstring> + </property> + </widget> + <widget class="QLineEdit" row="1" column="0"> + <property name="name"> + <cstring>word_connectorLE</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </grid> + </widget> + <widget class="QGroupBox" row="0" column="0"> + <property name="name"> + <cstring>GroupBox2</cstring> + </property> + <property name="title"> + <string>Misc</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox" row="0" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>terminalSizeHintCB</cstring> + </property> + <property name="text"> + <string>Show terminal si&ze after resizing</string> + </property> + </widget> + <widget class="QCheckBox" row="1" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>frameCB</cstring> + </property> + <property name="text"> + <string>Show &frame</string> + </property> + </widget> + <widget class="QCheckBox" row="2" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>warnCB</cstring> + </property> + <property name="text"> + <string>&Confirm quit when closing more than one session</string> + </property> + </widget> + <widget class="QCheckBox" row="3" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>blinkingCB</cstring> + </property> + <property name="text"> + <string>&Blinking cursor</string> + </property> + </widget> + <widget class="QCheckBox" row="4" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>ctrldragCB</cstring> + </property> + <property name="text"> + <string>&Require Ctrl key for drag and drop</string> + </property> + </widget> + <widget class="QCheckBox" row="5" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>cutToBeginningOfLineCB</cstring> + </property> + <property name="text"> + <string>Triple click selects &only from the current word forward</string> + </property> + </widget> + <widget class="QCheckBox" row="6" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>allowResizeCB</cstring> + </property> + <property name="text"> + <string>Allow progr&ams to resize terminal window</string> + </property> + </widget> + <widget class="QCheckBox" row="7" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>xonXoffCB</cstring> + </property> + <property name="text"> + <string>Use Ctrl+S/Ctrl+Q flow control</string> + </property> + </widget> + <spacer row="11" column="3"> + <property name="name"> + <cstring>Spacer3</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QCheckBox" row="8" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>bidiCB</cstring> + </property> + <property name="text"> + <string>Enable bidirectional text rendering</string> + </property> + </widget> + <widget class="QLabel" row="11" column="0"> + <property name="name"> + <cstring>SilenceLabel</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Seconds to detect s&ilence:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>silence_secondsSB</cstring> + </property> + </widget> + <widget class="KIntNumInput" row="11" column="1" rowspan="1" colspan="2"> + <property name="name"> + <cstring>silence_secondsSB</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minValue"> + <number>1</number> + </property> + </widget> + <widget class="KIntNumInput" row="10" column="2"> + <property name="name"> + <cstring>line_spacingSB</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minValue"> + <number>0</number> + </property> + <property name="maxValue"> + <number>8</number> + </property> + </widget> + <widget class="QLabel" row="10" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>TextLabel1_4</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>&Line spacing:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>line_spacingSB</cstring> + </property> + </widget> + <spacer row="10" column="3"> + <property name="name"> + <cstring>Spacer2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QCheckBox" row="9" column="0" rowspan="1" colspan="4"> + <property name="name"> + <cstring>matchTabWinTitleCB</cstring> + </property> + <property name="text"> + <string>Set tab title to match window title</string> + </property> + </widget> + </grid> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>&Schema</string> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="SchemaEditor"> + <property name="name"> + <cstring>SchemaEditor1</cstring> + </property> + </widget> + </vbox> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>S&ession</string> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="SessionEditor"> + <property name="name"> + <cstring>SessionEditor1</cstring> + </property> + </widget> + </vbox> + </widget> + </widget> + </grid> +</widget> +<customwidgets> + <customwidget> + <class>SchemaEditor</class> + <header location="local">schemaeditor.h</header> + <sizehint> + <width>-1</width> + <height>-1</height> + </sizehint> + <container>0</container> + <sizepolicy> + <hordata>7</hordata> + <verdata>7</verdata> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </customwidget> + <customwidget> + <class>SessionEditor</class> + <header location="local">sessioneditor.h</header> + <sizehint> + <width>-1</width> + <height>-1</height> + </sizehint> + <container>0</container> + <sizepolicy> + <hordata>7</hordata> + <verdata>7</verdata> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </customwidget> +</customwidgets> +<includes> + <include location="global" impldecl="in declaration">kcolorbutton.h</include> + <include location="global" impldecl="in declaration">knuminput.h</include> + <include location="local" impldecl="in implementation">kdialog.h</include> +</includes> +<layoutdefaults spacing="3" margin="6"/> +<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> +<includehints> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>schemaeditor.h</includehint> + <includehint>sessioneditor.h</includehint> +</includehints> +</UI> diff --git a/kcontrol/konsole/schemadialog.ui b/kcontrol/konsole/schemadialog.ui new file mode 100644 index 000000000..64fda6a49 --- /dev/null +++ b/kcontrol/konsole/schemadialog.ui @@ -0,0 +1,631 @@ +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> +<class>SchemaDialog</class> +<widget class="QWidget"> + <property name="name"> + <cstring>SchemaDialog</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>420</width> + <height>423</height> + </rect> + </property> + <property name="caption"> + <string>Konsole Schema Editor</string> + </property> + <property name="layoutMargin" stdset="0"> + </property> + <property name="layoutSpacing" stdset="0"> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QLayoutWidget" row="0" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>Layout2</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>TextLabel1</cstring> + </property> + <property name="text"> + <string>&Title:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>titleLine</cstring> + </property> + </widget> + <widget class="QLineEdit"> + <property name="name"> + <cstring>titleLine</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </hbox> + </widget> + <widget class="QGroupBox" row="1" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>GroupBox1</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>3</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Colors</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>TextLabel8</cstring> + </property> + <property name="text"> + <string>Shell co&lor:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>colorCombo</cstring> + </property> + </widget> + <widget class="QCheckBox" row="2" column="0"> + <property name="name"> + <cstring>boldCheck</cstring> + </property> + <property name="text"> + <string>&Bold</string> + </property> + </widget> + <spacer row="1" column="4"> + <property name="name" stdset="0"> + <cstring>Spacer5</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="KColorButton" row="1" column="3"> + <property name="name"> + <cstring>colorButton</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="QComboBox" row="1" column="2"> + <item> + <property name="text"> + <string>Custom</string> + </property> + </item> + <item> + <property name="text"> + <string>System Background</string> + </property> + </item> + <item> + <property name="text"> + <string>System Foreground</string> + </property> + </item> + <item> + <property name="text"> + <string>Random Hue</string> + </property> + </item> + <property name="name"> + <cstring>typeCombo</cstring> + </property> + </widget> + <spacer row="1" column="1"> + <property name="name" stdset="0"> + <cstring>Spacer2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Fixed</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QCheckBox" row="2" column="2" rowspan="1" colspan="3"> + <property name="name"> + <cstring>transparentCheck</cstring> + </property> + <property name="text"> + <string>Trans&parent</string> + </property> + </widget> + <widget class="QLabel" row="0" column="2"> + <property name="name"> + <cstring>TextLabel1_2</cstring> + </property> + <property name="text"> + <string>&Konsole color:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>typeCombo</cstring> + </property> + </widget> + <widget class="QComboBox" row="1" column="0"> + <item> + <property name="text"> + <string>0 - Foreground Color</string> + </property> + </item> + <item> + <property name="text"> + <string>1 - Background Color</string> + </property> + </item> + <item> + <property name="text"> + <string>2 - Color 0 (black)</string> + </property> + </item> + <item> + <property name="text"> + <string>3 - Color 1 (red)</string> + </property> + </item> + <item> + <property name="text"> + <string>4 - Color 2 (green)</string> + </property> + </item> + <item> + <property name="text"> + <string>5 - Color 3 (yellow)</string> + </property> + </item> + <item> + <property name="text"> + <string>6 - Color 4 (blue)</string> + </property> + </item> + <item> + <property name="text"> + <string>7 - Color 5 (magenta)</string> + </property> + </item> + <item> + <property name="text"> + <string>8 - Color 6 (cyan)</string> + </property> + </item> + <item> + <property name="text"> + <string>9 - Color 7 (white)</string> + </property> + </item> + <item> + <property name="text"> + <string>10 - Foreground Intensive Color</string> + </property> + </item> + <item> + <property name="text"> + <string>11 - Background Intensive Color</string> + </property> + </item> + <item> + <property name="text"> + <string>12 - Color 0 Intensive (gray)</string> + </property> + </item> + <item> + <property name="text"> + <string>13 - Color 1 Intensive (light red)</string> + </property> + </item> + <item> + <property name="text"> + <string>14 - Color 2 Intensive (light green)</string> + </property> + </item> + <item> + <property name="text"> + <string>15 - Color 3 Intensive (light yellow)</string> + </property> + </item> + <item> + <property name="text"> + <string>16 - Color 4 Intensive (light blue)</string> + </property> + </item> + <item> + <property name="text"> + <string>17 - Color 5 Intensive (light magenta)</string> + </property> + </item> + <item> + <property name="text"> + <string>18 - Color 6 Intensive (light cyan)</string> + </property> + </item> + <item> + <property name="text"> + <string>19 - Color 7 Intensive (white)</string> + </property> + </item> + <property name="name"> + <cstring>colorCombo</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </grid> + </widget> + <widget class="QGroupBox" row="2" column="0"> + <property name="name"> + <cstring>GroupBox2</cstring> + </property> + <property name="title"> + <string>Schema</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QListBox"> + <property name="name"> + <cstring>schemaList</cstring> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>defaultSchemaCB</cstring> + </property> + <property name="text"> + <string>S&et as default schema</string> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout3</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QPushButton" row="0" column="0"> + <property name="name"> + <cstring>saveButton</cstring> + </property> + <property name="text"> + <string>Sa&ve Schema...</string> + </property> + </widget> + <widget class="QPushButton" row="1" column="0"> + <property name="name"> + <cstring>removeButton</cstring> + </property> + <property name="text"> + <string>&Remove Schema</string> + </property> + </widget> + <spacer row="0" column="1"> + <property name="name" stdset="0"> + <cstring>Spacer7</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </grid> + </widget> + </vbox> + </widget> + <widget class="QGroupBox" row="2" column="1"> + <property name="name"> + <cstring>GroupBox13</cstring> + </property> + <property name="title"> + <string>Background</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer row="4" column="0"> + <property name="name" stdset="0"> + <cstring>Spacer1</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Fixed</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLineEdit" row="1" column="0" rowspan="1" colspan="5"> + <property name="name"> + <cstring>backgndLine</cstring> + </property> + </widget> + <widget class="QToolButton" row="1" column="5"> + <property name="name"> + <cstring>imageBrowse</cstring> + </property> + <property name="text"> + <string>...</string> + </property> + </widget> + <widget class="QComboBox" row="0" column="3" rowspan="1" colspan="2"> + <item> + <property name="text"> + <string>Tiled</string> + </property> + </item> + <item> + <property name="text"> + <string>Centered</string> + </property> + </item> + <item> + <property name="text"> + <string>Full</string> + </property> + </item> + <property name="name"> + <cstring>modeCombo</cstring> + </property> + </widget> + <widget class="QLabel" row="0" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>TextLabel11</cstring> + </property> + <property name="text"> + <string>&Image:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>modeCombo</cstring> + </property> + </widget> + <widget class="QLabel" row="5" column="1"> + <property name="name"> + <cstring>TextLabel6</cstring> + </property> + <property name="text"> + <string>Min</string> + </property> + </widget> + <widget class="QSlider" row="5" column="2" rowspan="1" colspan="2"> + <property name="name"> + <cstring>shadeSlide</cstring> + </property> + <property name="value"> + <number>50</number> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="QLabel" row="5" column="4"> + <property name="name"> + <cstring>TextLabel5</cstring> + </property> + <property name="text"> + <string>Max</string> + </property> + </widget> + <widget class="QLabel" row="4" column="1" rowspan="1" colspan="2"> + <property name="name"> + <cstring>TextLabel3</cstring> + </property> + <property name="text"> + <string>Shade t&o:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>shadeColor</cstring> + </property> + </widget> + <widget class="KColorButton" row="4" column="3" rowspan="1" colspan="2"> + <property name="name"> + <cstring>shadeColor</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="QLabel" row="2" column="0" rowspan="1" colspan="5"> + <property name="name"> + <cstring>previewPixmap</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>180</width> + <height>120</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>180</width> + <height>120</height> + </size> + </property> + <property name="frameShape"> + <enum>Panel</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="scaledContents"> + <bool>true</bool> + </property> + </widget> + <widget class="QCheckBox" row="3" column="0" rowspan="1" colspan="6"> + <property name="name"> + <cstring>transparencyCheck</cstring> + </property> + <property name="text"> + <string>Tr&ansparent</string> + </property> + </widget> + </grid> + </widget> + <spacer row="3" column="0"> + <property name="name" stdset="0"> + <cstring>Spacer4</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </grid> +</widget> +<connections> + <connection> + <sender>transparencyCheck</sender> + <signal>toggled(bool)</signal> + <receiver>shadeSlide</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>transparencyCheck</sender> + <signal>toggled(bool)</signal> + <receiver>shadeColor</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>transparencyCheck</sender> + <signal>toggled(bool)</signal> + <receiver>TextLabel3</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>transparencyCheck</sender> + <signal>toggled(bool)</signal> + <receiver>TextLabel6</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>transparencyCheck</sender> + <signal>toggled(bool)</signal> + <receiver>TextLabel5</receiver> + <slot>setDisabled(bool)</slot> + </connection> + <connection> + <sender>transparencyCheck</sender> + <signal>toggled(bool)</signal> + <receiver>TextLabel5</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>defaultSchemaCB</sender> + <signal>toggled(bool)</signal> + <receiver>defaultSchemaCB</receiver> + <slot>setDisabled(bool)</slot> + </connection> + <connection> + <sender>transparencyCheck</sender> + <signal>toggled(bool)</signal> + <receiver>backgndLine</receiver> + <slot>setDisabled(bool)</slot> + </connection> + <connection> + <sender>transparencyCheck</sender> + <signal>toggled(bool)</signal> + <receiver>imageBrowse</receiver> + <slot>setDisabled(bool)</slot> + </connection> +</connections> +<tabstops> + <tabstop>titleLine</tabstop> + <tabstop>colorCombo</tabstop> + <tabstop>typeCombo</tabstop> + <tabstop>boldCheck</tabstop> + <tabstop>transparentCheck</tabstop> + <tabstop>colorButton</tabstop> + <tabstop>schemaList</tabstop> + <tabstop>defaultSchemaCB</tabstop> + <tabstop>saveButton</tabstop> + <tabstop>removeButton</tabstop> + <tabstop>modeCombo</tabstop> + <tabstop>backgndLine</tabstop> + <tabstop>transparencyCheck</tabstop> + <tabstop>shadeColor</tabstop> + <tabstop>shadeSlide</tabstop> +</tabstops> +<includes> + <include location="global" impldecl="in declaration">kcolorbutton.h</include> + <include location="local" impldecl="in implementation">kdialog.h</include> +</includes> +<layoutdefaults spacing="3" margin="6"/> +<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> +</UI> diff --git a/kcontrol/konsole/schemaeditor.cpp b/kcontrol/konsole/schemaeditor.cpp new file mode 100644 index 000000000..f7591bee8 --- /dev/null +++ b/kcontrol/konsole/schemaeditor.cpp @@ -0,0 +1,708 @@ +/*************************************************************************** + schemaeditor.cpp - description + ------------------- + begin : mar apr 17 16:44:59 CEST 2001 + copyright : (C) 2001 by Andrea Rizzi + email : rizzi@kde.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#define TABLE_COLORS 20 + + +#include "schemaeditor.h" +#include "schemaeditor.moc" + +#include <dcopclient.h> + +#include <qlabel.h> +#include <qlineedit.h> +#include <qwmatrix.h> +#include <qcombobox.h> +#include <kdebug.h> +#include <qcheckbox.h> +#include <kstandarddirs.h> + +//#include <errno.h> + +#include <qslider.h> +#include <klocale.h> +#include <kfiledialog.h> +#include <kinputdialog.h> +#include <qtoolbutton.h> +#include <kmessagebox.h> +#include <ksharedpixmap.h> +#include <kimageeffect.h> +#include <qimage.h> + +// SchemaListBoxText is a list box text item with schema filename +class SchemaListBoxText : public QListBoxText +{ + public: + SchemaListBoxText(const QString &title, const QString &filename): QListBoxText(title) + { + m_filename = filename; + }; + + const QString filename() { return m_filename; }; + + private: + QString m_filename; +}; + + +SchemaEditor::SchemaEditor(QWidget * parent, const char *name) +:SchemaDialog(parent, name) +{ + schMod= false; + loaded = false; + schemaLoaded = false; + change = false; + oldSlot = 0; + oldSchema = -1; + color.resize(20); + type.resize(20); + bold.resize(20); + transparent.resize(20); + defaultSchema = ""; + spix = new KSharedPixmap; + + connect(spix, SIGNAL(done(bool)), SLOT(previewLoaded(bool))); + + DCOPClient *client = kapp->dcopClient(); + if (!client->isAttached()) + client->attach(); + QByteArray data; + + QDataStream args(data, IO_WriteOnly); + args << 1; + client->send("kdesktop", "KBackgroundIface", "setExport(int)", data); + + + + + transparencyCheck->setChecked(true); + transparencyCheck->setChecked(false); + + + KGlobal::locale()->insertCatalogue("konsole"); // For schema translations + connect(imageBrowse, SIGNAL(clicked()), this, SLOT(imageSelect())); + connect(saveButton, SIGNAL(clicked()), this, SLOT(saveCurrent())); + connect(removeButton, SIGNAL(clicked()), this, SLOT(removeCurrent())); + connect(colorCombo, SIGNAL(activated(int)), this, SLOT(slotColorChanged(int))); + connect(typeCombo, SIGNAL(activated(int)), this, SLOT(slotTypeChanged(int))); + connect(schemaList, SIGNAL(highlighted(int)), this, SLOT(readSchema(int))); + connect(shadeColor, SIGNAL(changed(const QColor&)), this, SLOT(updatePreview())); + connect(shadeSlide, SIGNAL(valueChanged(int)), this, SLOT(updatePreview())); + connect(transparencyCheck, SIGNAL(toggled(bool)), this, SLOT(updatePreview())); + connect(backgndLine, SIGNAL(returnPressed()), this, SLOT(updatePreview())); + + connect(titleLine, SIGNAL(textChanged(const QString&)), this, SLOT(schemaModified())); + connect(shadeColor, SIGNAL(changed(const QColor&)), this, SLOT(schemaModified())); + connect(shadeSlide, SIGNAL(valueChanged(int)), this, SLOT(schemaModified())); + connect(transparencyCheck, SIGNAL(toggled(bool)), this, SLOT(schemaModified())); + connect(modeCombo, SIGNAL(activated(int)), this, SLOT(schemaModified())); + connect(backgndLine, SIGNAL(returnPressed()), this, SLOT(schemaModified())); + connect(transparentCheck, SIGNAL(toggled(bool)), this, SLOT(schemaModified())); + connect(boldCheck, SIGNAL(toggled(bool)), this, SLOT(schemaModified())); + connect(colorButton, SIGNAL(changed(const QColor&)), this, SLOT(schemaModified())); + connect(backgndLine, SIGNAL(textChanged(const QString&)), this, SLOT(schemaModified())); + + connect(defaultSchemaCB, SIGNAL(toggled(bool)), this, SIGNAL(changed())); + removeButton->setEnabled( schemaList->currentItem() ); +} + + +QString SchemaEditor::schema() +{ + QString filename = defaultSchema; + + int i = schemaList->currentItem(); + if (defaultSchemaCB->isChecked() && i>=0) + filename = ((SchemaListBoxText *) schemaList->item(i))->filename(); + + return filename.section('/',-1); +} + + +void SchemaEditor::setSchema(QString sch) +{ + defaultSchema = sch; + sch = locate("data", "konsole/"+sch); + + int sc = -1; + for (int i = 0; i < (int) schemaList->count(); i++) + if (sch == ((SchemaListBoxText *) schemaList->item(i))->filename()) + sc = i; + + oldSchema = sc; + if (sc == -1) + sc = 0; + schemaList->setCurrentItem(sc); +// readSchema(sc); +} + +SchemaEditor::~SchemaEditor() +{ + delete spix; +} + + + +void SchemaEditor::updatePreview() +{ + + if (transparencyCheck->isChecked()) { + if (loaded) { + float rx = (100.0 - shadeSlide->value()) / 100; + QImage ima(pix.convertToImage()); + ima = KImageEffect::fade(ima, rx, shadeColor->color()); + QPixmap pm; + pm.convertFromImage(ima); + previewPixmap->setPixmap(pm); + previewPixmap->setScaledContents(true); + } + else //try to reload + { + if(!spix->loadFromShared(QString("DESKTOP1"))) + kdDebug(0) << "cannot load" << endl; + + } + } else { + QPixmap pm; + pm.load(backgndLine->text()); + if ( pm.isNull() ) { + previewPixmap->clear(); + } else { + previewPixmap->setPixmap(pm); + previewPixmap->setScaledContents(true); + } + } + +} + +void SchemaEditor::previewLoaded(bool l) +{ + if (l) { + QWMatrix mat; + pix = + spix->xForm(mat. + scale(180.0 / spix->QPixmap::width(), + 100.0 / spix->QPixmap::height())); + kdDebug(0) << "Loaded" << endl; + loaded = true; + if (transparencyCheck->isChecked()) { + updatePreview(); + } + + } else + kdDebug(0) << "error loading" << endl; + +} + + +void SchemaEditor::getList() +{ + if (! schemaLoaded) { + loadAllSchema(); + setSchema(defaultSchema); + schemaLoaded = true; + change = true; + } +} + +void SchemaEditor::show() +{ + getList(); + SchemaDialog::show(); +} + + +void SchemaEditor::loadAllSchema(QString currentFile) +{ + QStringList list = KGlobal::dirs()->findAllResources("data", "konsole/*.schema"); + QStringList::ConstIterator it; + disconnect(schemaList, SIGNAL(highlighted(int)), this, SLOT(readSchema(int))); + schemaList->clear(); + + QListBoxItem* currentItem = 0; + for (it = list.begin(); it != list.end(); ++it) { + + QString name = (*it); + + QString title = readSchemaTitle(name); + + // Only insert new items so that local items override global + if (schemaList->findItem(title, ExactMatch) == 0) { + if (title.isNull() || title.isEmpty()) + title=i18n("untitled"); + + schemaList->insertItem(new SchemaListBoxText(title, name)); + if (currentFile==name.section('/',-1)) + currentItem = schemaList->item( schemaList->count()-1 ); + } + } + schemaList->sort(); + schemaList->setCurrentItem(0); // select the first added item correctly too + schemaList->setCurrentItem(currentItem); + connect(schemaList, SIGNAL(highlighted(int)), this, SLOT(readSchema(int))); + schemaListChanged(); +} + +void SchemaEditor::imageSelect() +{ + QString start; + start = backgndLine->text(); + if (start.isEmpty()) + { + QStringList list=KGlobal::dirs()->resourceDirs("wallpaper"); + if(list.count()>0) + start= list.last(); + } + + KURL url = KFileDialog::getImageOpenURL(start, 0, i18n("Select Background Image")); +// KURL url=KFileDialog::getOpenURL(start,"",0,i18n("Select Background Image")); + if(!url.path().isEmpty()) + { + backgndLine->setText(url.path()); + updatePreview(); + } +} + +void SchemaEditor::slotTypeChanged(int slot) +{ + schemaModified(); + + bool active = slot == 0 || slot == 3; + colorButton->setEnabled(active); + boldCheck->setEnabled(active); + transparentCheck->setEnabled(active); +} + + +void SchemaEditor::slotColorChanged(int slot) +{ + kdDebug(0) << slot << endl; + color[oldSlot] = colorButton->color(); + type[oldSlot] = typeCombo->currentItem(); + bold[oldSlot] = boldCheck->isChecked(); + transparent[oldSlot] = transparentCheck->isChecked(); + + change = false; // Don't mark as modified + transparentCheck->setChecked(transparent[slot]); + boldCheck->setChecked(bold[slot]); + typeCombo->setCurrentItem(type[slot]); + colorButton->setColor(color[slot]); + oldSlot = slot; + change = true; +} + +void SchemaEditor::removeCurrent() +{ + int i = schemaList->currentItem(); + if(i==-1) + return; + QString base = ((SchemaListBoxText *) schemaList->item(i))->filename(); + + // Query if system schemas should be removed + if (locateLocal("data", "konsole/" + base.section('/', -1)) != base) { + int code = KMessageBox::warningContinueCancel(this, + i18n("You are trying to remove a system schema. Are you sure?"), + i18n("Removing System Schema"), + KGuiItem(i18n("&Delete"), "editdelete")); + if (code != KMessageBox::Continue) + return; + } + + QString base_filename = base.section('/',-1); + + if(base_filename==schema()) + setSchema(""); + + if (!QFile::remove(base)) + KMessageBox::error(this, + i18n("Cannot remove the schema.\nMaybe it is a system schema.\n"), + i18n("Error Removing Schema")); + + loadAllSchema(); + + setSchema(defaultSchema); + +} + +void SchemaEditor::saveCurrent() +{ + + //This is to update the color table + colorCombo->setCurrentItem(0); + slotColorChanged(0); + + QString fullpath; + if (schemaList->currentText() == titleLine->text()) { + int i = schemaList->currentItem(); + fullpath = ((SchemaListBoxText *) schemaList->item(i))->filename().section('/',-1); + } + else { + // Only ask for a name for changed titleLine, considered a "save as" + fullpath = titleLine->text().stripWhiteSpace().simplifyWhiteSpace()+".schema"; + + bool ok; + fullpath = KInputDialog::getText( i18n( "Save Schema" ), + i18n( "File name:" ), fullpath, &ok, this ); + if (!ok) return; + } + + if (fullpath[0] != '/') + fullpath = KGlobal::dirs()->saveLocation("data", "konsole/") + fullpath; + + QFile f(fullpath); + if (f.open(IO_WriteOnly)) { + QTextStream t(&f); + t.setEncoding( QTextStream::UnicodeUTF8 ); + + t << "# schema for konsole autogenerated with the schema editor" << endl; + t << endl; + t << "title " << titleLine->text() << endl; // Use title line as schema title + t << endl; + if (transparencyCheck->isChecked()) { + QColor c = shadeColor->color(); + QString tra; + tra.sprintf("transparency %1.2f %3d %3d %3d", + 1.0 * (100 - shadeSlide->value()) / 100, c.red(), c.green(), c.blue()); + t << tra << endl; + } + + if (!backgndLine->text().isEmpty()) { + QString smode; + int mode; + mode = modeCombo->currentItem(); + if (mode == 0) + smode = "tile"; + if (mode == 1) + smode = "center"; + if (mode == 2) + smode = "full"; + + QString image; + image.sprintf("image %s %s", + (const char *) smode.latin1(), + (const char *) backgndLine->text().utf8()); + t << image << endl; + } + t << endl; + t << "# foreground colors" << endl; + t << endl; + t << "# note that the default background color is flagged" << endl; + t << "# to become transparent when an image is present." << endl; + t << endl; + t << "# slot transparent bold" << endl; + t << "# | red grn blu | |" << endl; + t << "# V V--color--V V V" << endl; + + for (int i = 0; i < 20; i++) { + QString scol; + if (type[i] == 0) + scol.sprintf("color %2d %3d %3d %3d %2d %1d # %s", i, + color[i].red(), color[i].green(), color[i].blue(), + transparent[i], bold[i], + (const char *) colorCombo->text(i).utf8()); + else if (type[i] == 1) + scol.sprintf("sysfg %2d %2d %1d # %s", i, + transparent[i], bold[i], + (const char *) colorCombo->text(i).utf8()); + else if (type[i] == 2) + scol.sprintf("sysbg %2d %2d %1d # %s", i, + transparent[i], bold[i], + (const char *) colorCombo->text(i).utf8()); + else { + int ch, cs, cv; + color[i].hsv(&ch, &cs, &cv); + scol.sprintf("rcolor %1d %3d %3d %2d %1d # %s", i, + cs, cv, transparent[i], bold[i], + (const char *) colorCombo->text(i).utf8()); + } + t << scol << endl; + } + + + f.close(); + } else + KMessageBox::error(this, i18n("Cannot save the schema.\nMaybe permission denied.\n"), + i18n("Error Saving Schema")); + + schMod=false; + loadAllSchema(fullpath.section('/',-1)); +} + +void SchemaEditor::schemaModified() +{ + if (change) { + saveButton->setEnabled(titleLine->text().length() != 0); + schMod=true; + emit changed(); + } +} + +QString SchemaEditor::readSchemaTitle(const QString & file) +{ + /* + Code taken from konsole/konsole/schema.cpp + + */ + + + QString fPath = locate("data", "konsole/" + file); + + if (fPath.isNull()) + fPath = locate("data", file); + + if (fPath.isNull()) + return 0; + + FILE *sysin = fopen(QFile::encodeName(fPath), "r"); + if (!sysin) + return 0; + + + char line[100]; + while (fscanf(sysin, "%80[^\n]\n", line) > 0) + if (strlen(line) > 5) + if (!strncmp(line, "title", 5)) { + fclose(sysin); + return i18n(line + 6); + } + + return 0; +} + +void SchemaEditor::schemaListChanged() +{ + QStringList titles, filenames; + SchemaListBoxText *item; + + for (int index = 0; index < (int) schemaList->count(); index++) { + item = (SchemaListBoxText *) schemaList->item(index); + titles.append(item->text()); + filenames.append(item->filename().section('/', -1)); + } + + emit schemaListChanged(titles, filenames); +} + +void SchemaEditor::querySave() +{ + int result = KMessageBox::questionYesNo(this, + i18n("The schema has been modified.\n" + "Do you want to save the changes?"), + i18n("Schema Modified"), + KStdGuiItem::save(), + KStdGuiItem::discard()); + if (result == KMessageBox::Yes) + { + saveCurrent(); + } +} + +void SchemaEditor::readSchema(int num) +{ + /* + Code taken from konsole/konsole/schema.cpp + + */ + + if (oldSchema != -1) { + + + if (defaultSchemaCB->isChecked()) { + + defaultSchema = ((SchemaListBoxText *) schemaList->item(oldSchema))->filename(); + + } + + if(schMod) { + disconnect(schemaList, SIGNAL(highlighted(int)), this, SLOT(readSchema(int))); + schemaList->setCurrentItem(oldSchema); + querySave(); + schemaList->setCurrentItem(num); + connect(schemaList, SIGNAL(highlighted(int)), this, SLOT(readSchema(int))); + schMod=false; + } + + } + + QString fPath = locate("data", "konsole/" + + ((SchemaListBoxText *) schemaList->item(num))->filename()); + + if (fPath.isNull()) + fPath = locate("data", + ((SchemaListBoxText *) schemaList->item(num))->filename()); + + if (fPath.isNull()) { + KMessageBox::error(this, i18n("Cannot find the schema."), + i18n("Error Loading Schema")); + + + return; + } + removeButton->setEnabled( QFileInfo (fPath).isWritable () ); + defaultSchemaCB->setChecked(fPath.section('/',-1) == defaultSchema.section('/',-1)); + + FILE *sysin = fopen(QFile::encodeName(fPath), "r"); + if (!sysin) { + KMessageBox::error(this, i18n("Cannot load the schema."), + i18n("Error Loading Schema")); + loadAllSchema(); + return; + } + + char line[100]; + + + titleLine->setText(i18n("untitled")); + transparencyCheck->setChecked(false); + backgndLine->setText(""); + + while (fscanf(sysin, "%80[^\n]\n", line) > 0) { + if (strlen(line) > 5) { + + if (!strncmp(line, "title", 5)) { + titleLine->setText(i18n(line + 6)); + } + + + + if (!strncmp(line, "image", 5)) { + char rend[100], path[100]; + int attr = 1; + if (sscanf(line, "image %s %s", rend, path) != 2) + continue; + if (!strcmp(rend, "tile")) + attr = 2; + else if (!strcmp(rend, "center")) + attr = 3; + else if (!strcmp(rend, "full")) + attr = 4; + else + continue; + + QString qline(line); + backgndLine->setText(locate("wallpaper", qline.mid( qline.find(" ",7)+1 ) )); + modeCombo->setCurrentItem(attr - 2); + + } + + + if (!strncmp(line, "transparency", 12)) { + float rx; + int rr, rg, rb; + // Transparency needs 4 parameters: fade strength and the 3 + // components of the fade color. + if (sscanf(line, "transparency %g %d %d %d", &rx, &rr, &rg, &rb) != 4) + continue; + + transparencyCheck->setChecked(true); + shadeSlide->setValue((int)(100 - rx * 100)); + shadeColor->setColor(QColor(rr, rg, rb)); + + } + if (!strncmp(line,"rcolor",6)) { + int fi,ch,cs,cv,tr,bo; + if(sscanf(line,"rcolor %d %d %d %d %d",&fi,&cs,&cv,&tr,&bo) != 5) + continue; + if (!(0 <= fi && fi <= TABLE_COLORS)) + continue; + ch = 0; // Random hue - set to zero + if (!(0 <= cs && cs <= 255 )) + continue; + if (!(0 <= cv && cv <= 255 )) + continue; + if (!(0 <= tr && tr <= 1 )) + continue; + if (!(0 <= bo && bo <= 1 )) + continue; + color[fi] = QColor(); + color[fi].setHsv(ch,cs,cv); + transparent[fi] = tr; + bold[fi] = bo; + type[fi] = 3; + } + if (!strncmp(line, "color", 5)) { + int fi, cr, cg, cb, tr, bo; + if (sscanf(line, "color %d %d %d %d %d %d", &fi, &cr, &cg, &cb, &tr, &bo) != 6) + continue; + if (!(0 <= fi && fi <= TABLE_COLORS)) + continue; + if (!(0 <= cr && cr <= 255)) + continue; + if (!(0 <= cg && cg <= 255)) + continue; + if (!(0 <= cb && cb <= 255)) + continue; + if (!(0 <= tr && tr <= 1)) + continue; + if (!(0 <= bo && bo <= 1)) + continue; + color[fi] = QColor(cr, cg, cb); + transparent[fi] = tr; + bold[fi] = bo; + type[fi] = 0; + + } + if (!strncmp(line, "sysfg", 5)) { + int fi, tr, bo; + if (sscanf(line, "sysfg %d %d %d", &fi, &tr, &bo) != 3) + continue; + if (!(0 <= fi && fi <= TABLE_COLORS)) + continue; + if (!(0 <= tr && tr <= 1)) + continue; + if (!(0 <= bo && bo <= 1)) + continue; + color[fi] = kapp->palette().active().text(); + transparent[fi] = tr; + bold[fi] = bo; + type[fi] = 1; + } + if (!strncmp(line, "sysbg", 5)) { + int fi, tr, bo; + if (sscanf(line, "sysbg %d %d %d", &fi, &tr, &bo) != 3) + continue; + if (!(0 <= fi && fi <= TABLE_COLORS)) + continue; + if (!(0 <= tr && tr <= 1)) + continue; + if (!(0 <= bo && bo <= 1)) + continue; + color[fi] = kapp->palette().active().base(); + transparent[fi] = tr; + bold[fi] = bo; + type[fi] = 2; + } + } + } + fclose(sysin); + int ii = colorCombo->currentItem(); + transparentCheck->setChecked(transparent[ii]); + boldCheck->setChecked(bold[ii]); + typeCombo->setCurrentItem(type[ii]); + colorButton->setColor(color[ii]); + + bool inactive = type[ii] == 1 || type[ii] == 2; + boldCheck->setDisabled(inactive); + transparentCheck->setDisabled(inactive); + colorButton->setDisabled(inactive); + + oldSchema = num; + updatePreview(); + schMod=false; + return; +} + diff --git a/kcontrol/konsole/schemaeditor.h b/kcontrol/konsole/schemaeditor.h new file mode 100644 index 000000000..550f51762 --- /dev/null +++ b/kcontrol/konsole/schemaeditor.h @@ -0,0 +1,84 @@ +/*************************************************************************** + schemaeditor.h - description + ------------------- + begin : mar apr 17 16:44:59 CEST 2001 + copyright : (C) 2001 by Andrea Rizzi + email : rizzi@kde.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef SCHEMAEDITOR_H +#define SCHEMAEDITOR_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <kapplication.h> +#include <qwidget.h> +class QPixmap; +class KSharedPixmap; + +#include "schemadialog.h" + +/** SchemaEditor is the base class of the porject */ +class SchemaEditor : public SchemaDialog +{ + Q_OBJECT + public: + /** constructor */ + SchemaEditor(QWidget* parent=0, const char *name=0); + /** destructor */ + ~SchemaEditor(); + + QString schema(); + void setSchema(QString); + bool isModified() const { return schMod; } + void querySave(); + + signals: + void changed(); + void schemaListChanged(const QStringList &titles, const QStringList &filenames); + + public slots: + void slotColorChanged(int); + void imageSelect(); + void slotTypeChanged(int); + void readSchema(int); + void saveCurrent(); + void removeCurrent(); + void previewLoaded(bool l); + void getList(); + private slots: + void show(); + void schemaModified(); + void loadAllSchema(QString currentFile=""); + void updatePreview(); + private: + bool schMod; + QMemArray<QColor> color; + QMemArray<int> type; // 0= custom, 1= sysfg, 2=sysbg, 3=rcolor + QMemArray<bool> transparent; + QMemArray<bool> bold; + QPixmap pix; + KSharedPixmap *spix; + QString defaultSchema; + bool loaded; + bool schemaLoaded; + bool change; + int oldSchema; + int oldSlot; + QString readSchemaTitle(const QString& filename); + void schemaListChanged(); + +}; + +#endif diff --git a/kcontrol/konsole/sessiondialog.ui b/kcontrol/konsole/sessiondialog.ui new file mode 100644 index 000000000..a86a74077 --- /dev/null +++ b/kcontrol/konsole/sessiondialog.ui @@ -0,0 +1,446 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>SessionDialog</class> +<widget class="QWidget"> + <property name="name"> + <cstring>SessionDialog</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>436</width> + <height>476</height> + </rect> + </property> + <property name="caption"> + <string>Konsole Session Editor</string> + </property> + <property name="layoutMargin" stdset="0"> + </property> + <property name="layoutSpacing" stdset="0"> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout8</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QGroupBox" row="1" column="1"> + <property name="name"> + <cstring>propertiesGroup</cstring> + </property> + <property name="title"> + <string>Properties</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="1" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>Layout29</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QComboBox" row="0" column="1"> + <item> + <property name="text"> + <string><Default></string> + </property> + </item> + <item> + <property name="text"> + <string>Normal</string> + </property> + </item> + <item> + <property name="text"> + <string>Tiny</string> + </property> + </item> + <item> + <property name="text"> + <string>Small</string> + </property> + </item> + <item> + <property name="text"> + <string>Medium</string> + </property> + </item> + <item> + <property name="text"> + <string>Large</string> + </property> + </item> + <item> + <property name="text"> + <string>Huge</string> + </property> + </item> + <item> + <property name="text"> + <string>Linux</string> + </property> + </item> + <item> + <property name="text"> + <string>Unicode</string> + </property> + </item> + <item> + <property name="text"> + <string>Custom</string> + </property> + </item> + <property name="name"> + <cstring>fontCombo</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + </widget> + <widget class="QLineEdit" row="1" column="1"> + <property name="name"> + <cstring>termLine</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="QComboBox" row="3" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>keytabCombo</cstring> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>TextLabel5</cstring> + </property> + <property name="text"> + <string>&Font:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>fontCombo</cstring> + </property> + </widget> + <widget class="QComboBox" row="5" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>schemaCombo</cstring> + </property> + </widget> + <widget class="QLabel" row="4" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>TextLabel7</cstring> + </property> + <property name="text"> + <string>S&chema:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>schemaCombo</cstring> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>TextLabel8</cstring> + </property> + <property name="text"> + <string>$&TERM:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>termLine</cstring> + </property> + </widget> + <widget class="QLabel" row="2" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>TextLabel6</cstring> + </property> + <property name="text"> + <string>&Keytab:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>keytabCombo</cstring> + </property> + </widget> + </grid> + </widget> + <widget class="KIconButton" row="0" column="1"> + <property name="name"> + <cstring>previewIcon</cstring> + </property> + <property name="minimumSize"> + <size> + <width>100</width> + <height>100</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>100</width> + <height>100</height> + </size> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>TextLabel4</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>90</width> + <height>100</height> + </size> + </property> + <property name="text"> + <string>&Icon:</string> + </property> + <property name="alignment"> + <set>AlignTop|AlignLeft</set> + </property> + <property name="buddy" stdset="0"> + <cstring>previewIcon</cstring> + </property> + </widget> + </grid> + </widget> + <widget class="QGroupBox" row="1" column="0"> + <property name="name"> + <cstring>sessionGroup</cstring> + </property> + <property name="title"> + <string>Session</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QListBox"> + <property name="name"> + <cstring>sessionList</cstring> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout3</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QPushButton" row="0" column="0"> + <property name="name"> + <cstring>saveButton</cstring> + </property> + <property name="text"> + <string>Sa&ve Session...</string> + </property> + </widget> + <widget class="QPushButton" row="1" column="0"> + <property name="name"> + <cstring>removeButton</cstring> + </property> + <property name="text"> + <string>&Remove Session</string> + </property> + </widget> + <spacer row="0" column="1"> + <property name="name"> + <cstring>Spacer7</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </grid> + </widget> + </vbox> + </widget> + <widget class="QGroupBox" row="0" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>generalGroup</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>General</string> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout6</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout5</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>TextLabel1</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>&Name:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>nameLine</cstring> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>TextLabel2</cstring> + </property> + <property name="text"> + <string>E&xecute:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>executeLine</cstring> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>TextLabel3</cstring> + </property> + <property name="text"> + <string>&Directory:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>directoryLine</cstring> + </property> + </widget> + </grid> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout4</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLineEdit"> + <property name="name"> + <cstring>nameLine</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="QLineEdit"> + <property name="name"> + <cstring>executeLine</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="KURLRequester"> + <property name="name"> + <cstring>directoryLine</cstring> + </property> + </widget> + </vbox> + </widget> + </hbox> + </widget> + </hbox> + </widget> + </grid> + </widget> + </vbox> +</widget> +<tabstops> + <tabstop>nameLine</tabstop> + <tabstop>executeLine</tabstop> + <tabstop>directoryLine</tabstop> + <tabstop>sessionList</tabstop> + <tabstop>saveButton</tabstop> + <tabstop>removeButton</tabstop> + <tabstop>previewIcon</tabstop> + <tabstop>fontCombo</tabstop> + <tabstop>termLine</tabstop> + <tabstop>keytabCombo</tabstop> + <tabstop>schemaCombo</tabstop> +</tabstops> +<includes> + <include location="global" impldecl="in declaration">kcolorbutton.h</include> + <include location="local" impldecl="in implementation">kdialog.h</include> +</includes> +<layoutdefaults spacing="3" margin="6"/> +<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> +<includehints> + <includehint>kicondialog.h</includehint> + <includehint>kurlrequester.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>kpushbutton.h</includehint> +</includehints> +</UI> diff --git a/kcontrol/konsole/sessioneditor.cpp b/kcontrol/konsole/sessioneditor.cpp new file mode 100644 index 000000000..8542adfcb --- /dev/null +++ b/kcontrol/konsole/sessioneditor.cpp @@ -0,0 +1,383 @@ +/*************************************************************************** + sessioneditor.cpp - description + ------------------- + begin : oct 28 2001 + copyright : (C) 2001 by Stephan Binner + email : binner@kde.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "sessioneditor.h" +#include "sessioneditor.moc" + +#include <qlineedit.h> +#include <qcombobox.h> +#include <kdebug.h> +#include <kstandarddirs.h> + +#include <klocale.h> +#include <kfiledialog.h> +#include <kinputdialog.h> +#include <kicondialog.h> +#include <kmessagebox.h> +#include <kurlrequester.h> +#include <klineedit.h> +#include <kiconloader.h> +#include <krun.h> +#include <kshell.h> + +// SessionListBoxText is a list box text item with session filename +class SessionListBoxText : public QListBoxText +{ + public: + SessionListBoxText(const QString &title, const QString &filename): QListBoxText(title) + { + m_filename = filename; + }; + + const QString filename() { return m_filename; }; + + private: + QString m_filename; +}; + +SessionEditor::SessionEditor(QWidget * parent, const char *name) +:SessionDialog(parent, name) +{ + sesMod=false; + oldSession=-1; + loaded=false; + + KGlobal::locale()->insertCatalogue("konsole"); // For schema and keytab translations + KGlobal::iconLoader()->addAppDir( "konsole" ); + + directoryLine->setMode(KFile::Directory); + connect(sessionList, SIGNAL(highlighted(int)), this, SLOT(readSession(int))); + connect(saveButton, SIGNAL(clicked()), this, SLOT(saveCurrent())); + connect(removeButton, SIGNAL(clicked()), this, SLOT(removeCurrent())); + + connect(nameLine, SIGNAL(textChanged(const QString&)), this, SLOT(sessionModified())); + connect(directoryLine, SIGNAL(textChanged(const QString&)), this, SLOT(sessionModified())); + connect(executeLine, SIGNAL(textChanged(const QString&)), this, SLOT(sessionModified())); + connect(termLine, SIGNAL(textChanged(const QString&)), this, SLOT(sessionModified())); + + connect(previewIcon, SIGNAL(iconChanged(QString)), this, SLOT(sessionModified())); + + connect(fontCombo, SIGNAL(activated(int)), this, SLOT(sessionModified())); + connect(keytabCombo, SIGNAL(activated(int)), this, SLOT(sessionModified())); + connect(schemaCombo, SIGNAL(activated(int)), this, SLOT(sessionModified())); +} + +SessionEditor::~SessionEditor() +{ + keytabFilename.setAutoDelete(true); + schemaFilename.setAutoDelete(true); +} + +void SessionEditor::show() +{ + removeButton->setEnabled(sessionList->count()>1); + if (! loaded) { + loadAllKeytab(); + loadAllSession(); + readSession(0); + sessionList->setCurrentItem(0); + loaded = true; + } + SessionDialog::show(); +} + +void SessionEditor::loadAllKeytab() +{ + QStringList lst = KGlobal::dirs()->findAllResources("data", "konsole/*.keytab"); + keytabCombo->clear(); + keytabFilename.clear(); + + keytabCombo->insertItem(i18n("XTerm (XFree 4.x.x)"),0); + keytabFilename.append(new QString("")); + + int i=1; + for(QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) + { + QString name = (*it); + QString title = readKeymapTitle(name); + + name = name.section('/',-1); + name = name.section('.',0); + keytabFilename.append(new QString(name)); + + if (title.isNull() || title.isEmpty()) + title=i18n("untitled"); + + keytabCombo->insertItem(title,i); + + i++; + } +} + +QString SessionEditor::readKeymapTitle(const QString & file) +{ + QString fPath = locate("data", "konsole/" + file); + + if (fPath.isNull()) + fPath = locate("data", file); + removeButton->setEnabled( QFileInfo (fPath).isWritable () ); + + if (fPath.isNull()) + return 0; + + FILE *sysin = fopen(QFile::encodeName(fPath), "r"); + if (!sysin) + return 0; + + char line[100]; + int len; + while (fscanf(sysin, "%80[^\n]\n", line) > 0) + if ((len = strlen(line)) > 8) + if (!strncmp(line, "keyboard", 8)) { + fclose(sysin); + if(line[len-1] == '"') + line[len-1] = '\000'; + QString temp; + if(line[9] == '"') + temp=i18n(line+10); + else + temp=i18n(line+9); + return temp; + } + + return 0; +} + +void SessionEditor::loadAllSession(QString currentFile) +{ + QStringList list = KGlobal::dirs()->findAllResources("data", "konsole/*.desktop", false, true); + sessionList->clear(); + + QListBoxItem* currentItem = 0; + for (QStringList::ConstIterator it = list.begin(); it != list.end(); ++it) { + + QString name = (*it); + + KSimpleConfig* co = new KSimpleConfig(name,true); + co->setDesktopGroup(); + QString sesname = co->readEntry("Name",i18n("Unnamed")); + delete co; + + sessionList->insertItem(new SessionListBoxText(sesname, name)); + + if (currentFile==name.section('/',-1)) + currentItem = sessionList->item( sessionList->count()-1 ); + } + sessionList->sort(); + sessionList->setCurrentItem(0); // select the first added item correctly too + sessionList->setCurrentItem(currentItem); + emit getList(); +} + +void SessionEditor::readSession(int num) +{ + int i,counter; + QString str; + KSimpleConfig* co; + + if(sesMod) { + disconnect(sessionList, SIGNAL(highlighted(int)), this, SLOT(readSession(int))); + + sessionList->setCurrentItem(oldSession); + querySave(); + sessionList->setCurrentItem(num); + connect(sessionList, SIGNAL(highlighted(int)), this, SLOT(readSession(int))); + sesMod=false; + } + if( sessionList->item(num) ) + { + removeButton->setEnabled( QFileInfo ( ((SessionListBoxText *)sessionList->item(num))->filename() ).isWritable () ); + co = new KSimpleConfig( ((SessionListBoxText *)sessionList->item(num))->filename(),true); + + co->setDesktopGroup(); + str = co->readEntry("Name"); + nameLine->setText(str); + + str = co->readPathEntry("Cwd"); + directoryLine->lineEdit()->setText(str); + + str = co->readPathEntry("Exec"); + executeLine->setText(str); + + str = co->readEntry("Icon","konsole"); + previewIcon->setIcon(str); + + i = co->readUnsignedNumEntry("Font",(unsigned int)-1); + fontCombo->setCurrentItem(i+1); + + str = co->readEntry("Term","xterm"); + termLine->setText(str); + + str = co->readEntry("KeyTab",""); + i=0; + counter=0; + for (QString *it = keytabFilename.first(); it != 0; it = keytabFilename.next()) { + if (str == (*it)) + i = counter; + counter++; + } + keytabCombo->setCurrentItem(i); + + str = co->readEntry("Schema",""); + i=0; + counter=0; + for (QString *it = schemaFilename.first(); it != 0; it = schemaFilename.next()) { + if (str == (*it)) + i = counter; + counter++; + } + schemaCombo->setCurrentItem(i); + delete co; + } + sesMod=false; + oldSession=num; +} + +void SessionEditor::querySave() +{ + int result = KMessageBox::questionYesNo(this, + i18n("The session has been modified.\n" + "Do you want to save the changes?"), + i18n("Session Modified"), + KStdGuiItem::save(), + KStdGuiItem::discard()); + if (result == KMessageBox::Yes) + { + saveCurrent(); + } +} + +void SessionEditor::schemaListChanged(const QStringList &titles, const QStringList &filenames) +{ + const QString text = schemaCombo->currentText(); + + schemaCombo->clear(); + schemaFilename.clear(); + + schemaCombo->insertItem(i18n("Konsole Default"),0); + schemaFilename.append(new QString("")); + + schemaCombo->insertStringList(titles, 1); + for (QStringList::const_iterator it = filenames.begin(); it != filenames.end(); ++it) + schemaFilename.append(new QString(*it)); + + // Restore current item + int item = 0; + for (int i = 0; i < schemaCombo->count(); i++) + if (schemaCombo->text(i) == text) { + item = i; + break; + } + schemaCombo->setCurrentItem(item); +} + +void SessionEditor::saveCurrent() +{ + // Verify Execute entry is valid; otherwise Konsole will ignore it. + // This code is take from konsole.cpp; if you change one, change both. + QString exec = executeLine->text(); + if ( !exec.isEmpty() ) // If Execute field is empty, default shell is used. + { + if ( exec.startsWith( "su -c \'" ) ) + exec = exec.mid( 7, exec.length() - 8 ); + exec = KRun::binaryName( exec, false ); + exec = KShell::tildeExpand( exec ); + QString pexec = KGlobal::dirs()->findExe( exec ); + + if ( pexec.isEmpty() ) + { + int result = KMessageBox::warningContinueCancel( this, + i18n( "The Execute entry is not a valid command.\n" + "You can still save this session, but it will not show up in Konsole's Session list." ), + i18n( "Invalid Execute Entry" ), + KStdGuiItem::save() ); + if ( result != KMessageBox::Continue ) + return; + } + + } + + QString fullpath; + if (sessionList->currentText() == nameLine->text()) { + fullpath = ( ((SessionListBoxText *)sessionList->item( sessionList->currentItem() ))->filename() ).section('/',-1); + } + else { + // Only ask for a name for changed nameLine, considered a "save as" + fullpath = nameLine->text().stripWhiteSpace().simplifyWhiteSpace()+".desktop"; + + bool ok; + fullpath = KInputDialog::getText( i18n( "Save Session" ), + i18n( "File name:" ), fullpath, &ok, this ); + if (!ok) return; + } + + if (fullpath[0] != '/') + fullpath = KGlobal::dirs()->saveLocation("data", "konsole/") + fullpath; + + KSimpleConfig* co = new KSimpleConfig(fullpath); + co->setDesktopGroup(); + co->writeEntry("Type","KonsoleApplication"); + co->writeEntry("Name",nameLine->text()); + co->writePathEntry("Cwd",directoryLine->lineEdit()->text()); + co->writePathEntry("Exec",executeLine->text()); + co->writeEntry("Icon",previewIcon->icon()); + if (fontCombo->currentItem()==0) + co->writeEntry("Font",""); + else + co->writeEntry("Font",fontCombo->currentItem()-1); + co->writeEntry("Term",termLine->text()); + co->writeEntry("KeyTab",*keytabFilename.at(keytabCombo->currentItem())); + co->writeEntry("Schema",*schemaFilename.at(schemaCombo->currentItem())); + co->sync(); + delete co; + sesMod=false; + loadAllSession(fullpath.section('/',-1)); + removeButton->setEnabled(sessionList->count()>1); +} + +void SessionEditor::removeCurrent() +{ + QString base = ((SessionListBoxText *)sessionList->item( sessionList->currentItem() ))->filename(); + + // Query if system sessions should be removed + if (locateLocal("data", "konsole/" + base.section('/', -1)) != base) { + int code = KMessageBox::warningContinueCancel(this, + i18n("You are trying to remove a system session. Are you sure?"), + i18n("Removing System Session"), + KGuiItem(i18n("&Delete"),"editdelete")); + if (code != KMessageBox::Continue) + return; + } + + if (!QFile::remove(base)) { + KMessageBox::error(this, + i18n("Cannot remove the session.\nMaybe it is a system session.\n"), + i18n("Error Removing Session")); + return; + } + removeButton->setEnabled(sessionList->count()>1); + loadAllSession(); + readSession(0); + sessionList->setCurrentItem(0); +} + +void SessionEditor::sessionModified() +{ + saveButton->setEnabled(nameLine->text().length() != 0); + sesMod=true; + emit changed(); +} diff --git a/kcontrol/konsole/sessioneditor.h b/kcontrol/konsole/sessioneditor.h new file mode 100644 index 000000000..15d1aee2b --- /dev/null +++ b/kcontrol/konsole/sessioneditor.h @@ -0,0 +1,68 @@ +/*************************************************************************** + sessioneditor.h - description + ------------------- + begin : oct 28 2001 + copyright : (C) 2001 by Stephan Binner + email : binner@kde.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef SESSIONEDITOR_H +#define SESSIONEDITOR_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <qptrlist.h> +#include <qstringlist.h> +#include <kapplication.h> +#include <qwidget.h> + +#include "sessiondialog.h" + +class SessionEditor : public SessionDialog +{ + Q_OBJECT + public: + SessionEditor(QWidget* parent=0, const char *name=0); + ~SessionEditor(); + + bool isModified() const { return sesMod; } + void querySave(); + + signals: + void changed(); + void getList(); + + public slots: + void schemaListChanged(const QStringList &titles, const QStringList &filenames); + + private slots: + void readSession(int); + void saveCurrent(); + void removeCurrent(); + void sessionModified(); + + private: + void show(); + void loadAllKeytab(); + void loadAllSession(QString currentFile=""); + QString readKeymapTitle(const QString& filename); + + bool sesMod; + int oldSession; + bool loaded; + QPtrList<QString> keytabFilename; + QPtrList<QString> schemaFilename; +}; + +#endif |