author | drw <drw> | 2004-02-23 18:12:57 (UTC) |
---|---|---|
committer | drw <drw> | 2004-02-23 18:12:57 (UTC) |
commit | 398c7d54acfc203ec90644d6c63e5b200391e906 (patch) (side-by-side diff) | |
tree | 84a1f495a5a2450f7eb2f401037b6fd81162d72b | |
parent | f5762a3bee0ca4a176048f6552acaea2af827914 (diff) | |
download | opie-398c7d54acfc203ec90644d6c63e5b200391e906.zip opie-398c7d54acfc203ec90644d6c63e5b200391e906.tar.gz opie-398c7d54acfc203ec90644d6c63e5b200391e906.tar.bz2 |
TinyKate: libopie->libopie2
-rw-r--r-- | noncore/apps/tinykate/config.in | 2 | ||||
-rw-r--r-- | noncore/apps/tinykate/libkate/config.in | 2 | ||||
-rw-r--r-- | noncore/apps/tinykate/libkate/document/katesyntaxdocument.h | 2 | ||||
-rw-r--r-- | noncore/apps/tinykate/libkate/libkate.pro | 2 | ||||
-rw-r--r-- | noncore/apps/tinykate/libkate/microkde/kcolorbtn.cpp | 5 | ||||
-rw-r--r-- | noncore/apps/tinykate/libkate/view/kateviewdialog.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/tinykate/main.cpp | 6 | ||||
-rw-r--r-- | noncore/apps/tinykate/opie-tinykate.control | 2 | ||||
-rw-r--r-- | noncore/apps/tinykate/tinykate.cpp | 6 | ||||
-rw-r--r-- | noncore/apps/tinykate/tinykate.h | 2 | ||||
-rw-r--r-- | noncore/apps/tinykate/tinykate.pro | 2 |
11 files changed, 16 insertions, 17 deletions
diff --git a/noncore/apps/tinykate/config.in b/noncore/apps/tinykate/config.in index 39aedcf..2efc13e 100644 --- a/noncore/apps/tinykate/config.in +++ b/noncore/apps/tinykate/config.in @@ -1,6 +1,6 @@ config TINYKATE boolean "opie-tinykate (programmers editor Kate from KDE)" default "y" - depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && LIBKATE + depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2UI && LIBKATE source "noncore/apps/tinykate/libkate/config.in" diff --git a/noncore/apps/tinykate/libkate/config.in b/noncore/apps/tinykate/libkate/config.in index 47d7ef5..2e7e62c 100644 --- a/noncore/apps/tinykate/libkate/config.in +++ b/noncore/apps/tinykate/libkate/config.in @@ -1,4 +1,4 @@ config LIBKATE boolean "libkate" default "y" - depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE + depends ( LIBQPE || LIBQPE-X11 ) && LIBQTAUX && LIBOPIE2CORE && LIBOPIE2UI diff --git a/noncore/apps/tinykate/libkate/document/katesyntaxdocument.h b/noncore/apps/tinykate/libkate/document/katesyntaxdocument.h index 5c5c5a4..5eefc77 100644 --- a/noncore/apps/tinykate/libkate/document/katesyntaxdocument.h +++ b/noncore/apps/tinykate/libkate/document/katesyntaxdocument.h @@ -1,73 +1,73 @@ /*************************************************************************** katesyntaxdocument.h - description ------------------- begin : Sat 31 March 2001 copyright : (C) 2001,2002 by Joseph Wenninger email : jowenn@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 SYNTAXDOCUMENT_H #define SYNTAXDOCUMENT_H -#include <opie/xmltree.h> +#include <opie2/xmltree.h> #include <qlist.h> #include <qstringlist.h> class syntaxModeListItem { public: QString name; QString section; QString mimetype; QString extension; QString identifier; }; class syntaxContextData { public: Opie::XMLElement *parent; Opie::XMLElement *currentGroup; Opie::XMLElement *item; }; typedef QList<syntaxModeListItem> SyntaxModeList; class SyntaxDocument { public: SyntaxDocument(); ~SyntaxDocument(); QStringList& finddata(const QString& mainGroup,const QString& type,bool clearList=true); SyntaxModeList modeList(); syntaxContextData* getGroupInfo(const QString& langName, const QString &group); void freeGroupInfo(syntaxContextData* data); syntaxContextData* getConfig(const QString& mainGroupName, const QString &Config); bool nextItem(syntaxContextData* data); bool nextGroup(syntaxContextData* data); syntaxContextData* getSubItems(syntaxContextData* data); QString groupItemData(syntaxContextData* data,QString name); QString groupData(syntaxContextData* data,QString name); void setIdentifier(const QString& identifier); private: Opie::XMLElement *m_root; void setupModeList(bool force=false); QString currentFile; SyntaxModeList myModeList; QStringList m_data; }; #endif diff --git a/noncore/apps/tinykate/libkate/libkate.pro b/noncore/apps/tinykate/libkate/libkate.pro index 7266b18..f1b8063 100644 --- a/noncore/apps/tinykate/libkate/libkate.pro +++ b/noncore/apps/tinykate/libkate/libkate.pro @@ -1,90 +1,90 @@ TEMPLATE = lib CONFIG = qt warn_on release HEADERS = microkde/kapplication.h \ kateconfig.h \ microkde/kdebug.h \ microkde/kdialog.h \ microkde/kdialogbase.h \ microkde/kfiledialog.h \ microkde/kglobal.h \ microkde/kiconloader.h \ microkde/klineedit.h \ microkde/klocale.h \ microkde/kmessagebox.h \ microkde/kprinter.h \ microkde/krestrictedline.h \ microkde/kseparator.h \ microkde/kstandarddirs.h \ microkde/ktempfile.h \ microkde/kunload.h \ microkde/kurlrequester.h \ microkde/kfontdialog.h \ microkde/krun.h \ microkde/knumvalidator.h \ microkde/kstaticdeleter.h \ microkde/klistview.h \ microkde/kglobalsettings.h \ microkde/kcolorbtn.h \ \ \ qt3back/qregexp3.h \ microkde/ksharedptr.h \ document/katebuffer.h document/katedialogs.h \ document/katetextline.h \ document/katecmd.h \ document/katehighlight.h \ document/katecmds.h document/katedocument.h \ document/katesyntaxdocument.h \ view/kateundohistory.h \ view/kateview.h \ view/kateviewdialog.h \ interfaces/view.h \ interfaces/document.h \ ktexteditor/ktexteditor.h SOURCES = microkde/kapplication.cpp \ microkde/kdialogbase.cpp \ kateconfig.cpp \ microkde/klocale.cpp \ microkde/kmessagebox.cpp \ microkde/kprocess.cpp \ microkde/kstandarddirs.cpp \ microkde/ktempfile.cpp \ microkde/kurlrequester.cpp \ microkde/kfontdialog.cpp \ microkde/krun.cpp \ microkde/knumvalidator.cpp \ microkde/kglobal.cpp \ microkde/kglobalsettings.cpp \ microkde/kcolorbtn.cpp \ \ \ qt3back/qregexp3.cpp \ ktexteditor/ktexteditor.cpp \ document/katebuffer.cpp document/katedialogs.cpp \ document/katehighlight.cpp \ document/katecmd.cpp \ document/katesyntaxdocument.cpp document/katecmds.cpp \ document/katedocument.cpp document/katetextline.cpp \ view/kateundohistory.cpp \ view/kateview.cpp \ view/kateviewdialog.cpp \ interfaces/interfaces.cpp INTERFACES = INCLUDEPATH += $(OPIEDIR)/include \ $(OPIEDIR)/noncore/apps/tinykate/libkate \ $(OPIEDIR)/noncore/apps/tinykate/libkate/microkde \ $(OPIEDIR)/noncore/apps/tinykate/libkate/document \ $(OPIEDIR)/noncore/apps/tinykate/libkate/view \ $(OPIEDIR)/noncore/apps/tinykate/libkate/interfaces \ $(OPIEDIR)/noncore/apps/tinykate/libkate/ktexteditor \ $(OPIEDIR)/noncore/apps/tinykate/libkate/qt3back DEPENDPATH += $(OPIEDIR)/include -LIBS += -lqpe -lopie +LIBS += -lqpe -lqtaux2 -lopiecore2 -lopieui2 TARGET = tinykate INCLUDEPATH += $(OPIEDIR)/include DESTDIR = $(OPIEDIR)/lib$(PROJMAK) include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/apps/tinykate/libkate/microkde/kcolorbtn.cpp b/noncore/apps/tinykate/libkate/microkde/kcolorbtn.cpp index 7be5af5..1320cbc 100644 --- a/noncore/apps/tinykate/libkate/microkde/kcolorbtn.cpp +++ b/noncore/apps/tinykate/libkate/microkde/kcolorbtn.cpp @@ -1,85 +1,84 @@ /* This file is part of the KDE libraries Copyright (C) 1997 Martin Jones (mjones@kde.org) Copyright (C) 1999 Cristian Tibirna (ctibirna@kde.org) 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <qdialog.h> #include <qpainter.h> #include <qdrawutil.h> #include <qapplication.h> #include <kglobalsettings.h> -//#include "kcolordialog.h" #include "kcolorbtn.h" -#include <opie/colordialog.h> +#include <opie2/qcolordialog.h> KColorButton::KColorButton( QWidget *parent, const char *name ) : QPushButton( parent, name ), dragFlag(false) { // 2000-10-15 (putzer): fixes broken keyboard usage connect (this, SIGNAL(clicked()), this, SLOT(chooseColor())); } KColorButton::KColorButton( const QColor &c, QWidget *parent, const char *name ) : QPushButton( parent, name ), col(c), dragFlag(false) { // 2000-10-15 (putzer): fixes broken keyboard usage connect (this, SIGNAL(clicked()), this, SLOT(chooseColor())); } void KColorButton::setColor( const QColor &c ) { col = c; repaint( false ); } void KColorButton::drawButtonLabel( QPainter *painter ) { QRect r = QApplication::style().buttonRect( 0, 0, width(), height() ); int l = r.x(); int t = r.y(); int w = r.width(); int h = r.height(); int b = 5; QColor lnCol = colorGroup().text(); QColor fillCol = isEnabled() ? col : backgroundColor(); if ( isDown() ) { qDrawPlainRect( painter, l+b+1, t+b+1, w-b*2, h-b*2, lnCol, 1, 0 ); b++; painter->fillRect( l+b+1, t+b+1, w-b*2, h-b*2, fillCol ); } else { qDrawPlainRect( painter, l+b, t+b, w-b*2, h-b*2, lnCol, 1, 0 ); b++; painter->fillRect( l+b, t+b, w-b*2, h-b*2, fillCol ); } } void KColorButton::chooseColor() { - QColor newCol=OColorDialog::getColor( col); + QColor newCol=QColorDialog::getColor( col); if( newCol != QDialog::Rejected ) { col=newCol; repaint( false ); emit changed( col ); } } diff --git a/noncore/apps/tinykate/libkate/view/kateviewdialog.cpp b/noncore/apps/tinykate/libkate/view/kateviewdialog.cpp index 6a19e01..4cb13e8 100644 --- a/noncore/apps/tinykate/libkate/view/kateviewdialog.cpp +++ b/noncore/apps/tinykate/libkate/view/kateviewdialog.cpp @@ -1,573 +1,573 @@ /*************************************************************************** kateviewdialog.cpp - description ------------------- copyright : (C) 2001 by The Kate Team (C) 2002 by Joseph Wenninger email : kwrite-devel@kde.org jowenn@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. * * * ***************************************************************************/ // Dialogs #include <stdio.h> #include <stdlib.h> #include <qgrid.h> #include <qlabel.h> #include <qlayout.h> #include <qlistbox.h> #include <qspinbox.h> #include <qcombobox.h> #include <qgroupbox.h> #include <qlineedit.h> #include <qcheckbox.h> #include <qcollection.h> #include <qpushbutton.h> #include <qobjectlist.h> #include <qradiobutton.h> #include <qwhatsthis.h> #include <qstringlist.h> #include <klocale.h> #include <kcolorbtn.h> #include <qcombobox.h> #include <kglobal.h> #include <qvbox.h> #include <qspinbox.h> #include <kfontdialog.h> #include "../document/katedocument.h" #include "kateviewdialog.h" -#include <opie/ofontselector.h> +#include <opie2/ofontselector.h> SearchDialog::SearchDialog( QWidget *parent, QStringList &searchFor, QStringList &replaceWith, int flags ) : KDialogBase( parent, 0L, true, i18n( "Find Text" ), Ok | Cancel, Ok ) , m_replace( 0L ) { QWidget *page = new QWidget( this ); setMainWidget( page ); QVBoxLayout *topLayout = new QVBoxLayout( page, 0, spacingHint() ); m_search = new QComboBox( true, page ); m_search->insertStringList( searchFor ); m_search->setMinimumWidth( m_search->sizeHint().width() ); m_search->lineEdit()->selectAll(); QLabel *label = new QLabel( m_search, i18n( "&Text To Find:" ), page ); m_optRegExp = new QCheckBox( i18n( "Regular Expression" ), page ); topLayout->addWidget( label ); topLayout->addWidget( m_search ); topLayout->addWidget( m_optRegExp ); if( flags & KateView::sfReplace ) { // make it a replace dialog setCaption( i18n( "Replace Text" ) ); m_replace = new QComboBox( true, page ); m_replace->insertStringList( replaceWith ); m_replace->setMinimumWidth( m_search->sizeHint().width() ); label = new QLabel( m_replace, i18n( "&Replace With:" ), page ); //m_optPlaceholders = new QCheckBox( i18n( "&Use Placeholders" ), page ); topLayout->addWidget( label ); topLayout->addWidget( m_replace ); //topLayout->addWidget( m_optPlaceholders ); } QGroupBox *group = new QGroupBox( i18n( "Options" ), page ); topLayout->addWidget( group, 10 ); QGridLayout *gbox = new QGridLayout( group, 5, 2, spacingHint() ); gbox->addRowSpacing( 0, fontMetrics().lineSpacing() ); gbox->setRowStretch( 4, 10 ); m_opt1 = new QCheckBox( i18n( "C&ase Sensitive" ), group ); gbox->addWidget( m_opt1, 1, 0 ); m_opt2 = new QCheckBox(i18n("&Whole Words Only" ), group ); gbox->addWidget( m_opt2, 2, 0 ); m_opt3 = new QCheckBox(i18n("&From Beginning" ), group ); gbox->addWidget( m_opt3, 3, 0 ); m_opt4 = new QCheckBox(i18n("Find &Backwards" ), group ); gbox->addWidget( m_opt4, 1, 1 ); m_opt5 = new QCheckBox(i18n("&Selected Text" ), group ); gbox->addWidget( m_opt5, 2, 1 ); m_opt1->setChecked( flags & KateView::sfCaseSensitive ); m_opt2->setChecked( flags & KateView::sfWholeWords ); m_opt3->setChecked( flags & KateView::sfFromBeginning ); m_optRegExp->setChecked( flags & KateView::sfRegularExpression ); m_opt4->setChecked( flags & KateView::sfBackward ); m_opt5->setChecked( flags & KateView::sfSelected ); if( m_replace ) { m_opt6 = new QCheckBox( i18n( "&Prompt On Replace" ), group ); m_opt6->setChecked( flags & KateView::sfPrompt ); gbox->addWidget( m_opt6, 3, 1 ); } m_search->setFocus(); } QString SearchDialog::getSearchFor() { return m_search->currentText(); } QString SearchDialog::getReplaceWith() { return m_replace->currentText(); } int SearchDialog::getFlags() { int flags = 0; if( m_opt1->isChecked() ) flags |= KateView::sfCaseSensitive; if( m_opt2->isChecked() ) flags |= KateView::sfWholeWords; if( m_opt3->isChecked() ) flags |= KateView::sfFromBeginning; if( m_opt4->isChecked() ) flags |= KateView::sfBackward; if( m_opt5->isChecked() ) flags |= KateView::sfSelected; if( m_optRegExp->isChecked() ) flags |= KateView::sfRegularExpression; if( m_replace ) { if( m_opt6->isChecked() ) flags |= KateView::sfPrompt; flags |= KateView::sfReplace; } return flags; } void SearchDialog::slotOk() { if ( !m_search->currentText().isEmpty() ) { if ( !m_optRegExp->isChecked() ) { accept(); } else { // Check for a valid regular expression. QRegExp regExp( m_search->currentText() ); if ( regExp.isValid() ) accept(); } } } void SearchDialog::setSearchText( const QString &searchstr ) { m_search->insertItem( searchstr, 0 ); m_search->setCurrentItem( 0 ); m_search->lineEdit()->selectAll(); } // this dialog is not modal ReplacePrompt::ReplacePrompt( QWidget *parent ) : KDialogBase(parent, 0L, false, i18n( "Replace Text" ), User3 | User2 | User1 | Close, User3, true, i18n("&All"), i18n("&No"), i18n("&Yes")) { QWidget *page = new QWidget(this); setMainWidget(page); QBoxLayout *topLayout = new QVBoxLayout( page, 0, spacingHint() ); QLabel *label = new QLabel(i18n("Replace this occurence?"),page); topLayout->addWidget(label ); } void ReplacePrompt::slotUser1( void ) { // All done(KateView::srAll); } void ReplacePrompt::slotUser2( void ) { // No done(KateView::srNo); } void ReplacePrompt::slotUser3( void ) { // Yes accept(); } void ReplacePrompt::done(int r) { setResult(r); emit clicked(); } void ReplacePrompt::closeEvent(QCloseEvent *) { reject(); } GotoLineDialog::GotoLineDialog(QWidget *parent, int line, int max) : KDialogBase(parent, 0L, true, i18n("Goto Line"), Ok | Cancel, Ok) { QWidget *page = new QWidget(this); setMainWidget(page); QVBoxLayout *topLayout = new QVBoxLayout( page, 0, spacingHint() ); e1 = new QSpinBox(page); e1->setMinValue(1); e1->setMaxValue(max); e1->setValue((int)line); QLabel *label = new QLabel( e1,i18n("&Goto Line:"), page ); topLayout->addWidget(label); topLayout->addWidget(e1); topLayout->addSpacing(spacingHint()); // A little bit extra space topLayout->addStretch(10); e1->setFocus(); } int GotoLineDialog::getLine() { return e1->value(); } const int IndentConfigTab::flags[] = {KateView::cfAutoIndent, KateView::cfSpaceIndent, KateView::cfBackspaceIndents,KateView::cfTabIndents, KateView::cfKeepIndentProfile, KateView::cfKeepExtraSpaces}; IndentConfigTab::IndentConfigTab(QWidget *parent, KateView *view) : QWidget(parent, 0L) { QVBoxLayout *layout = new QVBoxLayout(this, 0, KDialog::spacingHint() ); int configFlags = view->config(); opt[0] = new QCheckBox(i18n("&Auto Indent"), this); layout->addWidget(opt[0], 0, AlignLeft); opt[0]->setChecked(configFlags & flags[0]); opt[1] = new QCheckBox(i18n("Indent With &Spaces"), this); layout->addWidget(opt[1], 0, AlignLeft); opt[1]->setChecked(configFlags & flags[1]); opt[2] = new QCheckBox(i18n("&Backspace Key Indents"), this); layout->addWidget(opt[2], 0, AlignLeft); opt[2]->setChecked(configFlags & flags[2]); opt[3] = new QCheckBox(i18n("&Tab Key Indents"), this); layout->addWidget(opt[3], 0, AlignLeft); opt[3]->setChecked(configFlags & flags[3]); opt[4] = new QCheckBox(i18n("Keep Indent &Profile"), this); layout->addWidget(opt[4], 0, AlignLeft); // opt[4]->setChecked(configFlags & flags[4]); opt[4]->setChecked(true); opt[4]->hide(); opt[5] = new QCheckBox(i18n("&Keep Extra Spaces"), this); layout->addWidget(opt[5], 0, AlignLeft); opt[5]->setChecked(configFlags & flags[5]); layout->addStretch(); // What is this? help QWhatsThis::add(opt[0], i18n("When <b>Auto indent</b> is on, KateView will indent new lines to equal the indent on the previous line.<p>If the previous line is blank, the nearest line above with text is used")); QWhatsThis::add(opt[1], i18n("Check this if you want to indent with spaces rather than tabs.<br>A Tab will be converted to <u>Tab-width</u> as set in the <b>edit</b> options")); QWhatsThis::add(opt[2], i18n("This allows the <b>backspace</b> key to be used to indent.")); QWhatsThis::add(opt[3], i18n("This allows the <b>tab</b> key to be used to indent.")); QWhatsThis::add(opt[4], i18n("This retains current indentation settings for future documents.")); QWhatsThis::add(opt[5], i18n("Indentations of more than the selected number of spaces will not be shortened.")); } void IndentConfigTab::getData(KateView *view) { int configFlags, z; configFlags = view->config(); for (z = 0; z < numFlags; z++) { configFlags &= ~flags[z]; if (opt[z]->isChecked()) configFlags |= flags[z]; } view->setConfig(configFlags); } const int SelectConfigTab::flags[] = {KateView::cfPersistent, KateView::cfDelOnInput, KateView::cfMouseAutoCopy, KateView::cfSingleSelection, KateView::cfVerticalSelect, KateView::cfXorSelect}; SelectConfigTab::SelectConfigTab(QWidget *parent, KateView *view) : QWidget(parent, 0L) { QVBoxLayout *layout = new QVBoxLayout(this, 0, KDialog::spacingHint() ); int configFlags = view->config(); opt[0] = new QCheckBox(i18n("&Persistent Selections"), this); layout->addWidget(opt[0], 0, AlignLeft); opt[0]->setChecked(configFlags & flags[0]); opt[1] = new QCheckBox(i18n("&Overwrite Selections"), this); layout->addWidget(opt[1], 0, AlignLeft); opt[1]->setChecked(configFlags & flags[1]); opt[2] = new QCheckBox(i18n("Mouse &Autocopy"), this); layout->addWidget(opt[2], 0, AlignLeft); opt[2]->setChecked(configFlags & flags[2]); opt[3] = new QCheckBox(i18n("&X11-like Single Selection"), this); layout->addWidget(opt[3], 0, AlignLeft); opt[3]->setChecked(configFlags & flags[3]); opt[4] = new QCheckBox(i18n("&Vertical Selections"), this); layout->addWidget(opt[4], 0, AlignLeft); opt[4]->setChecked(configFlags & flags[4]); opt[5] = new QCheckBox(i18n("&Toggle Old"), this); layout->addWidget(opt[5], 0, AlignLeft); opt[5]->setChecked(configFlags & flags[5]); layout->addStretch(); // What is this? help QWhatsThis::add(opt[0], i18n("Enabling this prevents key input or cursor movement by way of the arrow keys from causing the elimination of text selection.<p><b>Note:</b> If the Overwrite Selections option is activated then any typed character input or paste operation will replace the selected text.")); QWhatsThis::add(opt[1], i18n("When this is on, any keyed character input or paste operation will replace the selected text.")); QWhatsThis::add(opt[2], i18n("When this is on, any text selected with the mouse will be automatically copied to the clipboard.")); QWhatsThis::add(opt[3], i18n("Not implemented yet.")); QWhatsThis::add(opt[4], i18n("Enabling this allows you to make vertical selections.")); QWhatsThis::add(opt[5], i18n("Not yet implemented.")); } void SelectConfigTab::getData(KateView *view) { int configFlags, z; configFlags = view->config(); for (z = 0; z < numFlags; z++) { configFlags &= ~flags[z]; // clear flag if (opt[z]->isChecked()) configFlags |= flags[z]; // set flag if checked } view->setConfig(configFlags); } const int EditConfigTab::flags[] = {KateView::cfWordWrap, KateView::cfReplaceTabs, KateView::cfRemoveSpaces, KateView::cfAutoBrackets, KateView::cfGroupUndo, KateView::cfShowTabs, KateView::cfSmartHome, KateView::cfPageUDMovesCursor, KateView::cfWrapCursor}; EditConfigTab::EditConfigTab(QWidget *parent, KateView *view) : QWidget(parent, 0L) { QHBoxLayout *mainLayout; QVBoxLayout *cbLayout, *leLayout; int configFlags; mainLayout = new QHBoxLayout(this, 0, KDialog::spacingHint() ); // checkboxes cbLayout = new QVBoxLayout( mainLayout ); configFlags = view->config(); opt[0] = new QCheckBox(i18n("&Word wrap"), this); cbLayout->addWidget(opt[0], 0, AlignLeft); opt[0]->setChecked(view->doc()->wordWrap()); opt[1] = new QCheckBox(i18n("Replace &tabs with spaces"), this); cbLayout->addWidget(opt[1], 0, AlignLeft); opt[1]->setChecked(configFlags & flags[1]); opt[2] = new QCheckBox(i18n("&Remove trailing spaces"), this); cbLayout->addWidget(opt[2], 0, AlignLeft); opt[2]->setChecked(configFlags & flags[2]); opt[3] = new QCheckBox(i18n("&Auto brackets"), this); cbLayout->addWidget(opt[3], 0, AlignLeft); opt[3]->setChecked(configFlags & flags[3]); opt[4] = new QCheckBox(i18n("Group &undos"), this); cbLayout->addWidget(opt[4], 0, AlignLeft); opt[4]->setChecked(configFlags & flags[4]); opt[5] = new QCheckBox(i18n("&Show tabs"), this); cbLayout->addWidget(opt[5], 0, AlignLeft); opt[5]->setChecked(configFlags & flags[5]); opt[6] = new QCheckBox(i18n("Smart &home"), this); cbLayout->addWidget(opt[6], 0, AlignLeft); opt[6]->setChecked(configFlags & flags[6]); opt[7] = new QCheckBox(i18n("&Page up/down moves cursor"), this); cbLayout->addWidget(opt[7], 0, AlignLeft); opt[7]->setChecked(configFlags & flags[7]); opt[8] = new QCheckBox(i18n("Wrap &cursor"), this); cbLayout->addWidget(opt[8], 0, AlignLeft); opt[8]->setChecked(configFlags & flags[8]); cbLayout->addStretch(); // edit lines leLayout = new QVBoxLayout(); mainLayout->addLayout(leLayout,10); e1 = new QSpinBox(this); e1->setMinValue(20); e1->setMaxValue( 200); e1->setValue((int)(view->doc()->wordWrapAt())); #warning fixme e1->setLabel(i18n("Wrap Words At:")); e2 = new QSpinBox(this); e2->setMinValue(1); e2->setMaxValue(16); e2->setValue((int)view->tabWidth()); #warning fixme e2->setLabel(i18n("Tab/Indent Width:")); e3 = new QSpinBox(this); e3->setMinValue(5); e3->setMaxValue( 30000); #warning fixme e3->setLabel(i18n("Undo steps:")); e3->setValue((int)view->undoSteps()); leLayout->addWidget(e1, 0, AlignLeft); leLayout->addWidget(e2, 0, AlignLeft); leLayout->addWidget(e3, 0, AlignLeft); QVBox *box = new QVBox (this); leLayout->addWidget (box, 0, AlignLeft); new QLabel (i18n("Encoding:"), box); encoding = new QComboBox(box); #warning fixme #if 0 encoding->insertStringList (KGlobal::charsets()->availableEncodingNames()); encoding->setCurrentItem (KGlobal::charsets()->availableEncodingNames().findIndex(view->doc()->encoding())); #endif leLayout->addStretch(); // What is this? help QWhatsThis::add(opt[0], i18n("Word wrap is a feature that causes the editor to automatically start a new line of text and move (wrap) the cursor to the beginning of that new line. KateView will automatically start a new line of text when the current line reaches the length specified by the Wrap Words At: option.<p><b>NOTE:<b> Word Wrap will not change existing lines or wrap them for easy reading as in some applications.")); QWhatsThis::add(e1, i18n("If the Word Wrap option is selected this entry determines the length (in characters) at which the editor will automatically start a new line.")); QWhatsThis::add(opt[1], i18n("KateView will replace any tabs with the number of spaces indicated in the Tab Width: entry.")); QWhatsThis::add(e2, i18n("If the Replace Tabs By Spaces option is selected this entry determines the number of spaces with which the editor will automatically replace tabs.")); QWhatsThis::add(opt[2], i18n("KateView will automatically eliminate extra spaces at the ends of lines of text.")); QWhatsThis::add(opt[3], i18n("When the user types a left bracket ([,(, or {) KateView automatically enters the right bracket (}, ), or ]) to the right of the cursor.")); QWhatsThis::add(opt[4], i18n("Checking this will cause sequences of similar actions to be undone at once.")); QWhatsThis::add(opt[5], i18n("The editor will display a symbol to indicate the presence of a tab in the text.")); QWhatsThis::add(opt[6], i18n("Not yet implemented.")); QWhatsThis::add(opt[7], i18n("If this is selected, the insertion cursor will be moved to the first/last line when pressing the page up/down buttons.<p>If not selected, it will remain at it's relative position in the visible text.")); QWhatsThis::add(e3, i18n("Sets the number of undo/redo steps to record. More steps uses more memory.")); QWhatsThis::add(opt[8], i18n("When on, moving the insertion cursor using the <b>Left</b> and <b>Right</b> keys will go on to previous/next line at beginning/end of the line, similar to most editors.<p>When off, the insertion cursor cannot be moved left of the line start, but it can be moved off the line end, which can be very handy for programmers.")); } void EditConfigTab::getData(KateView *view) { int configFlags, z; configFlags = view->config(); for (z = 1; z < numFlags; z++) { configFlags &= ~flags[z]; if (opt[z]->isChecked()) configFlags |= flags[z]; } view->setConfig(configFlags); view->setEncoding (encoding->currentText()); view->doc()->setWordWrapAt(e1->value()); view->doc()->setWordWrap (opt[0]->isChecked()); view->setTabWidth(e2->value()); view->setUndoSteps(e3->value()); } ColorConfig::ColorConfig( QWidget *parent, char *name ) : QWidget( parent, name ) { QGridLayout *glay = new QGridLayout( this, 6, 2, 0, KDialog::spacingHint()); glay->setColStretch(1,1); glay->setRowStretch(5,1); QLabel *label; label = new QLabel( i18n("Background:"), this); label->setAlignment( AlignRight|AlignVCenter ); m_back = new KColorButton( this ); glay->addWidget( label, 0, 0 ); glay->addWidget( m_back, 0, 1 ); label = new QLabel( i18n("Selected:"), this); label->setAlignment( AlignRight|AlignVCenter ); m_selected = new KColorButton( this ); glay->addWidget( label, 2, 0 ); glay->addWidget( m_selected, 2, 1 ); // QWhatsThis help QWhatsThis::add(m_back, i18n("Sets the background color of the editing area")); QWhatsThis::add(m_selected, i18n("Sets the background color of the selection. To set the text color for selected text, use the "<b>Configure Highlighting</b>" dialog.")); } ColorConfig::~ColorConfig() { } void ColorConfig::setColors(QColor *colors) { m_back->setColor( colors[0] ); m_selected->setColor( colors[1] ); } void ColorConfig::getColors(QColor *colors) { colors[0] = m_back->color(); colors[1] = m_selected->color(); } FontConfig::FontConfig( QWidget *parent, char *name ) : QWidget( parent, name ) { // sizemanagment QGridLayout *grid = new QGridLayout( this, 1, 1 ); // QString familyStr = cfg. readEntry ( "FontFamily", "Helvetica" ); // QString styleStr = cfg. readEntry ( "FontStyle", "Regular" ); // int size = cfg. readNumEntry ( "FontSize", 10 ); // OFontSelector *m_fontselect; m_fontselect = new OFontSelector ( false, this, "FontTab" ); // m_fontselect-> setSelectedFont ( familyStr, styleStr, size ); // QWhatsThis::add( m_fontselect, // tr( "Select the desired name, style and size of the default font applications will use." ) ); connect( m_fontselect, SIGNAL( fontSelected ( const QFont & )), this, SLOT( slotFontSelected( const QFont & ))); grid->addWidget( m_fontselect, 0, 0); // #if 0 // m_fontchooser = new KFontChooser ( this ); // m_fontchooser->enableColumn(KFontChooser::StyleList, false); // grid->addWidget( m_fontchooser, 0, 0); // connect (m_fontchooser, SIGNAL (fontSelected( const QFont & )), this, SLOT (slotFontSelected( const QFont & ))); // #endif } FontConfig::~FontConfig() { } void FontConfig::setFont ( const QFont &font ) { //#if 0 m_fontselect->setFont (font); myFont = font; //#endif } void FontConfig::slotFontSelected( const QFont &font ) { myFont = font; } diff --git a/noncore/apps/tinykate/main.cpp b/noncore/apps/tinykate/main.cpp index e21c040..e62930c 100644 --- a/noncore/apps/tinykate/main.cpp +++ b/noncore/apps/tinykate/main.cpp @@ -1,22 +1,22 @@ /*************************************************************************** main.cpp ------------------- begin : November 2002 copyright : (C) 2002 by Joseph Wenninger <jowenn@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. * * ONLY VERSION 2 OF THE LICENSE IS APPLICABLE * * * ***************************************************************************/ -#include <qmainwindow.h> -#include "tinykate.h" -#include <opie/oapplicationfactory.h> +#include <opie2/oapplicationfactory.h> + +#include "tinykate.h" OPIE_EXPORT_APP( OApplicationFactory<TinyKate> ) diff --git a/noncore/apps/tinykate/opie-tinykate.control b/noncore/apps/tinykate/opie-tinykate.control index 66e17ad..fd806cc 100644 --- a/noncore/apps/tinykate/opie-tinykate.control +++ b/noncore/apps/tinykate/opie-tinykate.control @@ -1,9 +1,9 @@ Package: opie-tinykate Files: plugins/application/libkate.so* bin/kate apps/Applications/tinykate.desktop pics/tinykate lib/libtinykate.so.1.0.0 lib/libtinykate.so.1.0 lib/libtinykate.so.1 Priority: optional Section: opie/applications Maintainer: Opie Team <opie@handhelds.org> Architecture: arm -Depends: task-opie-minimal +Depends: task-opie-minimal, libopiecore2, libopieui2 Description: Kate for Opie Version: $QPE_VERSION$EXTRAVERSION diff --git a/noncore/apps/tinykate/tinykate.cpp b/noncore/apps/tinykate/tinykate.cpp index f470645..bbf80ce 100644 --- a/noncore/apps/tinykate/tinykate.cpp +++ b/noncore/apps/tinykate/tinykate.cpp @@ -1,283 +1,283 @@ /*************************************************************************** tinykate.cpp Tiny KATE mainwindow ------------------- begin : November 2002 copyright : (C) 2002 by Joseph Wenninger <jowenn@kde.org> ***************************************************************************/ /*************************************************************************** * * * This program is free softwaSre; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation. * * ONLY VERSION 2 OF THE LICENSE IS APPLICABLE * * * ***************************************************************************/ #include <qwidget.h> #include <qaction.h> #include <qlayout.h> #include <qtoolbutton.h> #include <qmenubar.h> #include <qpe/resource.h> #include <qpe/global.h> #include <qpe/qpeapplication.h> -#include <opie/ofiledialog.h> +#include <opie2/ofiledialog.h> #include "tinykate.h" #include <katedocument.h> #include <katehighlight.h> #include <kateview.h> #include <kglobal.h> TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) : QMainWindow( parent, name, f ) { shutDown=false; nextUnnamed=0; currentView=0; viewCount=0; setCaption(tr("TinyKATE")); KGlobal::setAppName("TinyKATE"); QMenuBar *mb = new QMenuBar( this ); mb->setMargin( 0 ); tabwidget=new OTabWidget(this); setCentralWidget(tabwidget); connect(tabwidget,SIGNAL(currentChanged( QWidget *)),this,SLOT(slotCurrentChanged(QWidget *))); //FILE ACTIONS QPopupMenu *popup = new QPopupMenu( this ); // Action for creating a new document QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); a->addTo( popup ); connect(a, SIGNAL(activated()), this, SLOT(slotNew())); // Action for opening an exisiting document a = new QAction( tr( "Open" ),Resource::loadPixmap( "fileopen" ) , QString::null, 0, this, 0 ); a->addTo(popup); connect(a, SIGNAL(activated()), this, SLOT(slotOpen())); // Action for saving document a = new QAction( tr( "Save" ), Resource::loadPixmap( "save" ) , QString::null, 0, this, 0 ); a->addTo(popup); connect(a, SIGNAL(activated()), this, SLOT(slotSave())); // Action for saving document to a new name a = new QAction( tr( "Save As" ),Resource::loadPixmap( "save" ) , QString::null, 0, this, 0 ); a->addTo(popup); connect(a, SIGNAL(activated()), this, SLOT(slotSaveAs())); // Action for closing the currently active document a = new QAction( tr( "Close" ), Resource::loadPixmap( "quit_icon" ) , QString::null, 0, this, 0 ); a->addTo(popup); connect(a, SIGNAL(activated()), this, SLOT(slotClose())); mb->insertItem(tr("File"),popup); //EDIT ACTIONS // Action for cutting text editCut = new QToolButton( 0 ); editCut->setAutoRaise( true ); editCut->setIconSet( Resource::loadPixmap( "cut" ) ); // Action for Copying text editCopy = new QToolButton( 0 ); editCopy->setAutoRaise( true ); editCopy->setIconSet( Resource::loadPixmap( "copy" ) ); // Action for pasting text editPaste = new QToolButton( 0 ); editPaste->setAutoRaise( true ); editPaste->setIconSet( Resource::loadPixmap( "paste" ) ); // Action for finding / replacing text editFindReplace = new QToolButton( 0 ); editFindReplace->setAutoRaise( true ); editFindReplace->setIconSet( Resource::loadPixmap("find") ); // Action for undo editUndo = new QToolButton( 0 ); editUndo->setAutoRaise( true ); editUndo->setIconSet( Resource::loadPixmap( "undo" ) ); // Action for redo editRedo = new QToolButton( 0 ); editRedo->setAutoRaise( true ); editRedo->setIconSet( Resource::loadPixmap( "redo" ) ); //VIEW ACITONS popup = new QPopupMenu( this ); viewIncFontSizes = new QAction( tr( "Font +" ), QString::null, 0, this, 0 ); viewIncFontSizes->addTo( popup ); viewDecFontSizes = new QAction( tr( "Font -" ), QString::null, 0, this, 0 ); viewDecFontSizes->addTo( popup ); mb->insertItem(tr("View"),popup); popup = new QPopupMenu( this ); mb->insertItem(tr("Utils"),popup); mb->insertItem( editCut ); mb->insertItem( editCopy ); mb->insertItem( editPaste ); mb->insertItem( editFindReplace ); mb->insertItem( editUndo ); mb->insertItem( editRedo ); //Highlight management hlmenu=new QPopupMenu(this); HlManager *hlm=HlManager::self(); for (int i=0;i<hlm->highlights();i++) { hlmenu->insertItem(hlm->hlName(i),i); } popup->insertItem(tr("Highlighting"),hlmenu); utilSettings = new QAction( tr( "Settings" ), QString::null, 0, this, 0 ); utilSettings->addTo( popup); if( qApp->argc() > 1) open(qApp->argv()[1]); else slotNew(); } TinyKate::~TinyKate( ) { qWarning("TinyKate destructor\n"); shutDown=true; while (currentView!=0) { slotClose(); } if( KGlobal::config() != 0 ) { qWarning("deleting KateConfig object..\n"); delete KGlobal::config(); } } void TinyKate::slotOpen( ) { - QString filename = OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL, + QString filename = Opie::OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL, QString::null); if (!filename.isEmpty()) { open(filename); } } void TinyKate::open(const QString & filename) { KateDocument *kd= new KateDocument(false, false, this,0,this); KTextEditor::View *kv; QFileInfo fi(filename); QString filenamed = fi.fileName(); tabwidget->addTab(kv=kd->createView(tabwidget,"bLAH"),"tinykate/tinykate", filenamed ); qDebug(filename); kd->setDocName( filenamed); kd->open( filename ); viewCount++; } void TinyKate::setDocument(const QString& fileref) { open( fileref ); } void TinyKate::slotCurrentChanged( QWidget * view) { if (currentView) { disconnect(editCopy,SIGNAL(activated()),currentView,SLOT(copy())); disconnect(editCut,SIGNAL(activated()),currentView,SLOT(cut())); disconnect(editPaste,SIGNAL(activated()),currentView,SLOT(paste())); disconnect(editUndo,SIGNAL(activated()),currentView,SLOT(undo())); disconnect(editRedo,SIGNAL(activated()),currentView,SLOT(redo())); disconnect(viewIncFontSizes,SIGNAL(activated()), currentView,SLOT(slotIncFontSizes())); disconnect(viewDecFontSizes,SIGNAL(activated()), currentView,SLOT(slotDecFontSizes())); disconnect(hlmenu,SIGNAL(activated(int)), currentView,SLOT(setHl(int))); disconnect(utilSettings,SIGNAL(activated()), currentView,SLOT(configDialog())); } currentView=(KTextEditor::View*)view; connect(editCopy,SIGNAL(clicked()),currentView,SLOT(copy())); connect(editCut,SIGNAL(clicked()),currentView,SLOT(cut())); connect(editPaste,SIGNAL(clicked()),currentView,SLOT(paste())); connect(editUndo,SIGNAL(clicked()),currentView,SLOT(undo())); connect(editRedo,SIGNAL(clicked()),currentView,SLOT(redo())); connect(viewIncFontSizes,SIGNAL(activated()), currentView,SLOT(slotIncFontSizes())); connect(viewDecFontSizes,SIGNAL(activated()), currentView,SLOT(slotDecFontSizes())); connect(hlmenu,SIGNAL(activated(int)), currentView,SLOT(setHl(int))); connect(utilSettings,SIGNAL(activated()), currentView,SLOT(configDialog())); } void TinyKate::slotNew( ) { KateDocument *kd= new KateDocument(false, false, this,0,this); KTextEditor::View *kv; tabwidget->addTab(kv=kd->createView(tabwidget,"BLAH"), "tinykate/tinykate", tr("Unnamed %1").arg(nextUnnamed++)); viewCount++; } void TinyKate::slotClose( ) { if (currentView==0) return; KTextEditor::View *dv=currentView; currentView=0; tabwidget->removePage(dv); delete dv->document(); viewCount--; if ((!viewCount) && (!shutDown)) slotNew(); } void TinyKate::slotSave() { // feel free to make this how you want if (currentView==0) return; // KateView *kv = (KateView*) currentView; KateDocument *kd = (KateDocument*) currentView->document(); // qDebug("saving file "+kd->docName()); if( kd->docName().isEmpty()) slotSaveAs(); else kd->saveFile(); // kv->save(); // kd->saveFile(); } void TinyKate::slotSaveAs() { if (currentView==0) return; KateDocument *kd = (KateDocument*) currentView->document(); - QString filename=OFileDialog::getSaveFileName(OFileSelector::EXTENDED_ALL, + QString filename= Opie::OFileDialog::getSaveFileName(OFileSelector::EXTENDED_ALL, QString::null); if (!filename.isEmpty()) { qDebug("saving file "+filename); QFileInfo fi(filename); QString filenamed = fi.fileName(); kd->setDocFile( filename); kd->setDocName( filenamed); kd->saveFile(); // KTextEditor::View *dv = currentView; // tabwidget->changeTab( dv, filenamed); // need to change tab label here } } diff --git a/noncore/apps/tinykate/tinykate.h b/noncore/apps/tinykate/tinykate.h index a5ee9b9..f844c55 100644 --- a/noncore/apps/tinykate/tinykate.h +++ b/noncore/apps/tinykate/tinykate.h @@ -1,66 +1,66 @@ /*************************************************************************** tinykate.h Tiny KATE mainwindow ------------------- begin : November 2002 copyright : (C) 2002 by Joseph Wenninger <jowenn@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. * * ONLY VERSION 2 OF THE LICENSE IS APPLICABLE * * * ***************************************************************************/ #ifndef __TINYKATE_H__ #define __TINYKATE_H__ #include <qmainwindow.h> -#include <opie/otabwidget.h> +#include <opie2/otabwidget.h> #include <ktexteditor.h> class QToolButton; class QAction; class QPopupMenu; class TinyKate : public QMainWindow { Q_OBJECT public: TinyKate( QWidget *parent=0, const char *name=0, WFlags f = 0); ~TinyKate( ); static QString appName() { return QString::fromLatin1( "kate" ); }; public slots: void slotNew(); void setDocument(const QString& fileref); protected slots: void slotOpen(); void slotClose(); void slotCurrentChanged(QWidget *); void slotSave(); void slotSaveAs(); protected: void open(const QString&); private: QString currentFileName; OTabWidget *tabwidget; KTextEditor::View *currentView; bool shutDown; QToolButton *editCopy, *editCut, *editPaste, *editUndo, *editRedo, *editFindReplace; QAction *viewIncFontSizes, *viewDecFontSizes, *utilSettings; QPopupMenu *hlmenu; uint nextUnnamed; uint viewCount; }; #endif // __TINYKATE_H__ diff --git a/noncore/apps/tinykate/tinykate.pro b/noncore/apps/tinykate/tinykate.pro index 91d4230..ce22f8e 100644 --- a/noncore/apps/tinykate/tinykate.pro +++ b/noncore/apps/tinykate/tinykate.pro @@ -1,22 +1,22 @@ TEMPLATE = app CONFIG = qt warn_on release quick-app DESTDIR = $(OPIEDIR)/bin HEADERS = tinykate.h SOURCES = tinykate.cpp main.cpp INTERFACES = INCLUDEPATH += $(OPIEDIR)/include \ $(OPIEDIR)/noncore/apps/tinykate/libkate \ $(OPIEDIR)/noncore/apps/tinykate/libkate/microkde \ $(OPIEDIR)/noncore/apps/tinykate/libkate/document \ $(OPIEDIR)/noncore/apps/tinykate/libkate/view \ $(OPIEDIR)/noncore/apps/tinykate/libkate/interfaces \ $(OPIEDIR)/noncore/apps/tinykate/libkate/ktexteditor \ $(OPIEDIR)/noncore/apps/tinykate/libkate/qt3back DEPENDPATH += $(OPIEDIR)/include -LIBS += -lqpe -ltinykate -lopie +LIBS += -lqpe -ltinykate -lopiecore2 -lopieui2 TARGET = kate include ( $(OPIEDIR)/include.pro ) |