File indexing completed on 2024-04-28 04:02:30

0001 /***************************************************************************
0002                           dlgappsettings.cpp  -  application settings
0003     This file is a part of KMuddy distribution.
0004                              -------------------
0005     begin                : St aug 14 2002
0006     copyright            : (C) 2002-2007 by Tomas Mecir
0007     email                : kmuddy@kmuddy.com
0008  ***************************************************************************/
0009 
0010 /***************************************************************************
0011  *                                                                         *
0012  *   This program is free software; you can redistribute it and/or modify  *
0013  *   it under the terms of the GNU General Public License as published by  *
0014  *   the Free Software Foundation; either version 2 of the License, or     *
0015  *   (at your option) any later version.                                   *
0016  *                                                                         *
0017  ***************************************************************************/
0018 
0019 #include "dlgappsettings.h"
0020 #include "cactionmanager.h"
0021 #include "cglobalsettings.h"
0022 // needed for auto-connect
0023 #include "cprofilemanager.h"
0024 #include "cdialoglist.h"
0025 #include "cdirlist.h"
0026 
0027 //a lot of include files...
0028 #include <QCheckBox>
0029 #include <QComboBox>
0030 #include <QFontDialog>
0031 #include <QGridLayout>
0032 #include <QGroupBox>
0033 #include <QHBoxLayout>
0034 #include <QVBoxLayout>
0035 #include <QIcon>
0036 #include <QLabel>
0037 #include <QLineEdit>
0038 #include <QPushButton>
0039 #include <QSpinBox>
0040 #include <QStandardPaths>
0041 
0042 #include <kcolorbutton.h>
0043 #include <kconfig.h>
0044 #include <kshortcutsdialog.h>
0045 #include <KLocalizedString>
0046 
0047 QSpinBox *setupSpinbox (QGridLayout *layout, int row, int firstcol, const QString &label, int min, int max, const QString &specialVal, const QString &whatsThis)
0048 {
0049   QSpinBox *box = new QSpinBox;
0050   box->setMinimum (min);
0051   box->setMaximum (max);
0052   box->setSpecialValueText (specialVal);
0053   box->setWhatsThis( whatsThis);
0054 
0055   QLabel *clabel = new QLabel (label);
0056   clabel->setAlignment (Qt::AlignLeft | Qt::AlignVCenter);
0057   clabel->setBuddy (box);
0058 
0059   layout->addWidget (clabel, row, firstcol);
0060   layout->addWidget (box, row, firstcol + 1);
0061 
0062   return box;
0063 }
0064 
0065 dlgAppSettings::dlgAppSettings (QWidget *parent) : KPageDialog (parent)
0066 {
0067   cDialogList::self()->addDialog ("app-prefs", this);
0068 
0069   //color list
0070   QString cltext[16] = { i18n("Black"), i18n("Red"), i18n("Green"),
0071     i18n("Yellow"), i18n("Blue"), i18n("Magenta"), i18n("Cyan"), i18n("Gray"),
0072     i18n("Dark gray"), i18n("Bright red"), i18n("Bright green"),
0073     i18n("Bright yellow"), i18n("Bright blue"), i18n("Bright magenta"),
0074     i18n("Bright cyan"), i18n("White") };
0075 
0076   //initial dialog size
0077   setWindowTitle (i18n ("Application settings"));
0078   setStandardButtons (QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::Apply);
0079   setFaceType (KPageDialog::List);
0080 
0081   //prepare dialog pages
0082   KPageWidgetItem *item;
0083   QFrame *frmwindow = new QFrame (this);
0084   item = addPage (frmwindow, i18n ("Window"));
0085   item->setIcon (QIcon::fromTheme ("window-new"));
0086   QFrame *frmoutputarea = new QFrame (this);
0087   item = addPage (frmoutputarea, i18n ("Output area"));
0088   item->setIcon (QIcon::fromTheme ("format-justify-left"));
0089   QFrame *frmfont = new QFrame (this);
0090   item = addPage (frmfont, i18n ("Font"));
0091   item->setIcon (QIcon::fromTheme ("preferences-desktop-font"));
0092   QFrame *frminput = new QFrame (this);
0093   item = addPage (frminput, i18n ("Input line"));
0094   item->setIcon (QIcon::fromTheme ("edit-clear"));
0095   QFrame *frmcolors = new QFrame (this);
0096   item = addPage (frmcolors, i18n ("Colors"));
0097   item->setIcon (QIcon::fromTheme ("color-picker"));
0098   QFrame *frmchars = new QFrame (this);
0099   item = addPage (frmchars, i18n ("Strings"));
0100   item->setIcon (QIcon::fromTheme ("format-indent-less"));
0101   QFrame *frmsound = new QFrame (this);
0102   item = addPage (frmsound, i18n ("Sounds"));
0103   item->setIcon (QIcon::fromTheme ("media-playback-start"));
0104   QFrame *frmshortcuts = new QFrame (this);
0105   item = addPage (frmshortcuts, i18n ("Shortcuts"));
0106   item->setIcon (QIcon::fromTheme ("configure-shortcuts"));
0107 
0108   //page 1
0109   QGridLayout *winlayout = new QGridLayout (frmwindow);
0110    //always tabbar
0111   chkalwaystabbar = new QCheckBox (i18n ("S&how the tab bar even if not needed"), frmwindow);
0112   chkalwaystabbar->setWhatsThis( i18n ("If this is checked, the tab bar will "
0113       "always be shown. Otherwise, it will be hidden if it contains only one tab."));
0114    //auxiliary input
0115   chkauxinput = new QCheckBox (i18n ("Show au&xiliary input line"), frmwindow);
0116   chkauxinput->setWhatsThis( i18n ("You will have two input lines instead of one."));
0117    //always notify
0118   chkalwaysnotify = new QCheckBox (i18n ("&Always notify"), frmwindow);
0119   chkalwaysnotify->setWhatsThis( i18n ("If this is checked, output notification "
0120       "will be used whenever some text comes from the server. Otherwise, it will "
0121       "only be used when a notification trigger is activated. Note that this "
0122       "option only takes effect if global or local notification is enabled."));
0123    //global notify
0124   chkglobalnotify = new QCheckBox (i18n ("&Global notification"), frmwindow);
0125   chkglobalnotify->setWhatsThis( i18n ("When some text comes from the server "
0126       "and KMuddy is not currently active, window caption and the taskbar will "
0127       "try to attract your attention (some characters will blink there)."));
0128    //local notify
0129   chklocalnotify = new QCheckBox (i18n ("&Local notification"), frmwindow);
0130   chklocalnotify->setWhatsThis( i18n ("When some text comes from the server "
0131       "and this session is not currently active, its tab will try to attract "
0132       "your attention (some characters will blink there)."));
0133   
0134   //system tray
0135   chksystray = new QCheckBox (i18n ("Display system tray icon"), frmwindow);
0136   chksystray->setWhatsThis( i18n ("This option toggles the presence of the "
0137       "system tray icon. The icon can be used to hide the application window "
0138       "without taking up space in the taskbar. You can click on the icon "
0139       "to hide the window and then click again to restore it. "
0140       "Your connection will remain active even if the window is hidden "
0141       "and you will still receive notification messages. "));
0142 
0143   //passive popups
0144   chkpassivepopup = new QCheckBox (i18n ("Use passive popups"), frmwindow);
0145   chkpassivepopup->setWhatsThis( i18n ("This option toggles the use of "
0146       "passive popups. Passive popups appear near the system tray icon when you "
0147       "are in another window and alert you to the presence of activity in one "
0148       "of your connections. "));
0149   
0150   //auto-connect
0151   chkautoconnect = new QCheckBox (i18n ("Auto-connect on startup"), frmwindow);
0152   chkautoconnect->setWhatsThis( i18n ("With this option set, the selected "
0153       "connection will be automatically initiated immediately after starting "
0154       "KMuddy. Handy when you connect using one profile most of the time."));
0155   QLabel *lblac = new QLabel (i18n ("Auto-connect to:"), frmwindow);
0156   autoconnect = new QComboBox (frmwindow);
0157   lblac->setBuddy (autoconnect);
0158   autoconnect->setModel (cProfileManager::self()->model());
0159   connect (chkautoconnect, &QCheckBox::toggled, lblac, &QLabel::setEnabled);
0160   connect (chkautoconnect, &QCheckBox::toggled, autoconnect, &QLabel::setEnabled);
0161   
0162   // initial state
0163   chkautoconnect->setChecked (false);
0164   lblac->setEnabled (false);
0165   autoconnect->setEnabled (false);
0166   chksystray->setChecked (false);
0167 
0168    //add widgets to the layout
0169   winlayout->setSpacing (10);
0170   winlayout->addWidget (chkalwaystabbar, 0, 0, 1, 2);
0171   winlayout->addWidget (chkauxinput, 1, 0, 1, 2);
0172   winlayout->addWidget (chkalwaysnotify, 2, 0, 1, 2);
0173   winlayout->addWidget (chkglobalnotify, 3, 0, 1, 2);
0174   winlayout->addWidget (chklocalnotify, 4, 0, 1, 2);
0175   winlayout->addWidget (chksystray, 5, 0, 1, 2);
0176   winlayout->addWidget (chkpassivepopup, 6, 0, 1, 2);
0177   winlayout->addWidget (chkautoconnect, 7, 0, 1, 2);
0178   winlayout->addWidget (lblac, 8, 0);
0179   winlayout->addWidget (autoconnect, 8, 1);
0180   winlayout->setRowStretch (9, 10);
0181 
0182   //page 2
0183   QVBoxLayout *outlayout = new QVBoxLayout (frmoutputarea);
0184 
0185    //colors
0186   QWidget *wcolors = new QWidget (frmoutputarea);
0187   QGridLayout *wincolorlayout = new QGridLayout (wcolors);
0188   QStringList colorlist;
0189   for (int i = 0; i < 16; i++)
0190     colorlist.append (cltext[i]);
0191   QLabel *wcolorlabel[5];
0192     //bg color
0193   wcolorlabel[0] = new QLabel (i18n ("Default &background color"), wcolors);
0194   combo[0] = new QComboBox (wcolors);
0195   combo[0]->addItems (colorlist);
0196   combo[0]->setWhatsThis( i18n ("This color will be used as a standard background color."));
0197     //fg color
0198   wcolorlabel[1] = new QLabel (i18n ("Default &text color"), wcolors);
0199   combo[1] = new QComboBox (wcolors);
0200   combo[1]->addItems (colorlist);
0201   combo[1]->setWhatsThis( i18n ("This color will be used to display standard text with no defined color."));
0202     //echo color
0203   wcolorlabel[2] = new QLabel (i18n ("Command &echo color"), wcolors);
0204   combo[2] = new QComboBox (wcolors);
0205   combo[2]->addItems (colorlist);
0206   combo[2]->setWhatsThis( i18n ("This color will be used to display commands that you have entered."));
0207     //system color
0208   wcolorlabel[3] = new QLabel (i18n ("&System message color"), wcolors);
0209   combo[3] = new QComboBox (wcolors);
0210   combo[3]->addItems (colorlist);
0211   combo[3]->setWhatsThis( i18n ("This color will be used for various system messages."));
0212     //insert'em!
0213   wincolorlayout->setSpacing (10);
0214   for (int i = 0; i < 4; i++)
0215   {
0216     wcolorlabel[i]->setBuddy (combo[i]);
0217     wincolorlayout->addWidget (wcolorlabel[i], i, 0);
0218     wincolorlayout->addWidget (combo[i], i, 1);
0219   }
0220   wincolorlayout->setRowStretch (4, 10);
0221   wincolorlayout->setColumnStretch (2, 3);
0222 
0223   QFrame *outputs = new QFrame (frmoutputarea);
0224   QFrame *output1 = new QFrame (outputs);
0225   QFrame *output2 = new QFrame (outputs);
0226   QHBoxLayout *outputsLayout = new QHBoxLayout (outputs);
0227   outputsLayout->setSpacing (10);
0228   QGridLayout *output1Layout = new QGridLayout (output1);
0229   QVBoxLayout *output2Layout = new QVBoxLayout (output2);
0230   output1Layout->setSpacing (10);
0231   output2Layout->setSpacing (10);
0232   outputsLayout->addWidget (output1);
0233   outputsLayout->addWidget (output2);
0234 
0235    //indentation
0236   edindent = setupSpinbox (output1Layout, 0, 0, i18n ("&Indentation"), 0, 10, i18n ("None"),
0237       i18n ("When a line is too long, part of it will be moved to the next line. Indentation says how many spaces will be "
0238       "put to the beginning of the continued line."));
0239 
0240    //history size
0241   edhistory = setupSpinbox (output1Layout, 2, 0, i18n ("&History buffer size"), 100, 10000, QString(), i18n ("Size of output scroll-back buffer. "
0242       "Please note that this setting will only affect new connections, existing ones will keep their history setting."));
0243   edhistory->setSingleStep (100);
0244   edhistory->setSuffix (" " + i18n ("lines"));
0245 
0246    //cmd echo and system messages
0247   chkcmdecho = new QCheckBox (i18n ("Enable co&mmand echo"), output2);
0248   chkcmdecho->setWhatsThis( i18n ("Enables displaying of commands in the "
0249       "console.<p><b>Please note:</b> This will also disable command echo "
0250       "in session transcript."));
0251   chkmessages = new QCheckBox (i18n ("Enable s&ystem messages"), output2);
0252   chkmessages->setWhatsThis( i18n ("Enables displaying of system messages "
0253       "in the console."));
0254     //blinking
0255   chkblinking = new QCheckBox (i18n ("Enable b&linking"), output2);
0256   chkblinking->setWhatsThis( i18n ("Enables support for blinking. Currently not supported."));
0257   chkblinking->setEnabled (false);   // currently not supported
0258   
0259   output2Layout->addWidget (chkcmdecho);
0260   output2Layout->addWidget (chkmessages);
0261   output2Layout->addWidget (chkblinking);
0262 
0263    //add widgets to main layout
0264   outlayout->setSpacing (10);
0265   outlayout->addWidget (wcolors);
0266   outlayout->addWidget (outputs);
0267   outlayout->addStretch (1);
0268 
0269   //page 3
0270   QGridLayout *fontlayout = new QGridLayout (frmfont);
0271    //row 1
0272   QLabel *fl1 = new QLabel (i18n ("&Server output"), frmfont);
0273   fonted1 = new QLabel (frmfont);
0274   fonted1->setFrameStyle (QFrame::StyledPanel | QFrame::Sunken);
0275   QPushButton *bfont1 = new QPushButton (i18n ("Choose..."), frmfont);
0276   fl1->setBuddy (bfont1);
0277   connect (bfont1, &QPushButton::clicked, this, &dlgAppSettings::fontchooser1);
0278   QString serveroutput = i18n ("Here you can select a font that will be used for main display.");
0279   fonted1->setWhatsThis( serveroutput);
0280   bfont1->setWhatsThis( serveroutput);
0281    //row 2  
0282   QLabel *fl2 = new QLabel (i18n ("&Input line"), frmfont);
0283   fonted2 = new QLabel (frmfont);
0284   fonted2->setFrameStyle (QFrame::StyledPanel | QFrame::Sunken);
0285   QPushButton *bfont2 = new QPushButton (i18n ("Choose..."), frmfont);
0286   fl2->setBuddy (bfont2);
0287   connect (bfont2, &QPushButton::clicked, this, &dlgAppSettings::fontchooser2);
0288   QString inputline = i18n ("Here you can select a font that will be used for the input line.");
0289   fonted2->setWhatsThis( inputline);
0290   bfont2->setWhatsThis( inputline);
0291    //row 3
0292   QLabel *fl3 = new QLabel (i18n ("&Multi-line input"), frmfont);
0293   fonted3 = new QLabel (frmfont);
0294   fonted3->setFrameStyle (QFrame::StyledPanel | QFrame::Sunken);
0295   QPushButton *bfont3 = new QPushButton (i18n ("Choose..."), frmfont);
0296   fl3->setBuddy (bfont3);
0297   connect (bfont3, &QPushButton::clicked, this, &dlgAppSettings::fontchooser3);
0298   QString minputline = i18n ("Here you can select a font that will be used for the multi-line input window.");
0299   fonted3->setWhatsThis( minputline);
0300   bfont3->setWhatsThis( minputline);
0301    //place widgets
0302   fontlayout->setSpacing (10);
0303   fontlayout->setColumnStretch (1, 10);
0304   fontlayout->addWidget (fl1, 0, 0);
0305   fontlayout->addWidget (fl2, 1, 0);
0306   fontlayout->addWidget (fl3, 2, 0);
0307   fontlayout->addWidget (fonted1, 0, 1);
0308   fontlayout->addWidget (fonted2, 1, 1);
0309   fontlayout->addWidget (fonted3, 2, 1);
0310   fontlayout->addWidget (bfont1, 0, 2);
0311   fontlayout->addWidget (bfont2, 1, 2);
0312   fontlayout->addWidget (bfont3, 2, 2);
0313   fontlayout->setRowStretch (3, 10);
0314 
0315   //page 4
0316   QVBoxLayout *inputlayout = new QVBoxLayout (frminput);
0317   chkkeeptext = new QCheckBox (i18n ("&Keep sent text"), frminput);
0318   chkkeeptext->setWhatsThis( i18n ("If you enable this option, commands "
0319         "will remain in the input line after you send them (by pressing "
0320         "ENTER); otherwise it will be cleared."));
0321   chkselectkepttext = new QCheckBox (i18n ("&Select kept text after it's sent"), frminput);
0322   chkselectkepttext->setWhatsThis( i18n ("If you enable this option, entered "
0323         "command will be selected. This allows you to immediately type another "
0324         "command without deleting the old one and still be able to reuse previous "
0325         "command easily."));
0326   connect (chkkeeptext, &QCheckBox::toggled, chkselectkepttext, &QCheckBox::setEnabled);
0327   chkarrowshistory = new QCheckBox (i18n ("&Cursor keys browse history"), frminput);
0328   chkarrowshistory->setWhatsThis( i18n ("If you enable this option, you "
0329         "will be able to choose previously entered commands with Up and Down keys."));
0330   chktelnetpaste = new QCheckBox (i18n ("Telnet-style &paste"), frminput);
0331   chktelnetpaste->setWhatsThis( i18n ("Enables telnet-style pasting, i.e. "
0332       "if multi-line text is pasted, all lines but the last are sent as "
0333       "commands immediately."));
0334   chktrimspaces = new QCheckBox (i18n ("T&rim spaces"), frminput);
0335   chktrimspaces->setWhatsThis( i18n ("Enables trimming of spaces from "
0336       "commands. Note that with this option disabled, you should avoid "
0337       "including spaces when typing multiple commands on one line, or you "
0338       "will encounter problems with special sequences not being detected "
0339       "properly."));
0340   chkautocompletion = new QCheckBox (i18n ("Enable &auto-completion"), frminput);
0341   QString autocompldesc = i18n ("Auto-completion is a feature that offers "
0342       "you possible completions for commands, as you type them. It can also "
0343       "finish the command for you.");
0344   chkautocompletion->setWhatsThis( autocompldesc);
0345    //combos widget
0346   QWidget *inputcombos = new QWidget (frminput);
0347   QGridLayout *inputcombolayout = new QGridLayout (inputcombos);
0348     //AC type
0349   QLabel *inputlabel1 = new QLabel (i18n ("T&ype of auto-completion"), inputcombos);
0350   comboactype = new QComboBox (inputcombos);
0351   comboactype->addItem (i18n ("Auto-fill"));
0352   comboactype->addItem (i18n ("Shortest-match auto-fill"));
0353   comboactype->addItem (i18n ("Popup list-box"));
0354   comboactype->setWhatsThis( autocompldesc);
0355   connect (chkautocompletion, &QCheckBox::toggled, comboactype, &QComboBox::setEnabled);
0356     //bg color
0357   QLabel *inputlabel2 = new QLabel (i18n ("&Background color"), inputcombos);
0358   comboinputbkcolor = new QComboBox (inputcombos);
0359   comboinputbkcolor->addItems (colorlist);
0360   comboinputbkcolor->setWhatsThis( i18n ("Background color of the input line"));
0361     //fg color
0362   QLabel *inputlabel3 = new QLabel (i18n ("&Text color"), inputcombos);
0363   comboinputcolor = new QComboBox (inputcombos);
0364   comboinputcolor->addItems (colorlist);
0365   comboinputcolor->setWhatsThis( i18n ("Color of text that you type in the input line."));
0366     //set buddies...
0367   inputlabel1->setBuddy (comboactype);
0368   inputlabel2->setBuddy (comboinputbkcolor);
0369   inputlabel3->setBuddy (comboinputcolor);
0370     //place widgets...
0371   inputcombolayout->addWidget (inputlabel1, 0, 0);
0372   inputcombolayout->addWidget (inputlabel2, 1, 0);
0373   inputcombolayout->addWidget (inputlabel3, 2, 0);
0374   inputcombolayout->addWidget (comboactype, 0, 1);
0375   inputcombolayout->addWidget (comboinputbkcolor, 1, 1);
0376   inputcombolayout->addWidget (comboinputcolor, 2, 1);
0377   inputcombolayout->setSpacing (10);
0378   inputcombolayout->setRowStretch (3, 10);
0379   inputcombolayout->setColumnStretch (2, 3);
0380     //swap ENTERS
0381   chkswapenters = new QCheckBox (i18n ("S&wap ENTER and CTRL+ENTER for multi-line"), frminput);
0382   chkswapenters->setWhatsThis( i18n ("When turned off, CTRL+ENTER will insert another "
0383       "line in the multi-line input line, and ENTER will send commands to the server. "
0384       "If turned on, then the behaviour of these keys gets swapped."));
0385    //place widgets on the page
0386   inputlayout->addWidget (chkkeeptext);
0387   inputlayout->addWidget (chkselectkepttext);
0388   inputlayout->addWidget (chkarrowshistory);
0389   inputlayout->addWidget (chktelnetpaste);
0390   inputlayout->addWidget (chktrimspaces);
0391   inputlayout->addWidget (chkautocompletion);
0392   inputlayout->addWidget (inputcombos);
0393   inputlayout->addWidget (chkswapenters);
0394   inputlayout->setSpacing (10);
0395   inputlayout->addStretch (10);
0396 
0397   //page 5
0398   QHBoxLayout *colorlayout = new QHBoxLayout (frmcolors);
0399   colorlayout->setSpacing (10);
0400   QGroupBox *colorsbox1 = new QGroupBox (i18n ("Dark colors"), frmcolors);
0401   QGroupBox *colorsbox2 = new QGroupBox (i18n ("Bright colors"), frmcolors);
0402   QVBoxLayout *colors1layout = new QVBoxLayout (colorsbox1);
0403   QVBoxLayout *colors2layout = new QVBoxLayout (colorsbox2);
0404   QGroupBox *parentbox = colorsbox1;
0405   QVBoxLayout *parentlayout = colors1layout;
0406   for (int i = 0; i < 16; i++)
0407   {
0408     // Move to the second layout at the half
0409     if (i == 8) {
0410       parentbox = colorsbox2;
0411       parentlayout = colors2layout;
0412     }
0413     QWidget *colorboxn = new QWidget (parentbox);
0414     QVBoxLayout *layout = new QVBoxLayout (colorboxn);
0415     QLabel *l = new QLabel (cltext[i], colorboxn);
0416     cbutton[i] = new KColorButton (colorboxn);
0417     layout->addWidget(l, 2);
0418     layout->addWidget(cbutton[i], 1);
0419     parentlayout->addWidget (colorboxn);
0420   }
0421   colorlayout->addWidget (colorsbox1);
0422   colorlayout->addWidget (colorsbox2);
0423   
0424   //page 6
0425   QGridLayout *charlayout = new QGridLayout (frmchars);
0426    //row 1
0427   QLabel *chl1 = new QLabel (i18n ("&Command separator string"), frmchars);
0428   edcmdseparator = new QLineEdit (frmchars);
0429   chl1->setBuddy (edcmdseparator);
0430   edcmdseparator->setWhatsThis( i18n ("You can enter multiple commands at "
0431         "once, they will get executed together. Here you can enter string "
0432         "that can be used to separate individual commands."));
0433    //row 2  
0434   QLabel *chl2 = new QLabel (i18n ("&Speed-walk string"), frmchars);
0435   edspeedwalk = new QLineEdit (frmchars);
0436   chl2->setBuddy (edspeedwalk);
0437   edspeedwalk->setWhatsThis( i18n ("If you start a command with this string, "
0438         "the command will be interpreted as speed-walking. Every character "
0439         "is treated as one command: n, s, w, e, j(=ne), k(=se), l(=sw), m(=nw), u, d."
0440         "<p>Commands that will be sent for each direction can be set up in "
0441         "<i>MUD preferences</i> (<b>profile-based</b> connections only)."));
0442    //row 3
0443   chkemptywalk = new QCheckBox (i18n ("S&peed-walk even if empty"), frmchars);
0444   chkemptywalk->setWhatsThis( i18n ("Enabling this will cause KMuddy to "
0445         "expand speed-walk strings even if no speed-walk string has been "
0446         "given. This allows faster speed-walking, but keep in mind that "
0447         "EVERY command that consists only of valid speed-walk characters "
0448         "(news, for example) will be treated as speed-walking. To avoid "
0449         "this, you'll have to type at least one character in upper-case."));
0450    //row 4
0451   QLabel *chl3 = new QLabel (i18n ("Macro-ca&ll string"), frmchars);
0452   edscript = new QLineEdit (frmchars);
0453   chl3->setBuddy (edscript);
0454   edscript->setWhatsThis( i18n ("If you start a command with this string, "
0455         "the command will be interpreted as a macro-call.<br>"
0456         "Syntax is &lt;this string&gt; &lt;command&gt; "
0457         "[parameters]  (/exec calls external scripts)"));
0458    //row 5
0459   QLabel *chl4 = new QLabel (i18n ("&Repeater string"), frmchars);
0460   edmulticmd = new QLineEdit (frmchars);
0461   chl4->setBuddy (edmulticmd);
0462   edmulticmd->setWhatsThis( i18n ("Allows you to repeat some command. For "
0463         "example, typing <i>#10 say hello</i> sends that command 10 times. "
0464         "<br>Note that this also works with aliases and macro execution.<br>"
0465         "Repeater and number may be separated by a space (spaces)."));
0466 
0467     //row 6
0468   QLabel *chl5 = new QLabel (i18n ("&Focus string"), frmchars);
0469   edfocus = new QLineEdit (frmchars);
0470   chl5->setBuddy (edfocus);
0471   edfocus->setWhatsThis( i18n("If a command is started with this string, "
0472         "the command will be interpreted as a command-focus-call. This will "
0473         "allow you to send commands to other connected characters.<br>"
0474         "Syntax is &lt;this string&gt; &lt;focus tab&gt; &lt;this string&gt; &lt;command&gt;" ));
0475 
0476     //row 7
0477   QLabel *chl6 = new QLabel (i18n ("Send &as-is"), frmchars);
0478   ednoparse = new QLineEdit (frmchars);
0479   chl6->setBuddy (ednoparse);
0480   ednoparse->setWhatsThis( i18n("If a command is started with this string, "
0481         "it will be sent as-is, without any parsing. This string will be removed first." ));
0482 
0483    //row 8
0484   chkexpandBS = new QCheckBox (i18n ("&Expand backslashes"), frmchars);
0485   chkexpandBS->setWhatsThis( i18n ("This will enable backslash expansion, "
0486       "that is: \\n is end-of-line, \\t is TAB, \\\\ is \\, \\<anything else> "
0487       "means <anything else>."));
0488 
0489    //place widgets
0490   charlayout->setSpacing (10);
0491   charlayout->setColumnStretch (2, 10);
0492   charlayout->addWidget (chl1, 0, 0);
0493   charlayout->addWidget (chl2, 1, 0);
0494   charlayout->addWidget (chl3, 3, 0);
0495   charlayout->addWidget (chl4, 4, 0);
0496   charlayout->addWidget (chl5, 5, 0);
0497   charlayout->addWidget (chl6, 6, 0);
0498   charlayout->addWidget (edcmdseparator, 0, 1);
0499   charlayout->addWidget (edspeedwalk, 1, 1);
0500   charlayout->addWidget (edscript, 3, 1);
0501   charlayout->addWidget (edmulticmd, 4, 1);
0502   charlayout->addWidget (edfocus, 5, 1);
0503   charlayout->addWidget (ednoparse, 6, 1);
0504   charlayout->addWidget (chkemptywalk, 2, 0, 1, 2);
0505   charlayout->addWidget (chkexpandBS, 7, 0, 1, 2);
0506 
0507   //page 7
0508   QVBoxLayout *soundlayout = new QVBoxLayout (frmsound);
0509   chkallowmsp = new QCheckBox (i18n ("&Enable sounds globally"), frmsound);
0510   chkallowmsp->setWhatsThis( i18n ("<qt>Enable playing sounds for all connections.\n"
0511       "Note that you can override this setting in MUD Preferences dialog.\n"
0512       "Also note that this will only work if your MUD supports <b>MSP</b> "
0513       "(MUD Sound Protocol).</qt>"));
0514   chkallowdownloads = new QCheckBox (i18n ("Allow &downloading sounds"), frmsound);
0515   QString localdir = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/sounds/";
0516   chkallowdownloads->setWhatsThis( i18n ("MSP version 0.3 supports "
0517       "downloading of sound files directly from the web or FTP. You can "
0518       "enable this functionality here. Note that every sound will only be "
0519       "downloaded once. The downloaded files are stored in your homedir in "
0520       "directory\n") + QString (localdir));
0521   dirlist = new cDirList (frmsound);
0522 
0523   soundlayout->setSpacing (5);
0524   soundlayout->addWidget (chkallowmsp);
0525   soundlayout->addWidget (chkallowdownloads);
0526   soundlayout->addWidget (dirlist);
0527 
0528   //page 8
0529    //layout ensures that the widget fills entire available space...
0530   QHBoxLayout *keylayout = new QHBoxLayout (frmshortcuts);
0531   keys = new KShortcutsEditor (cActionManager::self()->getACol (), frmshortcuts);
0532   keylayout->addWidget (keys);
0533 
0534   cActionManager::self()->invokeEvent ("dialog-create", 0, "app-prefs");
0535 
0536   //then we connect() all its signals - this handles everything that the dialog offers...
0537   connect (this, &dlgAppSettings::accepted, this, &dlgAppSettings::getSettingsFromDialog);
0538   connect (button (QDialogButtonBox::Apply), &QPushButton::clicked, this, &dlgAppSettings::getSettingsFromDialog);
0539 }
0540 
0541 dlgAppSettings::~dlgAppSettings()
0542 {
0543   delete keys;
0544   cDialogList::self()->removeDialog ("app-prefs");
0545 }
0546 
0547 QSize dlgAppSettings::sizeHint() const
0548 {
0549   return QSize (600, 400);
0550 }
0551 
0552 int dlgAppSettings::getcolorindex (int which)
0553 {
0554   if ((which >= 0) && (which <= 3))
0555     return combo[which]->currentIndex ();
0556   return 0;
0557 }
0558 
0559 void dlgAppSettings::setcolorindex (int which, int value)
0560 {
0561   if ((which >= 0) && (which <= 3) && (value >= 0) && (value <= 15))
0562     combo[which]->setCurrentIndex (value);
0563 }
0564 
0565 bool dlgAppSettings::cmdEcho ()
0566 {
0567   return chkcmdecho->isChecked ();
0568 }
0569 
0570 bool dlgAppSettings::messages ()
0571 {
0572   return chkmessages->isChecked ();
0573 }
0574 
0575 void dlgAppSettings::setCmdEcho (bool value)
0576 {
0577   chkcmdecho->setChecked (value);
0578 }
0579 
0580 void dlgAppSettings::setMessages (bool value)
0581 {
0582   chkmessages->setChecked (value);
0583 }
0584 
0585 void dlgAppSettings::setIndentation (int value)
0586 {
0587   edindent->setValue (value);
0588 }
0589 
0590 int dlgAppSettings::indentation ()
0591 {
0592   return edindent->value ();
0593 }
0594 
0595 void dlgAppSettings::setHistory (int value)
0596 {
0597   edhistory->setValue (value);
0598 }
0599 
0600 int dlgAppSettings::history ()
0601 {
0602   return edhistory->value ();
0603 }
0604 
0605 bool dlgAppSettings::enableBlinking ()
0606 {
0607   return chkblinking->isChecked ();
0608 }
0609 
0610 void dlgAppSettings::setEnableBlinking (bool value)
0611 {
0612   chkblinking->setChecked (value);
0613 }
0614 
0615 bool dlgAppSettings::alwaysTabBar ()
0616 {
0617   return chkalwaystabbar->isChecked ();
0618 }
0619 
0620 void dlgAppSettings::setAlwaysTabBar (bool value)
0621 {
0622   chkalwaystabbar->setChecked (value);
0623 }
0624 
0625 bool dlgAppSettings::auxInput ()
0626 {
0627   return chkauxinput->isChecked ();
0628 }
0629 
0630 void dlgAppSettings::setAuxInput (bool val)
0631 {
0632   chkauxinput->setChecked (val);
0633 }
0634 
0635 bool dlgAppSettings::alwaysNotify ()
0636 {
0637   return chkalwaysnotify->isChecked ();
0638 }
0639 
0640 void dlgAppSettings::setAlwaysNotify (bool value)
0641 {
0642   chkalwaysnotify->setChecked (value);
0643 }
0644 
0645 bool dlgAppSettings::localNotify ()
0646 {
0647   return chklocalnotify->isChecked ();
0648 }
0649 
0650 void dlgAppSettings::setLocalNotify (bool value)
0651 {
0652   chklocalnotify->setChecked (value);
0653 }
0654 
0655 bool dlgAppSettings::globalNotify ()
0656 {
0657   return chkglobalnotify->isChecked ();
0658 }
0659 
0660 void dlgAppSettings::setGlobalNotify (bool value)
0661 {
0662   chkglobalnotify->setChecked (value);
0663 }
0664 
0665 bool dlgAppSettings::sysTrayEnabled ()
0666 {
0667   return chksystray->isChecked ();
0668 }
0669 
0670 bool dlgAppSettings::passivePopup ()
0671 {
0672   return chkpassivepopup->isChecked();
0673 }
0674 
0675 void dlgAppSettings::setSysTrayEnabled (bool value){
0676   chksystray->setChecked (value);
0677 }
0678 
0679 void dlgAppSettings::setPassivePopup (bool value){
0680   chkpassivepopup->setChecked (value);
0681 }
0682 
0683 QString dlgAppSettings::autoConnect ()
0684 {
0685   if (!chkautoconnect->isChecked())  //no auto-connect
0686     return QString();
0687   return cProfileManager::self()->profileList()[autoconnect->currentIndex ()];
0688 }
0689 
0690 void dlgAppSettings::setAutoConnect (const QString &ac)
0691 {
0692   chkautoconnect->setChecked (false);
0693   if (ac.isEmpty()) return;
0694   int pos = cProfileManager::self()->profileList().indexOf (ac);
0695   if (pos == -1) return;  // no such profile
0696   chkautoconnect->setChecked (true);
0697   autoconnect->setCurrentIndex (pos);
0698 }
0699 
0700 void dlgAppSettings::fontchooser1 ()
0701 {
0702   bool ok;
0703   font[0] = QFontDialog::getFont (&ok, font[0], this, QString(), QFontDialog::MonospacedFonts);
0704   if (ok)
0705     fonted1->setText (font[0].family() + ", " +
0706           QString::number(font[0].pointSize()) +
0707           (font[0].bold() ? (" " + i18n("Bold")) : (QString) "") +
0708           (font[0].italic() ? (" " + i18n("Italic")) : (QString) ""));
0709 }
0710 
0711 void dlgAppSettings::fontchooser2 ()
0712 {
0713   bool ok;
0714   font[1] = QFontDialog::getFont (&ok, font[1], this);
0715   if (ok)
0716     fonted2->setText (font[1].family() + ", " +
0717           QString::number(font[1].pointSize()) +
0718           (font[1].bold() ? (" " + i18n("Bold")) : (QString) "") +
0719           (font[1].italic() ? (" " + i18n("Italic")) : (QString) ""));
0720 }
0721 
0722 void dlgAppSettings::fontchooser3 ()
0723 {
0724   bool ok;
0725   font[2] = QFontDialog::getFont (&ok, font[2], this);
0726   if (ok)
0727     fonted3->setText (font[2].family() + ", " +
0728           QString::number(font[2].pointSize()) +
0729           (font[2].bold() ? (" " + i18n("Bold")) : (QString) "") +
0730           (font[2].italic() ? (" " + i18n("Italic")) : (QString) ""));
0731 }
0732 
0733 void dlgAppSettings::setFont1 (QFont f)
0734 {
0735   font[0] = f;
0736   fonted1->setText (font[0].family() + ", " +
0737         QString::number(font[0].pointSize()) +
0738         (font[0].bold() ? (" " + i18n("Bold")) : (QString) "") +
0739         (font[0].italic() ? (" " + i18n("Italic")) : (QString) ""));
0740 }
0741 
0742 void dlgAppSettings::setFont2 (QFont f)
0743 {
0744   font[1] = f;
0745   fonted2->setText (font[1].family() + ", " +
0746         QString::number(font[1].pointSize()) +
0747         (font[1].bold() ? (" " + i18n("Bold")) : (QString) "") +
0748         (font[1].italic() ? (" " + i18n("Italic")) : (QString) ""));
0749 }
0750 
0751 void dlgAppSettings::setFont3 (QFont f)
0752 {
0753   font[2] = f;
0754   fonted3->setText (font[2].family() + ", " +
0755         QString::number(font[2].pointSize()) +
0756         (font[2].bold() ? (" " + i18n("Bold")) : (QString) "") +
0757         (font[2].italic() ? (" " + i18n("Italic")) : (QString) ""));
0758 }
0759 
0760 QFont dlgAppSettings::font1 ()
0761 {
0762   return font[0];
0763 }
0764 
0765 QFont dlgAppSettings::font2 ()
0766 {
0767   return font[1];
0768 }
0769 
0770 QFont dlgAppSettings::font3 ()
0771 {
0772   return font[2];
0773 }
0774 
0775 bool dlgAppSettings::keeptext ()
0776 {
0777   return chkkeeptext->isChecked ();
0778 }
0779 
0780 bool dlgAppSettings::selectkepttext ()
0781 {
0782   return chkselectkepttext->isChecked ();
0783 }
0784 
0785 bool dlgAppSettings::arrowsHistory ()
0786 {
0787   return chkarrowshistory->isChecked ();
0788 }
0789 
0790 bool dlgAppSettings::autocompletion ()
0791 {
0792   return chkautocompletion->isChecked ();
0793 }
0794 
0795 void dlgAppSettings::setKeepText (bool value)
0796 {
0797   chkkeeptext->setChecked (value);
0798   chkselectkepttext->setEnabled (value);
0799 }
0800 
0801 void dlgAppSettings::setSelectKeptText (bool value)
0802 {
0803   chkselectkepttext->setChecked (value);
0804 }
0805 
0806 void dlgAppSettings::setArrowsHistory (bool value)
0807 {
0808   chkarrowshistory->setChecked (value);
0809 }
0810 
0811 void dlgAppSettings::setAutoCompletion (bool value)
0812 {
0813   chkautocompletion->setChecked (value);
0814   comboactype->setEnabled (value);
0815 }
0816 
0817 int dlgAppSettings::actype ()
0818 {
0819   return comboactype->currentIndex ();
0820 }
0821 
0822 bool dlgAppSettings::telnetPaste ()
0823 {
0824   return chktelnetpaste->isChecked ();
0825 }
0826 
0827 void dlgAppSettings::setTelnetPaste (bool value)
0828 {
0829   chktelnetpaste->setChecked (value);
0830 }
0831 
0832 bool dlgAppSettings::trimSpaces ()
0833 {
0834   return chktrimspaces->isChecked ();
0835 }
0836 
0837 void dlgAppSettings::setTrimSpaces (bool value)
0838 {
0839   chktrimspaces->setChecked (value);
0840 }
0841 
0842 int dlgAppSettings::inputbkcolor ()
0843 {
0844   return comboinputbkcolor->currentIndex ();
0845 }
0846 
0847 int dlgAppSettings::inputcolor ()
0848 {
0849   return comboinputcolor->currentIndex ();
0850 }
0851 
0852 void dlgAppSettings::setACType (int value)
0853 {
0854   comboactype->setCurrentIndex (value);
0855 }
0856 
0857 void dlgAppSettings::setInputBkColor (int value)
0858 {
0859   comboinputbkcolor->setCurrentIndex (value);
0860 }
0861 
0862 void dlgAppSettings::setInputColor (int value)
0863 {
0864   comboinputcolor->setCurrentIndex (value);
0865 }
0866 
0867 bool dlgAppSettings::swapEnters ()
0868 {
0869   return chkswapenters->isChecked ();
0870 }
0871 
0872 void dlgAppSettings::setSwapEnters (bool value)
0873 {
0874   chkswapenters->setChecked (value);
0875 }
0876 
0877 void dlgAppSettings::setColor (int i, QColor color)
0878 {
0879   cbutton[i]->setColor (color);
0880 }
0881 
0882 QColor dlgAppSettings::color (int i)
0883 {
0884   return cbutton[i]->color ();
0885 }
0886 
0887 QString dlgAppSettings::cmdseparator ()
0888 {
0889   return edcmdseparator->text().trimmed();
0890 }
0891 
0892 QString dlgAppSettings::speedwalk ()
0893 {
0894   return edspeedwalk->text().trimmed();
0895 }
0896 
0897 QString dlgAppSettings::script ()
0898 {
0899   return edscript->text().trimmed();
0900 }
0901 
0902 QString dlgAppSettings::multicmd ()
0903 {
0904   return edmulticmd->text().trimmed();
0905 }
0906 
0907 QString dlgAppSettings::focus ()
0908 {
0909   return edfocus->text().trimmed();
0910 }
0911 
0912 QString dlgAppSettings::noParse ()
0913 {
0914   return ednoparse->text().trimmed();
0915 }
0916 
0917 void dlgAppSettings::setCmdSeparator (QString what)
0918 {
0919   edcmdseparator->setText (what);
0920 }
0921 
0922 void dlgAppSettings::setSpeedWalk (QString what)
0923 {
0924   edspeedwalk->setText (what);
0925 }
0926 
0927 void dlgAppSettings::setScript (QString what)
0928 {
0929   edscript->setText (what);
0930 }
0931 
0932 void dlgAppSettings::setMultiCmd (QString what)
0933 {
0934   edmulticmd->setText (what);
0935 }
0936 
0937 void dlgAppSettings::setFocusCmd (QString what)
0938 {
0939   edfocus->setText (what);
0940 }
0941 
0942 void dlgAppSettings::setNoParse (QString what)
0943 {
0944   ednoparse->setText (what);
0945 }
0946 
0947 bool dlgAppSettings::allowEmptyWalkStr ()
0948 {
0949   return chkemptywalk->isChecked();
0950 }
0951 
0952 bool dlgAppSettings::expandBS ()
0953 {
0954   return chkexpandBS->isChecked();
0955 }
0956 
0957 void dlgAppSettings::setAllowEmptyWalkStr (bool val)
0958 {
0959   chkemptywalk->setChecked (val);
0960 }
0961 
0962 void dlgAppSettings::setExpandBS (bool val)
0963 {
0964   chkexpandBS->setChecked (val);
0965 }
0966 
0967 const QStringList & dlgAppSettings::soundDirs ()
0968 {
0969   return dirlist->getDirList();
0970 }
0971 
0972 bool dlgAppSettings::allowMSP ()
0973 {
0974   return chkallowmsp->isChecked ();
0975 }
0976 
0977 bool dlgAppSettings::allowDownloads ()
0978 {
0979   return chkallowdownloads->isChecked ();
0980 }
0981 
0982 void dlgAppSettings::setSoundDirs (const QStringList &list)
0983 {
0984   dirlist->setDirList(list);
0985 }
0986 
0987 void dlgAppSettings::setAllowMSP (bool val)
0988 {
0989   chkallowmsp->setChecked (val);
0990 }
0991 
0992 void dlgAppSettings::setAllowDownloads (bool val)
0993 {
0994   chkallowdownloads->setChecked (val);
0995 }
0996 
0997 void dlgAppSettings::getSettingsFromDialog ()
0998 {
0999   cGlobalSettings *gs = cGlobalSettings::self();
1000   gs->disableEvents ();  // prevent a save/update after each change
1001 
1002   //Window
1003   gs->setBool ("always-tab-bar", alwaysTabBar ());
1004   gs->setBool ("aux-input", auxInput ());
1005   gs->setBool ("always-notify", alwaysNotify ());
1006   gs->setBool ("local-notify", localNotify ());
1007   gs->setBool ("global-notify", globalNotify ());
1008   gs->setBool ("systray-enabled", sysTrayEnabled ());
1009   gs->setBool ("passive-popup", passivePopup());
1010   gs->setString ("auto-connect", autoConnect ());
1011 
1012   //Output area
1013   gs->setInt ("bg-color", getcolorindex (0));
1014   gs->setInt ("fg-color", getcolorindex (1));
1015   gs->setInt ("echo-color", getcolorindex (2));
1016   gs->setInt ("system-color", getcolorindex (3));
1017   gs->setBool ("allow-blink", enableBlinking ());
1018   gs->setBool ("command-echo", cmdEcho ());
1019   gs->setBool ("show-messages", messages ());
1020   gs->setInt ("indent", indentation ());
1021   gs->setInt ("history-size", history ());
1022 
1023   //Fonts
1024   gs->setFont ("console-font", font1 ());
1025   gs->setFont ("input-font", font2 ());
1026   gs->setFont ("multi-line-font", font3 ());
1027 
1028   //Input line
1029   gs->setBool ("keep-text", keeptext ());
1030   gs->setBool ("select-kept", selectkepttext ());
1031   gs->setBool ("cursors-browse", arrowsHistory ());
1032   gs->setBool ("auto-completion", autocompletion ());
1033   gs->setInt ("auto-completion-type", actype ());
1034   gs->setBool ("telnet-style-paste", telnetPaste ());
1035   gs->setBool ("trim-spaces", trimSpaces ());
1036   gs->setInt ("input-bg-color", inputbkcolor ());
1037   gs->setInt ("input-fg-color", inputcolor ());
1038   gs->setBool ("swap-enters", swapEnters ());
1039 
1040   //Colors
1041   for (int i = 0; i < 16; i++)
1042     gs->setColor ("color-" + QString::number (i), color (i));
1043 
1044   //Characters
1045   gs->setString ("str-separator", cmdseparator ());
1046   gs->setString ("str-speedwalk", speedwalk ());
1047   gs->setString ("str-macro", script ());
1048   gs->setString ("str-multi", multicmd ());
1049   gs->setString ("str-focus", focus ());
1050   gs->setString ("str-noparse", noParse ());
1051   gs->setBool ("empty-walk", allowEmptyWalkStr ());
1052   gs->setBool ("expand-backslashes", expandBS ());
1053 
1054   //MSP
1055   QStringList sounddirs;
1056   sounddirs = soundDirs ();
1057   gs->setInt ("snd-path-count", sounddirs.size());
1058   QStringList::iterator it;
1059   int i = 0;
1060   for (it = sounddirs.begin(); it != sounddirs.end(); ++it) {
1061     gs->setString ("snd-path-"+QString::number(i), *it);
1062     ++i;
1063   }
1064   gs->setBool ("msp-allow", allowMSP ());
1065   gs->setBool ("msp-allow-downloads", allowDownloads ());
1066 
1067   //Shortcuts
1068   keys->save ();
1069 
1070   cActionManager::self()->invokeEvent ("dialog-save", 0, "app-prefs");
1071 
1072   //apply'em!
1073   gs->enableEvents ();
1074 }
1075 
1076 void dlgAppSettings::putSettingsToDialog ()
1077 {
1078   cGlobalSettings *gs = cGlobalSettings::self();
1079 
1080   //Window
1081   setAlwaysTabBar (gs->getBool ("always-tab-bar"));
1082   setAuxInput (gs->getBool ("aux-input"));
1083   setAlwaysNotify (gs->getBool ("always-notify"));
1084   setLocalNotify (gs->getBool ("local-notify"));
1085   setGlobalNotify (gs->getBool ("global-notify"));
1086   setSysTrayEnabled (gs->getBool ("systray-enabled"));
1087   setPassivePopup (gs->getBool ("passive-popup"));
1088   setAutoConnect (gs->getString ("auto-connect"));
1089 
1090   //Output area
1091   setcolorindex (0, gs->getInt ("bg-color"));
1092   setcolorindex (1, gs->getInt ("fg-color"));
1093   setcolorindex (2, gs->getInt ("echo-color"));
1094   setcolorindex (3, gs->getInt ("system-color"));
1095   setEnableBlinking (gs->getBool ("allow-blink"));
1096   setCmdEcho (gs->getBool ("command-echo"));
1097   setMessages (gs->getBool ("show-messages"));
1098   setIndentation (gs->getInt ("indent"));
1099   setHistory (gs->getInt ("history-size"));
1100 
1101   //Fonts
1102   setFont1 (gs->getFont ("console-font"));
1103   setFont2 (gs->getFont ("input-font"));
1104   setFont3 (gs->getFont ("multi-line-font"));
1105 
1106   //Input line
1107   setKeepText (gs->getBool ("keep-text"));
1108   setSelectKeptText (gs->getBool ("select-kept"));
1109   setArrowsHistory (gs->getBool ("cursors-browse"));
1110   setAutoCompletion (gs->getBool ("auto-completion"));
1111   setACType (gs->getInt ("auto-completion-type"));
1112   setTelnetPaste (gs->getBool ("telnet-style-paste"));
1113   setTrimSpaces (gs->getBool ("trim-spaces"));
1114   setInputBkColor (gs->getInt ("input-bg-color"));
1115   setInputColor (gs->getInt ("input-fg-color"));
1116   setSwapEnters (gs->getBool ("swap-enters"));
1117 
1118   //Colors
1119   for (int i = 0; i < 16; i++)
1120     setColor (i, gs->getColor("color-" + QString::number (i)));
1121 
1122   //Characters
1123   setCmdSeparator (gs->getString ("str-separator"));
1124   setSpeedWalk (gs->getString ("str-speedwalk"));
1125   setScript (gs->getString ("str-macro"));
1126   setMultiCmd (gs->getString ("str-multi"));
1127   setFocusCmd (gs->getString ("str-focus"));
1128   setNoParse (gs->getString ("str-noparse"));
1129   setAllowEmptyWalkStr (gs->getBool ("empty-walk"));
1130   setExpandBS (gs->getBool ("expand-backslashes"));
1131 
1132   //MSP
1133   QStringList sounddirs;
1134   for (int i = 0; i < gs->getInt ("snd-path-count"); ++i)
1135     sounddirs << gs->getString ("snd-path-"+QString::number(i));
1136   setSoundDirs (sounddirs);
1137   setAllowMSP (gs->getBool ("msp-allow"));
1138   setAllowDownloads (gs->getBool ("msp-allow-downloads"));
1139 
1140   //Shortcuts
1141   //--- NOTHING NEEDED ---
1142 }
1143 
1144 #include "moc_dlgappsettings.cpp"