Commit 75b5aced authored by Robert Knight's avatar Robert Knight
Browse files

Merge changes from trunk

svn path=/branches/work/konsole-split-view/; revision=636033
parent 621cb945
......@@ -12,6 +12,10 @@ if(Q_WS_X11)
QT4_ADD_DBUS_INTERFACE( kcm_konsole_PART_SRCS ${kdesktop_background_xml} kdesktop_background_interface )
endif(Q_WS_X11)
set(klauncher_xml ${DBUS_INTERFACES_DIR}/org.kde.KLauncher.xml)
QT4_ADD_DBUS_INTERFACE( kcm_konsole_PART_SRCS ${klauncher_xml} klauncher_interface )
kde4_automoc(${kcm_konsole_PART_SRCS})
kde4_add_ui_files(kcm_konsole_PART_SRCS kcmkonsoledialog.ui sessiondialog.ui schemadialog.ui )
......
......@@ -19,8 +19,8 @@
#include <QLayout>
#include <QStringList>
#include <QTabWidget>
//Added by qt3to4:
#include <QVBoxLayout>
#include <QApplication>
#include <QtDBus/QtDBus>
......@@ -39,6 +39,7 @@
#include <QDesktopWidget>
#include "kdesktop_interface.h"
#endif
#include "klauncher_interface.h"
typedef KGenericFactory<KCMKonsole, QWidget> ModuleFactory;
K_EXPORT_COMPONENT_FACTORY( konsole, ModuleFactory("kcmkonsole") )
......@@ -95,22 +96,22 @@ void KCMKonsole::load()
void KCMKonsole::load(bool useDefaults)
{
KConfig config("konsolerc", true);
config.setDesktopGroup();
config.setReadDefaults(useDefaults);
KConfig configFile("konsolerc");
configFile.setReadDefaults(useDefaults);
dialog->terminalSizeHintCB->setChecked(config.readEntry("TerminalSizeHint", QVariant(false)).toBool());
bidiOrig = config.readEntry("EnableBidi", QVariant(false)).toBool();
const KConfigGroup config = configFile.group("Desktop Entry"); // DF: strange name for a config group
dialog->terminalSizeHintCB->setChecked(config.readEntry("TerminalSizeHint", false));
bidiOrig = config.readEntry("EnableBidi", false);
dialog->bidiCB->setChecked(bidiOrig);
dialog->matchTabWinTitleCB->setChecked(config.readEntry("MatchTabWinTitle", QVariant(false)).toBool());
dialog->warnCB->setChecked(config.readEntry("WarnQuit", QVariant(true)).toBool());
dialog->ctrldragCB->setChecked(config.readEntry("CtrlDrag", QVariant(true)).toBool());
dialog->cutToBeginningOfLineCB->setChecked(config.readEntry("CutToBeginningOfLine", QVariant(false)).toBool());
dialog->allowResizeCB->setChecked(config.readEntry("AllowResize", QVariant(false)).toBool());
xonXoffOrig = config.readEntry("XonXoff", QVariant(false)).toBool();
dialog->matchTabWinTitleCB->setChecked(config.readEntry("MatchTabWinTitle", false));
dialog->warnCB->setChecked(config.readEntry("WarnQuit", true));
dialog->ctrldragCB->setChecked(config.readEntry("CtrlDrag", true));
dialog->cutToBeginningOfLineCB->setChecked(config.readEntry("CutToBeginningOfLine", false));
dialog->allowResizeCB->setChecked(config.readEntry("AllowResize", false));
xonXoffOrig = config.readEntry("XonXoff", false);
dialog->xonXoffCB->setChecked(xonXoffOrig);
dialog->blinkingCB->setChecked(config.readEntry("BlinkingCursor", QVariant(false)).toBool());
dialog->frameCB->setChecked(config.readEntry("has frame", QVariant(true)).toBool());
dialog->blinkingCB->setChecked(config.readEntry("BlinkingCursor", false));
dialog->frameCB->setChecked(config.readEntry("has frame", true));
dialog->line_spacingSB->setValue(config.readEntry( "LineSpacing", 0 ));
dialog->silence_secondsSB->setValue(config.readEntry( "SilenceSeconds", 10 ));
dialog->word_connectorLE->setText(config.readEntry("wordseps",":@-./_~"));
......@@ -134,8 +135,8 @@ void KCMKonsole::save()
dialog->SessionEditor1->querySave();
}
KConfig config("konsolerc");
config.setDesktopGroup();
KConfig configFile("konsolerc");
KConfigGroup config = configFile.group("Desktop Entry"); // DF: strange name for a config group
config.writeEntry("TerminalSizeHint", dialog->terminalSizeHintCB->isChecked());
bool bidiNew = dialog->bidiCB->isChecked();
......@@ -169,19 +170,18 @@ void KCMKonsole::save()
#ifdef Q_WS_X11
// ### TODO check this (the object and interface don't exist yet at the time of this writing)
int konq_screen_number = KApplication::desktop()->primaryScreen();
int konq_screen_number = QApplication::desktop()->primaryScreen();
QByteArray appname;
if (konq_screen_number == 0)
appname = "org.kde.kdesktop";
else
appname = "org.kde.kdesktop-screen-" + QByteArray::number( konq_screen_number);
org::kde::kdesktop::Desktop desktop(appname, "/Desktop", QDBusConnection::sessionBus());
desktop.configure();
desktop.configure();
#endif
// ## Hmm, why do konsole sessions have something to do with klauncher's configuration? (David)
QDBusInterface klauncher("org.kde.klauncher", "/KLauncher", "org.kde.KLauncher");
if ( klauncher.isValid() )
klauncher.call( "reparseConfiguration" );
org::kde::KLauncher klauncher("org.kde.klauncher", "/KLauncher", QDBusConnection::sessionBus());
klauncher.reparseConfiguration();
if (xonXoffOrig != xonXoffNew)
{
......
......@@ -12,10 +12,13 @@ X-KDE-ParentApp=kcontrol
ServiceTypes=KCModule
Name=Konsole
Name[el]=Κονσόλα
Name[x-test]=xxKonsolexx
Comment=Konsole configuration module
Comment[el]=Άρθρωμα ρύθμισης Κονσόλας
Comment[fr]=Configuration de Konsole
Comment[x-test]=xxKonsole configuration modulexx
Keywords=konsole,schema,konsole background,colors,background,terminal application,terminal
Keywords[el]=κονσόλα,σχήμα,φόντο κονσόλας,χρώματα,φόντο,εφαρμογή τερματικού,τερματικό
Keywords[fr]=konsole,modèle,fond,couleurs,terminal
Keywords[x-test]=xxkonsole,schema,konsole background,colors,background,terminal application,terminalxx
......@@ -296,7 +296,7 @@
<number>0</number>
</property>
<item>
<widget class="Q3ListBox" name="schemaList" />
<widget class="QListWidget" name="schemaList" />
</item>
<item>
<widget class="QCheckBox" name="defaultSchemaCB" >
......
......@@ -21,39 +21,38 @@
#include "schemaeditor.h"
#include "schemaeditor.moc"
#include <kdebug.h>
#include <kstandarddirs.h>
#include <klocale.h>
#include <kfiledialog.h>
#include <kinputdialog.h>
#include <kmessagebox.h>
#include <kimageeffect.h>
#include <QtDBus/QtDBus>
#include <QLabel>
#include <QApplication>
#include <QLineEdit>
#include <QImage>
#include <QMatrix>
#include <QComboBox>
#include <QDesktopWidget>
//Added by qt3to4:
#include <QPixmap>
#include <QTextStream>
#include <kdebug.h>
#include <QCheckBox>
#include <kstandarddirs.h>
//#include <errno.h>
#include <QSlider>
#include <klocale.h>
#include <kfiledialog.h>
#include <kinputdialog.h>
#include <QToolButton>
#include <kmessagebox.h>
#include <kimageeffect.h>
#include <QImage>
#ifdef Q_WS_X11
#include <kdesktop_background_interface.h>
#endif
// SchemaListBoxText is a list box text item with schema filename
class SchemaListBoxText : public Q3ListBoxText
class SchemaListBoxText : public QListWidgetItem
{
public:
SchemaListBoxText(const QString &title, const QString &filename): Q3ListBoxText(title)
SchemaListBoxText(const QString &title, const QString &filename): QListWidgetItem(title)
{
m_filename = filename;
};
......@@ -80,7 +79,7 @@ SchemaEditor::SchemaEditor(QWidget * parent)
transparent.resize(20);
defaultSchema = "";
#ifdef Q_WS_X11
int konq_screen_number = KApplication::desktop()->primaryScreen();
int konq_screen_number = QApplication::desktop()->primaryScreen();
QByteArray appname;
if (konq_screen_number == 0)
appname = "org.kde.kdesktop";
......@@ -119,6 +118,7 @@ SchemaEditor::SchemaEditor(QWidget * parent)
connect(defaultSchemaCB, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
removeButton->setEnabled( schemaList->currentItem() );
load();
}
......@@ -126,7 +126,7 @@ QString SchemaEditor::schema()
{
QString filename = defaultSchema;
int i = schemaList->currentItem();
int i = schemaList->currentRow();
if (defaultSchemaCB->isChecked() && i>=0)
filename = ((SchemaListBoxText *) schemaList->item(i))->filename();
......@@ -147,7 +147,7 @@ void SchemaEditor::setSchema(QString sch)
oldSchema = sc;
if (sc == -1)
sc = 0;
schemaList->setCurrentItem(sc);
schemaList->setCurrentRow(sc);
// readSchema(sc);
}
......@@ -207,10 +207,9 @@ void SchemaEditor::getList()
}
}
void SchemaEditor::show()
void SchemaEditor::load()
{
getList();
SchemaDialog::show();
}
......@@ -221,7 +220,7 @@ void SchemaEditor::loadAllSchema(QString currentFile)
disconnect(schemaList, SIGNAL(highlighted(int)), this, SLOT(readSchema(int)));
schemaList->clear();
Q3ListBoxItem* currentItem = 0;
QListWidgetItem* currentItem = 0;
for (it = list.begin(); it != list.end(); ++it) {
QString name = (*it);
......@@ -229,18 +228,20 @@ void SchemaEditor::loadAllSchema(QString currentFile)
QString title = readSchemaTitle(name);
// Only insert new items so that local items override global
if (schemaList->findItem(title, Q3ListBox::ExactMatch) == 0) {
if (schemaList->findItems(title, Qt::MatchExactly).isEmpty()) {
if (title.isNull() || title.isEmpty())
title=i18n("untitled");
schemaList->insertItem(new SchemaListBoxText(title, name));
schemaList->addItem(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->model()->sort(0);
schemaList->setCurrentRow(0); // select the first added item correctly too
schemaList->setCurrentItem(currentItem);
//FIXME - This signal/slot is broken following Q3ListBox -> QListWidget change
connect(schemaList, SIGNAL(highlighted(int)), this, SLOT(readSchema(int)));
schemaListChanged();
}
......@@ -295,7 +296,7 @@ void SchemaEditor::slotColorChanged(int slot)
void SchemaEditor::removeCurrent()
{
int i = schemaList->currentItem();
int i = schemaList->currentRow();
if(i==-1)
return;
QString base = ((SchemaListBoxText *) schemaList->item(i))->filename();
......@@ -334,8 +335,8 @@ void SchemaEditor::saveCurrent()
slotColorChanged(0);
QString fullpath;
if (schemaList->currentText() == titleLine->text()) {
int i = schemaList->currentItem();
if (schemaList->currentItem()->text() == titleLine->text()) {
int i = schemaList->currentRow();
fullpath = ((SchemaListBoxText *) schemaList->item(i))->filename().section('/',-1);
}
else {
......@@ -519,9 +520,9 @@ void SchemaEditor::readSchema(int num)
if(schMod) {
disconnect(schemaList, SIGNAL(highlighted(int)), this, SLOT(readSchema(int)));
schemaList->setCurrentItem(oldSchema);
schemaList->setCurrentRow(oldSchema);
querySave();
schemaList->setCurrentItem(num);
schemaList->setCurrentRow(num);
connect(schemaList, SIGNAL(highlighted(int)), this, SLOT(readSchema(int)));
schMod=false;
}
......@@ -656,7 +657,7 @@ void SchemaEditor::readSchema(int num)
continue;
if (!(0 <= bo && bo <= 1))
continue;
color[fi] = kapp->palette().active().text();
color[fi] = qApp->palette().active().text();
transparent[fi] = tr;
bold[fi] = bo;
type[fi] = 1;
......@@ -671,7 +672,7 @@ void SchemaEditor::readSchema(int num)
continue;
if (!(0 <= bo && bo <= 1))
continue;
color[fi] = kapp->palette().active().base();
color[fi] = qApp->palette().active().base();
transparent[fi] = tr;
bold[fi] = bo;
type[fi] = 2;
......
......@@ -18,11 +18,6 @@
#ifndef SCHEMAEDITOR_H
#define SCHEMAEDITOR_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <kapplication.h>
#include <QWidget>
#include <QPixmap>
#include <QVector>
......@@ -66,11 +61,11 @@ class SchemaEditor : public SchemaDialog
void removeCurrent();
void getList();
private Q_SLOTS:
void show();
void schemaModified();
void loadAllSchema(QString currentFile="");
void updatePreview();
private:
void load();
bool schMod;
QVector<QColor> color;
QVector<int> type; // 0= custom, 1= sysfg, 2=sysbg, 3=rcolor
......
......@@ -226,7 +226,7 @@
<number>0</number>
</property>
<item>
<widget class="Q3ListBox" name="sessionList" />
<widget class="QListWidget" name="sessionList" />
</item>
<item>
<layout class="QGridLayout" >
......
......@@ -33,12 +33,13 @@
#include <kiconloader.h>
#include <krun.h>
#include <kshell.h>
#include <kdesktopfile.h>
// SessionListBoxText is a list box text item with session filename
class SessionListBoxText : public Q3ListBoxText
class SessionListBoxText : public QListWidgetItem
{
public:
SessionListBoxText(const QString &title, const QString &filename): Q3ListBoxText(title)
SessionListBoxText(const QString &title, const QString &filename): QListWidgetItem(title)
{
m_filename = filename;
};
......@@ -57,9 +58,7 @@ SessionEditor::SessionEditor(QWidget * parent)
loaded=false;
KGlobal::locale()->insertCatalog("konsole"); // For schema and keytab translations
//TODO - Look at this later
//KGlobal::iconLoader()->addAppDir( "konsole" );
KIconLoader::global()->addAppDir( "konsole" );
directoryLine->setMode(KFile::Directory);
connect(sessionList, SIGNAL(highlighted(int)), this, SLOT(readSession(int)));
......@@ -76,6 +75,7 @@ SessionEditor::SessionEditor(QWidget * parent)
connect(fontCombo, SIGNAL(activated(int)), this, SLOT(sessionModified()));
connect(keytabCombo, SIGNAL(activated(int)), this, SLOT(sessionModified()));
connect(schemaCombo, SIGNAL(activated(int)), this, SLOT(sessionModified()));
load();
}
SessionEditor::~SessionEditor()
......@@ -84,14 +84,14 @@ SessionEditor::~SessionEditor()
schemaFilename.setAutoDelete(true);
}
void SessionEditor::show()
void SessionEditor::load()
{
removeButton->setEnabled(sessionList->count()>1);
if (! loaded) {
loadAllKeytab();
loadAllSession();
readSession(0);
sessionList->setCurrentItem(0);
sessionList->setCurrentRow(0);
loaded = true;
}
SessionDialog::show();
......@@ -163,26 +163,24 @@ QString SessionEditor::readKeymapTitle(const QString & file)
void SessionEditor::loadAllSession(QString currentFile)
{
QStringList list = KGlobal::dirs()->findAllResources("data", "konsole/*.desktop", false, true);
QStringList list = KGlobal::dirs()->findAllResources("data", "konsole/*.desktop", KStandardDirs::NoDuplicates);
sessionList->clear();
Q3ListBoxItem* currentItem = 0;
QListWidgetItem* 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;
KDesktopFile co( name );
QString sesname = co.desktopGroup().readEntry("Name",i18n("Unnamed"));
sessionList->insertItem(new SessionListBoxText(sesname, name));
sessionList->addItem(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->model()->sort(0);
sessionList->setCurrentRow(0); // select the first added item correctly too
sessionList->setCurrentItem(currentItem);
emit getList();
}
......@@ -191,42 +189,41 @@ 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);
sessionList->setCurrentRow(oldSession);
querySave();
sessionList->setCurrentItem(num);
sessionList->setCurrentRow(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);
KDesktopFile desktopFile( ((SessionListBoxText *)sessionList->item(num))->filename());
KConfigGroup co = desktopFile.desktopGroup();
co->setDesktopGroup();
str = co->readEntry("Name");
str = co.readEntry("Name");
nameLine->setText(str);
str = co->readPathEntry("Cwd");
str = co.readPathEntry("Cwd");
directoryLine->lineEdit()->setText(str);
str = co->readPathEntry("Exec");
str = co.readPathEntry("Exec");
executeLine->setText(str);
str = co->readEntry("Icon","konsole");
str = co.readEntry("Icon","konsole");
previewIcon->setIcon(str);
i = co->readEntry("Font",(unsigned int)-1);
i = co.readEntry("Font",(unsigned int)-1);
fontCombo->setCurrentIndex(i+1);
str = co->readEntry("Term","xterm");
str = co.readEntry("Term","xterm");
termLine->setText(str);
str = co->readEntry("KeyTab","");
str = co.readEntry("KeyTab","");
i=0;
counter=0;
for (QString *it = keytabFilename.first(); it != 0; it = keytabFilename.next()) {
......@@ -236,7 +233,7 @@ void SessionEditor::readSession(int num)
}
keytabCombo->setCurrentIndex(i);
str = co->readEntry("Schema","");
str = co.readEntry("Schema","");
i=0;
counter=0;
for (QString *it = schemaFilename.first(); it != 0; it = schemaFilename.next()) {
......@@ -245,7 +242,6 @@ void SessionEditor::readSession(int num)
counter++;
}
schemaCombo->setCurrentIndex(i);
delete co;
}
sesMod=false;
oldSession=num;
......@@ -314,12 +310,12 @@ void SessionEditor::saveCurrent()
}
}
if (sessionList->currentText().isEmpty())
if (sessionList->currentItem()->text().isEmpty())
return;
QString fullpath;
if (sessionList->currentText() == nameLine->text()) {
fullpath = ( ((SessionListBoxText *)sessionList->item( sessionList->currentItem() ))->filename() ).section('/',-1);
if (sessionList->currentItem()->text() == nameLine->text()) {
fullpath = ( ((SessionListBoxText *)sessionList->currentItem())->filename() ).section('/',-1);
}
else {
// Only ask for a name for changed nameLine, considered a "save as"
......@@ -334,22 +330,21 @@ void SessionEditor::saveCurrent()
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());
KDesktopFile desktopFile(fullpath);
KConfigGroup co = desktopFile.desktopGroup();
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->currentIndex()==0)
co->writeEntry("Font","");
co.writeEntry("Font","");
else
co->writeEntry("Font",fontCombo->currentIndex()-1);
co->writeEntry("Term",termLine->text());
co->writeEntry("KeyTab",*keytabFilename.at(keytabCombo->currentIndex()));
co->writeEntry("Schema",*schemaFilename.at(schemaCombo->currentIndex()));
co->sync();
delete co;
co.writeEntry("Font",fontCombo->currentIndex()-1);
co.writeEntry("Term",termLine->text());
co.writeEntry("KeyTab",*keytabFilename.at(keytabCombo->currentIndex()));
co.writeEntry("Schema",*schemaFilename.at(schemaCombo->currentIndex()));
desktopFile.sync();
sesMod=false;
loadAllSession(fullpath.section('/',-1));
removeButton->setEnabled(sessionList->count()>1);
......@@ -357,7 +352,7 @@ void SessionEditor::saveCurrent()
void SessionEditor::removeCurrent()
{
QString base = ((SessionListBoxText *)sessionList->item( sessionList->currentItem() ))->filename();
QString base = ((SessionListBoxText *)sessionList->currentItem())->filename();
// Query if system sessions should be removed
if (KStandardDirs::locateLocal("data", "konsole/" + base.section('/', -1)) != base) {
......@@ -378,7 +373,7 @@ void SessionEditor::removeCurrent()
removeButton->setEnabled(sessionList->count()>1);
loadAllSession();
readSession(0);
sessionList->setCurrentItem(0);
sessionList->setCurrentRow(0);
}
void SessionEditor::sessionModified()
......
......@@ -18,13 +18,8 @@
#ifndef SESSIONEDITOR_H
#define SESSIONEDITOR_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <q3ptrlist.h>
#include <QStringList>
#include <kapplication.h>
#include <QWidget>
#include "ui_sessiondialog.h"
......@@ -61,7 +56,7 @@ class SessionEditor : public SessionDialog
void sessionModified();
private:
void show();
void load();
void loadAllKeytab();
void loadAllSession(QString currentFile="");
QString readKeymapTitle(const QString& filename);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment