summaryrefslogtreecommitdiffstats
path: root/kate/katesort/src
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2014-03-04 04:14:43 +0100
committerSlávek Banko <slavek.banko@axis.cz>2014-03-04 04:14:43 +0100
commitba41b408739dbfd96cdcd6af860cd103ec7266b8 (patch)
tree03dc9ab40148363a39f4ac3a4bfabf7cbfb077de /kate/katesort/src
parentc2d830c421ddeab97bf606d707ef0e22df6d15cb (diff)
downloadtdeaddons-ba41b408739dbfd96cdcd6af860cd103ec7266b8.tar.gz
tdeaddons-ba41b408739dbfd96cdcd6af860cd103ec7266b8.zip
Initial import of katesort 1.0
Diffstat (limited to 'kate/katesort/src')
-rw-r--r--kate/katesort/src/Makefile.am21
-rw-r--r--kate/katesort/src/hi16-action-plugin.pngbin0 -> 292 bytes
-rw-r--r--kate/katesort/src/hi32-action-plugin.pngbin0 -> 1151 bytes
-rw-r--r--kate/katesort/src/katesort.desktop10
-rw-r--r--kate/katesort/src/plugin_sort.cpp308
-rw-r--r--kate/katesort/src/plugin_sort.h73
-rw-r--r--kate/katesort/src/plugin_sort.rc11
-rw-r--r--kate/katesort/src/sortdialog.cpp144
-rw-r--r--kate/katesort/src/sortdialog.h66
-rw-r--r--kate/katesort/src/sortdialoglayout.ui392
10 files changed, 1025 insertions, 0 deletions
diff --git a/kate/katesort/src/Makefile.am b/kate/katesort/src/Makefile.am
new file mode 100644
index 0000000..b58b34a
--- /dev/null
+++ b/kate/katesort/src/Makefile.am
@@ -0,0 +1,21 @@
+INCLUDES = $(all_includes)
+METASOURCES = AUTO
+
+KDE_ICON = AUTO
+
+# Install this plugin in the KDE modules directory
+kde_module_LTLIBRARIES = libsortplugin.la
+
+libsortplugin_la_SOURCES = plugin_sort.cpp sortdialog.cpp sortdialoglayout.ui
+libsortplugin_la_LIBADD = -lkateinterfaces
+libsortplugin_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries)
+
+pluginsdir = $(kde_datadir)/kate/plugins/sort
+plugins_DATA = plugin_sort.rc
+
+
+messages: rc.cpp
+ $(EXTRACTRC) `find . -name \*.ui -o -name \*.rc` > rc.cpp
+ $(XGETTEXT) *.cpp -o $(podir)/katesort.pot
+noinst_HEADERS = sortdialog.h sortdialoglayout.h
+kde_services_DATA = katesort.desktop
diff --git a/kate/katesort/src/hi16-action-plugin.png b/kate/katesort/src/hi16-action-plugin.png
new file mode 100644
index 0000000..e2d7bab
--- /dev/null
+++ b/kate/katesort/src/hi16-action-plugin.png
Binary files differ
diff --git a/kate/katesort/src/hi32-action-plugin.png b/kate/katesort/src/hi32-action-plugin.png
new file mode 100644
index 0000000..4082bf1
--- /dev/null
+++ b/kate/katesort/src/hi32-action-plugin.png
Binary files differ
diff --git a/kate/katesort/src/katesort.desktop b/kate/katesort/src/katesort.desktop
new file mode 100644
index 0000000..f39feeb
--- /dev/null
+++ b/kate/katesort/src/katesort.desktop
@@ -0,0 +1,10 @@
+[Desktop Entry]
+Type=Service
+ServiceTypes=Kate/Plugin
+X-KDE-Library=libsortplugin
+X-Kate-Version=2.5
+Name=Sort
+Name[cs]=Řazení
+Comment=Sort file or selection
+Comment[cs]=Seřadí soubor nebo výběr
+author=Marián Kyral, mkyral@email.cz
diff --git a/kate/katesort/src/plugin_sort.cpp b/kate/katesort/src/plugin_sort.cpp
new file mode 100644
index 0000000..f74213a
--- /dev/null
+++ b/kate/katesort/src/plugin_sort.cpp
@@ -0,0 +1,308 @@
+/***************************************************************************
+ * Copyright (C) 2007 by Marián Kyral *
+ * mkyral@email.cz *
+ * *
+ * 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. *
+ * *
+ * This program 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 General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+
+#include "plugin_sort.h"
+#include "sortdialog.h"
+
+#include <kaction.h>
+#include <klocale.h>
+#include <kstandarddirs.h>
+#include <map>
+#include <qregexp.h>
+
+class PluginView : public KXMLGUIClient
+{
+ friend class KatePluginSort;
+
+ public:
+ Kate::MainWindow *win;
+};
+
+extern "C"
+{
+ void* init_libsortplugin()
+ {
+ KGlobal::locale()->insertCatalogue("katesort");
+ return new KatePluginFactory;
+ }
+}
+
+KatePluginFactory::KatePluginFactory()
+{
+ s_instance = new KInstance( "kate" );
+}
+
+KatePluginFactory::~KatePluginFactory()
+{
+ delete s_instance;
+}
+
+QObject* KatePluginFactory::createObject( QObject* parent, const char* name, const char*, const QStringList & )
+{
+ return new KatePluginSort( parent, name );
+}
+
+KInstance* KatePluginFactory::s_instance = 0L;
+
+KatePluginSort::KatePluginSort( QObject* parent, const char* name )
+ : Kate::Plugin ( (Kate::Application*)parent, name )
+{
+}
+
+KatePluginSort::~KatePluginSort()
+{
+}
+
+void KatePluginSort::addView(Kate::MainWindow *win)
+{
+ /// @todo doesn't this have to be deleted?
+ PluginView *view = new PluginView ();
+
+ (void) new KAction ( i18n("Sort"), 0, this,
+ SLOT( slotSort() ), view->actionCollection(),
+ "edit_insert_sort" );
+
+ view->setInstance (new KInstance("kate"));
+ view->setXMLFile("plugins/sort/plugin_sort.rc");
+ win->guiFactory()->addClient (view);
+ view->win = win;
+
+ m_views.append (view);
+}
+void KatePluginSort::removeView(Kate::MainWindow *win)
+{
+ for (uint z=0; z < m_views.count(); z++)
+ if (m_views.at(z)->win == win)
+ {
+ PluginView *view = m_views.at(z);
+ m_views.remove (view);
+ win->guiFactory()->removeClient (view);
+ delete view;
+ }
+}
+
+void KatePluginSort::slotSort()
+{
+ Kate::View *kv = application()->activeMainWindow()->viewManager()->activeView();
+
+ if (! kv)
+ return;
+
+ // display dialog part
+ SortDialog m_sortDialog;
+
+ // if only part of one row is selected. update By column part of dialog
+ if (! kv->getDoc()->selection().isEmpty())
+ {
+ if (kv->getDoc()->selStartLine() == kv->getDoc()->selEndLine() &&
+ kv->getDoc()->lineLength(kv->getDoc()->selStartLine()) != -1 )
+ {
+ uint sel_sc = kv->getDoc()->selStartCol() + 1;
+ uint sel_ec = kv->getDoc()->selEndCol() + 1;
+ if (! (sel_sc == 0 && (int) sel_ec == kv->getDoc()->lineLength(kv->getDoc()->selStartLine())))
+ {
+ m_sortDialog.m_checkBoxByCol->setChecked(true);
+ m_sortDialog.m_lineEditStartCol->setText(QString::number(sel_sc,10));
+ m_sortDialog.m_lineEditEndCol->setText(QString::number(sel_ec,10));
+ }
+ }
+ kv->getDoc()->clearSelection();
+ }
+ if (m_sortDialog.exec() == QDialog::Rejected)
+ return;
+
+ if (kv->getDoc()->selection().isEmpty())
+ kv->getDoc()->selectAll();
+ if (kv->getDoc()->selection().isEmpty())
+ return; // Nothing to sort !
+
+ uint sel_sl = kv->getDoc()->selStartLine();
+ uint sel_el = kv->getDoc()->selEndLine();
+ if (kv->getDoc()->selStartCol() > 0 && kv->getDoc()->selStartCol() == kv->getDoc()->lineLength(sel_sl))
+ sel_sl++ ;
+ if (kv->getDoc()->selEndCol() == 0 && kv->getDoc()->lineLength(sel_el) >0)
+ sel_el-- ;
+
+ // split string to lines
+ QStringMultiMap strMLines; // alphabetical sort multimap
+ LongMultiMap longMLines; // numerical sort multimap
+
+
+ // Map filling...
+ QString skey;
+ QString sdata;
+ int ikey, non_num_ind;
+ QRegExp rx("[^0-9]"); // Search regexp for not number character
+ for (uint i = sel_sl; i <= sel_el; i++)
+ {
+ sdata = kv->getDoc()->textLine(i);
+ skey = sdata;
+ if (m_sortDialog.m_checkBoxByCol->isChecked())
+ {
+ skey = skey.mid(m_sortDialog.m_lineEditStartCol->text().toInt() - 1,
+ m_sortDialog.m_lineEditEndCol->text().toInt() - m_sortDialog.m_lineEditStartCol->text().toInt());
+// qDebug("skey: %s", skey.ascii());
+ }
+
+// qDebug("\tLine: %d",i);
+// qDebug("Key: %s, Line content: %s", skey.ascii(),sdata.ascii());
+ if (m_sortDialog.m_radioButtonAlphaSort->isChecked())
+ {
+ if (m_sortDialog.m_checkBoxCase->isChecked())
+ {
+ // Case sensitive sort
+ strMLines.insert(std::pair<QString, QString>(skey ,sdata));
+ }
+ else
+ {
+ // Case insensitive sort
+ strMLines.insert(std::pair<QString, QString>(skey.lower(), sdata));
+ }
+ }
+ else
+ {
+ // Numeric sort
+ skey = skey.stripWhiteSpace();
+ if (skey.toLong() == 0)
+ { // key is not number
+ non_num_ind = skey.find(rx,0);
+ if (non_num_ind != -1)
+ { // beginning of key is number
+// qDebug("non_num_ind: %d",non_num_ind);
+ skey.truncate(non_num_ind);
+ }
+ else
+ {
+ skey = "0";
+ }
+ }
+// qDebug("Key: %s",skey.ascii());
+ longMLines.insert(std::pair<long, QString>(skey.toLong(), sdata));
+ }
+ }
+
+ // Insert result back to document
+ // Remove selection
+ kv->getDoc()->removeText(sel_sl,0,sel_el,kv->getDoc()->lineLength(sel_el));
+// kv->updateView(false);
+
+ QStringMultiMap::iterator smit, smsit, emsit;
+ LongMultiMap::iterator lmit, slmit, elmit;
+ bool fasc;
+ uint i=sel_sl; // insert start line
+ bool first=true; // First line flag
+ QString prevLine; // Store previous line (for unique purpose)
+
+ if (m_sortDialog.m_radioButtonAlphaSort->isChecked())
+ {
+ if (m_sortDialog.m_radioButtonAsc->isChecked())
+ {
+ // Ascendent
+ smsit=strMLines.begin();
+ emsit=strMLines.end();
+ fasc=true;
+ } //m_sortDialog.m_radioButtonAsc->isChecked()
+ else
+ {
+ // Descendent
+ smsit=strMLines.end();
+ smsit++;
+ emsit=strMLines.begin();
+ emsit--;
+ fasc=false;
+ } //m_sortDialog.m_radioButtonAsc->isChecked()
+ for( smit=smsit; smit != emsit; fasc ? ++smit : --smit )
+ {
+ sdata = smit->second;
+ skey = smit->first;
+// qDebug("Key: %s, Line content: %s", skey.ascii(),sdata.ascii());
+
+ if (m_sortDialog.m_checkBoxUnique->isChecked())
+ {
+ if ( prevLine.compare(sdata) != 0 || first ) //remove duplicities
+ {
+// qDebug("Inserting line: %d",i);
+ first = false;
+ prevLine = sdata;
+ kv->getDoc()->insertLine(i, sdata);
+ i++;
+ }
+ } // m_sortDialog.m_checkBoxUnique->isChecked()
+ else
+ {
+ prevLine = sdata;
+// qDebug("Inserting line: %d",i);
+ kv->getDoc()->insertLine(i, sdata);
+ i++;
+ } // m_sortDialog.m_checkBoxUnique->isChecked()
+ } //for
+ } //m_sortDialog.m_radioButtonAlphaSort->isChecked()
+ else
+ {
+ if (m_sortDialog.m_radioButtonAsc->isChecked())
+ {
+ // Ascendent
+ slmit=longMLines.begin();
+ elmit=longMLines.end();
+ fasc=true;
+ } //m_sortDialog.m_radioButtonAsc->isChecked()
+ else
+ {
+ // Descendent
+ slmit=longMLines.end();
+ ++slmit;
+ elmit=longMLines.begin();
+ --elmit;
+ fasc=false;
+ } //m_sortDialog.m_radioButtonAsc->isChecked()
+ for( lmit=slmit; lmit != elmit; fasc ? ++lmit : --lmit )
+ {
+ sdata = lmit->second;
+ ikey = lmit->first;
+
+// qDebug("Key: %d, Line content: %s", ikey,sdata.ascii());
+ if (m_sortDialog.m_checkBoxUnique->isChecked())
+ {
+ if ( prevLine.compare(sdata) != 0 || first ) //remove duplicities
+ {
+// qDebug("Inserting line: %d",i);
+ first = false;
+ prevLine = sdata;
+ kv->getDoc()->insertLine(i, sdata);
+ i++;
+ }
+ } // m_sortDialog.m_checkBoxUnique->isChecked()
+ else
+ {
+ prevLine = sdata;
+// qDebug("Inserting line: %d",i);
+ kv->getDoc()->insertLine(i, sdata);
+ i++;
+ } // m_sortDialog.m_checkBoxUnique->isChecked()
+ } //for
+ }
+ // Delete last blank line
+ kv->getDoc()->removeLine(i);
+
+}
+
+#include "plugin_sort.moc"
+
diff --git a/kate/katesort/src/plugin_sort.h b/kate/katesort/src/plugin_sort.h
new file mode 100644
index 0000000..db3c093
--- /dev/null
+++ b/kate/katesort/src/plugin_sort.h
@@ -0,0 +1,73 @@
+/***************************************************************************
+ * Copyright (C) 2007 by Marián Kyral *
+ * mkyral@email.cz *
+ * *
+ * 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. *
+ * *
+ * This program 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 General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+
+#ifndef _PLUGIN_SORT_H_
+#define _PLUGIN_SORT_H_
+
+#include <kate/application.h>
+#include <kate/documentmanager.h>
+#include <kate/document.h>
+#include <kate/mainwindow.h>
+#include <kate/plugin.h>
+#include <kate/view.h>
+#include <kate/viewmanager.h>
+
+#include <klibloader.h>
+#include <klocale.h>
+#include <map>
+
+#include "sortdialog.h"
+
+class KatePluginFactory : public KLibFactory
+{
+ Q_OBJECT
+
+ public:
+ KatePluginFactory();
+ virtual ~KatePluginFactory();
+
+ virtual QObject* createObject( QObject* parent = 0, const char* pname = 0, const char* name = "QObject", const QStringList &args = QStringList() );
+
+ private:
+ static KInstance* s_instance;
+};
+
+class KatePluginSort : public Kate::Plugin, Kate::PluginViewInterface
+{
+ Q_OBJECT
+
+ public:
+ KatePluginSort( QObject* parent = 0, const char* name = 0 );
+ virtual ~KatePluginSort();
+
+ void addView (Kate::MainWindow *win);
+ void removeView (Kate::MainWindow *win);
+
+ public slots:
+ void slotSort();
+
+ private:
+ QPtrList<class PluginView> m_views;
+ typedef std::multimap<QString,QString> QStringMultiMap;
+ typedef std::multimap<long,QString> LongMultiMap;
+};
+
+#endif // _PLUGIN_SORT_H_
diff --git a/kate/katesort/src/plugin_sort.rc b/kate/katesort/src/plugin_sort.rc
new file mode 100644
index 0000000..bb9efa3
--- /dev/null
+++ b/kate/katesort/src/plugin_sort.rc
@@ -0,0 +1,11 @@
+<!DOCTYPE kpartgui>
+<kpartplugin name="sort" library="libsortplugin" version="1">
+<MenuBar>
+ <Menu name="tools"><Text>&amp;Tools</Text>
+ <Action name="edit_insert_sort"/>
+ </Menu>
+</MenuBar>
+<ToolBar name="extraToolBar">
+ <Action name="edit_insert_sort"/>
+</ToolBar>
+</kpartplugin>
diff --git a/kate/katesort/src/sortdialog.cpp b/kate/katesort/src/sortdialog.cpp
new file mode 100644
index 0000000..d46746b
--- /dev/null
+++ b/kate/katesort/src/sortdialog.cpp
@@ -0,0 +1,144 @@
+/***************************************************************************
+ * Copyright (C) 2007 by Marian Kyral *
+ * mkyral@email.cz *
+ * *
+ * 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. *
+ * *
+ * This program 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 General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+
+#include "sortdialog.h"
+#include "kconfig.h"
+#include <qwhatsthis.h>
+
+SortDialog::SortDialog ( QWidget* parent, const char* name, bool modal, WFlags fl )
+ : sortdialoglayout ( parent,name, modal,fl )
+{
+ // set labels
+ QWhatsThis::add(m_radioButtonAsc,i18n(
+ "Sort in ascending order "
+ "(from A to Z or 0 to 9)."));
+ QWhatsThis::add(m_radioButtonDesc,i18n(
+ "Sort in descending order "
+ "(from Z to A or 9 to 0)."));
+ QWhatsThis::add(m_checkBoxCase,i18n(
+ "Check this for case sensitive sort."));
+ QWhatsThis::add(m_checkBoxUnique,i18n(
+ "Check this to removed all duplicated records."));
+ QWhatsThis::add(m_checkBoxByCol,i18n(
+ "Check this for sorting by specific column.\n\n"
+ "If a part of one line is selected, "
+ "this checkbox is automatically selected. "
+ "Start and end fields are filled according to selection."));
+ QWhatsThis::add(m_lineEditStartCol,i18n(
+ "Start column of the sorting area."));
+ QWhatsThis::add(m_lineEditEndCol,i18n(
+ "End column of the sorting area."));
+ QWhatsThis::add(m_radioButtonAlphaSort,i18n(
+ "Alphabetical sorting (A-Z)."));
+ QWhatsThis::add(m_radioButtonNumSort,i18n(
+ "Numeric sorting (0-9)"));
+
+ config_load();
+}
+
+SortDialog::~SortDialog()
+{}
+
+/*$SPECIALIZATION$*/
+void SortDialog::reject()
+{
+ QDialog::reject();
+}
+
+void SortDialog::accept()
+{
+ if (m_checkBoxByCol->isChecked())
+ {
+ if (m_lineEditStartCol->text().isEmpty() ||
+ m_lineEditStartCol->text().toInt() == 0 ||
+ m_lineEditEndCol->text().isEmpty() ||
+ m_lineEditEndCol->text().toInt() == 0)
+ {
+ QMessageBox::warning(this,i18n("Error"),
+ i18n("Fields:\n\"Starting at\" and \"Ending at\"\nhave to contains numbers."),
+ i18n("OK"));
+ return;
+ }
+ }
+ config_save();
+ QDialog::accept();
+}
+
+int SortDialog::exec()
+{
+ return QDialog::exec();
+}
+
+void SortDialog::toggledCol()
+{
+ if (m_lineEditStartCol->isEnabled())
+ {
+ m_lineEditStartCol->setEnabled(false);
+ m_lineEditEndCol->setEnabled(false);
+ }
+ else
+ {
+ m_lineEditStartCol->setEnabled(true);
+ m_lineEditEndCol->setEnabled(true);
+ }
+}
+
+void SortDialog::toggledType()
+{
+ if (m_radioButtonAlphaSort->isChecked())
+ m_checkBoxCase->setEnabled(true);
+ else
+ m_checkBoxCase->setEnabled(false);
+}
+
+void SortDialog::config_load ()
+{
+// qDebug("config_load()");
+ KConfig *config = new KConfig("katesortpluginrc");
+ m_radioButtonAsc->setChecked(config->readBoolEntry("Asc",true));
+ m_radioButtonDesc->setChecked(config->readBoolEntry("Desc",false));
+ m_radioButtonAlphaSort->setChecked(config->readBoolEntry("Alpha",true));
+ m_radioButtonNumSort->setChecked(config->readBoolEntry("Num",false));
+ m_checkBoxCase->setChecked(config->readBoolEntry("Case",false));
+ m_checkBoxUnique->setChecked(config->readBoolEntry("Unique",false));
+ m_checkBoxByCol->setChecked(config->readBoolEntry("By col",false));
+ m_lineEditStartCol->setText(config->readEntry("Start col"));
+ m_lineEditEndCol->setText(config->readEntry("End col"));
+}
+
+void SortDialog::config_save ()
+{
+// qDebug("config_save()");
+ KConfig *config = new KConfig("katesortpluginrc");
+ config->writeEntry("Asc",m_radioButtonAsc->isOn());
+ config->writeEntry("Desc", m_radioButtonDesc->isOn());
+ config->writeEntry("Alpha",m_radioButtonAlphaSort->isOn());
+ config->writeEntry("Num", m_radioButtonNumSort->isOn());
+ config->writeEntry("Case", m_checkBoxCase->isOn());
+ config->writeEntry("Unique", m_checkBoxUnique->isOn());
+ config->writeEntry("By col", m_checkBoxByCol->isOn());
+ config->writeEntry("Start col", m_lineEditStartCol->text());
+ config->writeEntry("End col", m_lineEditEndCol->text());
+ config->sync();
+}
+
+#include "sortdialog.moc"
+
diff --git a/kate/katesort/src/sortdialog.h b/kate/katesort/src/sortdialog.h
new file mode 100644
index 0000000..516efef
--- /dev/null
+++ b/kate/katesort/src/sortdialog.h
@@ -0,0 +1,66 @@
+/***************************************************************************
+ * Copyright (C) 2007 by Marian Kyral *
+ * mkyral@email.cz *
+ * *
+ * 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. *
+ * *
+ * This program 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 General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#ifndef SORTDIALOG_H
+#define SORTDIALOG_H
+
+#include "sortdialoglayout.h"
+#include <qdialog.h>
+#include <klocale.h>
+#include <qlineedit.h>
+#include <qpushbutton.h>
+#include <qbuttongroup.h>
+#include <qradiobutton.h>
+#include <qgroupbox.h>
+#include <qcheckbox.h>
+#include <qlabel.h>
+#include <qmessagebox.h>
+
+class SortDialog : public sortdialoglayout
+{
+ Q_OBJECT
+
+ public:
+ SortDialog ( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
+ ~SortDialog();
+// QCheckBox* m_checkBoxUnique;
+ /*$PUBLIC_FUNCTIONS$*/
+
+ public slots:
+ /*$PUBLIC_SLOTS$*/
+ int exec();
+
+ protected:
+ /*$PROTECTED_FUNCTIONS$*/
+ void config_load();
+ void config_save();
+ KConfig *config;
+
+ protected slots:
+ /*$PROTECTED_SLOTS$*/
+ virtual void reject();
+ virtual void accept();
+ virtual void toggledCol();
+ virtual void toggledType();
+
+};
+
+#endif
+
diff --git a/kate/katesort/src/sortdialoglayout.ui b/kate/katesort/src/sortdialoglayout.ui
new file mode 100644
index 0000000..7e29409
--- /dev/null
+++ b/kate/katesort/src/sortdialoglayout.ui
@@ -0,0 +1,392 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>sortdialoglayout</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>sortdialoglayout</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>426</width>
+ <height>224</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Sort</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="2" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>Layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>253</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QButtonGroup" row="0" column="0">
+ <property name="name">
+ <cstring>m_groupSortOrder</cstring>
+ </property>
+ <property name="title">
+ <string>Sort order</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout2</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>m_radioButtonAsc</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Ascending</string>
+ </property>
+ <property name="accel">
+ <string>Alt+A</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>m_radioButtonDesc</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Descending</string>
+ </property>
+ <property name="accel">
+ <string>Alt+D</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QGroupBox" row="0" column="1" rowspan="2" colspan="1">
+ <property name="name">
+ <cstring>m_groupAdvanced</cstring>
+ </property>
+ <property name="title">
+ <string>Advanced</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="0" column="0">
+ <property name="name">
+ <cstring>layout4</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>m_checkBoxCase</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Case sensitive</string>
+ </property>
+ <property name="accel">
+ <string>Alt+C</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>m_checkBoxUnique</cstring>
+ </property>
+ <property name="text">
+ <string>Uni&amp;que</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>m_checkBoxByCol</cstring>
+ </property>
+ <property name="text">
+ <string>B&amp;y column</string>
+ </property>
+ <property name="accel">
+ <string>Alt+Y</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget" row="1" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>layout5</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>m_textLabelStartCol</cstring>
+ </property>
+ <property name="text">
+ <string>Starting at:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>M_lineEditStartCol</cstring>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>30</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>m_lineEditStartCol</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="maxLength">
+ <number>7</number>
+ </property>
+ <property name="inputMask">
+ <string></string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget" row="2" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>layout6</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>m_textLabelEndCol</cstring>
+ </property>
+ <property name="text">
+ <string>Ending at:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>m_lineEditEndCol</cstring>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>31</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>m_lineEditEndCol</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="maxLength">
+ <number>7</number>
+ </property>
+ <property name="inputMask">
+ <string></string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <spacer row="0" column="1">
+ <property name="name">
+ <cstring>spacer6</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>130</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ <widget class="QButtonGroup" row="1" column="0">
+ <property name="name">
+ <cstring>m_groupSortType</cstring>
+ </property>
+ <property name="title">
+ <string>Sort type</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout3</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>m_radioButtonAlphaSort</cstring>
+ </property>
+ <property name="text">
+ <string>Alpha&amp;betical</string>
+ </property>
+ <property name="accel">
+ <string>Alt+B</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>m_radioButtonNumSort</cstring>
+ </property>
+ <property name="text">
+ <string>Nu&amp;meric</string>
+ </property>
+ <property name="accel">
+ <string>Alt+M</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </hbox>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>sortdialoglayout</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>sortdialoglayout</receiver>
+ <slot>reject()</slot>
+ </connection>
+ <connection>
+ <sender>m_checkBoxByCol</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>sortdialoglayout</receiver>
+ <slot>toggledCol()</slot>
+ </connection>
+ <connection>
+ <sender>m_radioButtonAlphaSort</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>sortdialoglayout</receiver>
+ <slot>toggledType()</slot>
+ </connection>
+</connections>
+<slots>
+ <slot access="protected">toggledCol()</slot>
+ <slot access="protected">toggledType()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>