rendered paste bodyIndex: kedit.cpp
===================================================================
--- kedit.cpp (revision 569598)
+++ kedit.cpp (working copy)
@@ -53,8 +53,9 @@
#include <klocale.h>
#include "ktextfiledlg.h"
#include "kedit.h"
-#include "misc.h"
#include "color.h"
+#include "color4.h"
+#include "misc.h"
#include "prefs.h"
#include <k3sconfig.h>
#include <kdebug.h>
@@ -67,9 +68,11 @@
int default_open = TopLevel::OPEN_READWRITE;
TopLevel::TopLevel (QWidget *, const char *name)
- : KMainWindow ( 0,name ), kspellconfigOptions(0),
+ : KMainWindow ( 0 ), kspellconfigOptions(0),
eframe(0), newWindow(false), kspell(0)
{
+ setObjectName(name);
+
if (!windowList)
{
windowList = new QList<TopLevel *>;
@@ -101,7 +104,7 @@
TopLevel::~TopLevel ()
{
- windowList->remove( this );
+ windowList->removeAll( this );
}
@@ -711,13 +714,13 @@
}
-void TopLevel::setGeneralStatusField(const QString &text){
+void TopLevel::setGeneralStatusField(const QString &text)
+{
+ statusbar_timer->stop();
- statusbar_timer->stop();
-
- statusBar()->changeItem(text,ID_GENERAL);
- statusbar_timer->start(10000,true); // single shot
-
+ statusBar()->changeItem(text,ID_GENERAL);
+ statusbar_timer->setSingleShot(true);
+ statusbar_timer->start(10000);
}
@@ -767,7 +770,7 @@
//
// Default subject string
//
- QString defaultsubject = name();
+ QString defaultsubject = objectName();
int index = defaultsubject.lastIndexOf('/');
if( index != -1)
defaultsubject = defaultsubject.right(defaultsubject.length() - index - 1 );
@@ -928,8 +931,8 @@
int dy = 0;
p->setFont(headerFont);
- int w = printFontMetrics.width("M");
#warning "QT4: Fix me!!!!!!!!!!!!!!!!!!!!!!!!!!"
+ //int w = printFontMetrics.width("M");
//p->setTabStops(8*w);
int page = 1;
@@ -1052,7 +1055,7 @@
QTextStream stream(&file);
QTextCodec *codec;
if (!encoding.isEmpty())
- codec = QTextCodec::codecForName(encoding.latin1());
+ codec = QTextCodec::codecForName(encoding.toLatin1());
else
codec = QTextCodec::codecForLocale();
stream.setCodec(codec);
@@ -1108,7 +1111,7 @@
QTextStream textStream(&file);
QTextCodec *codec;
if (!encoding.isEmpty())
- codec = QTextCodec::codecForName(encoding.latin1());
+ codec = QTextCodec::codecForName(encoding.toLatin1());
else
codec = QTextCodec::codecForLocale();
textStream.setCodec(codec);
@@ -1116,7 +1119,7 @@
eframe->saveText( &textStream, bSoftWrap );
file.close();
- if(file.status())
+ if(file.error())
{
KMessageBox::sorry(this, i18n("Could not save file."));
return KEDIT_RETRY;
@@ -1168,7 +1171,7 @@
void TopLevel::dragEnterEvent(QDragEnterEvent* e)
{
- e->accept(KUrl::List::canDecode(e->mimeData()));
+ e->setAccepted(KUrl::List::canDecode(e->mimeData()));
}
void TopLevel::dropEvent(QDropEvent* e)
@@ -1210,25 +1213,19 @@
void TopLevel::set_colors()
{
- QPalette mypalette = (eframe->palette()).copy();
+ QPalette mypalette = eframe->palette();
- QColorGroup ncgrp( mypalette.active() );
-
if (Prefs::customColor())
{
- ncgrp.setColor(QPalette::Text, Prefs::textColor());
- ncgrp.setColor(QPalette::Base, Prefs::backgroundColor());
+ mypalette.setColor(QPalette::Text, Prefs::textColor());
+ mypalette.setColor(QPalette::Base, Prefs::backgroundColor());
}
else
{
- ncgrp.setColor(QPalette::Text, KGlobalSettings::textColor());
- ncgrp.setColor(QPalette::Base, KGlobalSettings::baseColor());
+ mypalette.setColor(QPalette::Text, KGlobalSettings::textColor());
+ mypalette.setColor(QPalette::Base, KGlobalSettings::baseColor());
}
- mypalette.setActive(ncgrp);
- mypalette.setDisabled(ncgrp);
- mypalette.setInactive(ncgrp);
-
eframe->setPalette(mypalette);
}
@@ -1296,7 +1293,7 @@
const QString encoding = args->getOption("encoding");
const bool doEncoding = args->isSet("encoding") &&
- QTextCodec::codecForName(encoding.latin1());
+ QTextCodec::codecForName(encoding.toLatin1());
for(int i = 0; i < args->count(); i++)
{
@@ -1328,7 +1325,8 @@
spellConfig(_spellConfig), spellConfigChanged(false)
{
// Font
- QWidget *font = new QWidget(0, "FontSetting");
+ QWidget *font = new QWidget(0);
+ font->setObjectName("FontSetting");
QVBoxLayout *topLayout = new QVBoxLayout(font);
topLayout->setSpacing(KDialog::spacingHint());
topLayout->setMargin(0);
@@ -1338,7 +1336,8 @@
addPage(font, i18n("Font"), "fonts", i18n("Editor Font"));
// Color
- Color *color = new Color(0, "ColorSettings");
+ Color4 *color = new Color4(0);
+ color->setObjectName( "ColorSettings" );
addPage(color, i18n("Color"), "colorize", i18n("Text Color in Editor Area"));
// Spelling
Index: color4.cpp
===================================================================
--- color4.cpp (revision 0)
+++ color4.cpp (revision 0)
@@ -0,0 +1,26 @@
+/* This file is part of the KDE libraries
+
+ Copyright (C) 2006 Groningen Bertjan Broeksema <b.broeksema@gmail.com>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "color4.h"
+
+Color4::Color4( QWidget *parent = 0 ) : QWidget( parent )
+{
+ ui.setupUi(this);
+}
Index: color4.h
===================================================================
--- color4.h (revision 0)
+++ color4.h (revision 0)
@@ -0,0 +1,39 @@
+/* This file is part of the KDE libraries
+
+ Copyright (C) 2006 Groningen Bertjan Broeksema <b.broeksema@gmail.com>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef COLOR4_H
+#define COLOR4_H
+
+#include <QWidget>
+
+#include "ui_color4.h"
+
+class Color4 : public QWidget
+{
+ Q_OBJECT
+
+ public:
+ Color4(QWidget *);
+
+ private:
+ Ui::ColorUi ui;
+};
+
+#endif
Index: ktextfiledlg.cpp
===================================================================
--- ktextfiledlg.cpp (revision 569598)
+++ ktextfiledlg.cpp (working copy)
@@ -100,7 +100,7 @@
label->setText(i18n("Select encoding for text file: "));
encCombo = new QComboBox(vbox);
- encCombo->setInsertionPolicy(QComboBox::NoInsertion);
+ encCombo->setInsertPolicy(QComboBox::NoInsertion);
encCombo->addItem(i18n("Default Encoding"));
QStringList encodings = KGlobal::charsets()->descriptiveEncodingNames();
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt (revision 569598)
+++ CMakeLists.txt (working copy)
@@ -2,30 +2,33 @@
add_subdirectory( pixmaps )
-
-
-
########### next target ###############
-set(kedit_KDEINIT_SRCS kedit.cpp ktextfiledlg.cpp keditcl1.cpp keditcl2.cpp)
+set(kedit_KDEINIT_SRCS
+ kedit.cpp
+ ktextfiledlg.cpp
+ keditcl1.cpp
+ keditcl2.cpp
+ color4.cpp
+)
kde4_automoc(${kedit_KDEINIT_SRCS})
kde4_add_ui3_files(kedit_KDEINIT_SRCS misc.ui color.ui )
+kde4_add_ui_files(kedit_KDEINIT_SRCS color4.ui )
+
kde4_add_kcfg_files(kedit_KDEINIT_SRCS prefs.kcfgc )
kde4_add_kdeinit_executable( kedit ${kedit_KDEINIT_SRCS})
target_link_libraries(kdeinit_kedit ${KDE4_KDE3SUPPORT_LIBS} ${KDE4_KDEPRINT_LIBS} )
-install(TARGETS kdeinit_kedit DESTINATION ${LIB_INSTALL_DIR})
-
target_link_libraries( kedit kdeinit_kedit )
-install(TARGETS kedit DESTINATION ${BIN_INSTALL_DIR} )
########### install files ###############
-
+install( TARGETS kedit DESTINATION ${BIN_INSTALL_DIR} )
+install( TARGETS kdeinit_kedit DESTINATION ${LIB_INSTALL_DIR})
install( FILES KEdit.desktop DESTINATION ${XDG_APPS_DIR})
install( FILES kedit.kcfg DESTINATION ${KCFG_INSTALL_DIR})
install( FILES keditui.rc DESTINATION ${DATA_INSTALL_DIR}/kedit)