summaryrefslogtreecommitdiffstats
path: root/lib/kofficeui/KoEditPath.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-01-20 01:29:50 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-01-20 01:29:50 +0000
commit8362bf63dea22bbf6736609b0f49c152f975eb63 (patch)
tree0eea3928e39e50fae91d4e68b21b1e6cbae25604 /lib/kofficeui/KoEditPath.cpp
downloadkoffice-8362bf63dea22bbf6736609b0f49c152f975eb63.tar.gz
koffice-8362bf63dea22bbf6736609b0f49c152f975eb63.zip
Added old abandoned KDE3 version of koffice
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1077364 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'lib/kofficeui/KoEditPath.cpp')
-rw-r--r--lib/kofficeui/KoEditPath.cpp98
1 files changed, 98 insertions, 0 deletions
diff --git a/lib/kofficeui/KoEditPath.cpp b/lib/kofficeui/KoEditPath.cpp
new file mode 100644
index 00000000..8f7aa19e
--- /dev/null
+++ b/lib/kofficeui/KoEditPath.cpp
@@ -0,0 +1,98 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002 Montel Laurent <lmontel@mandrakesoft.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 <kdeversion.h>
+#include <klocale.h>
+#include <qlayout.h>
+#include <qpushbutton.h>
+#include <qlistbox.h>
+#include "KoEditPath.h"
+#include <keditlistbox.h>
+#include <kfiledialog.h>
+#include <kurlrequester.h>
+#include <qhbox.h>
+#include <klineedit.h>
+#include <qvbox.h>
+#include <qcheckbox.h>
+#include <qlabel.h>
+
+KoEditPathDia::KoEditPathDia( const QString & _path, QWidget *parent, const char *name )
+ : KDialogBase( parent, name , true, "", Ok|Cancel, Ok, true )
+{
+ setCaption( i18n("Edit Path") );
+ QWidget *page = new QWidget( this );
+ setMainWidget(page);
+ QGridLayout * grid = new QGridLayout(page, 5, 2, KDialog::marginHint(), KDialog::spacingHint());
+
+ urlReq = new KURLRequester();
+ urlReq->fileDialog()->setMode(KFile::Directory | KFile::LocalOnly);
+
+ KEditListBox::CustomEditor tmp(urlReq, urlReq->lineEdit());
+
+ m_listpath = new KEditListBox( i18n("Expression Path"),
+ tmp,page, "list_editor" , false, KEditListBox::Add|KEditListBox::Remove );
+
+ grid->addMultiCellWidget(m_listpath, 0, 4, 0, 0);
+ m_listpath->listBox()->insertStringList(QStringList::split(QString(";"), _path));
+ setFocus();
+ resize( 500, 300);
+}
+
+QString KoEditPathDia::newPath()const
+{
+ QString tmp;
+ for (int i = 0; i <(int)m_listpath->listBox()->count(); i++)
+ {
+ if ( i!=0)
+ tmp +=";";
+ tmp += m_listpath->listBox()->text( i );
+ }
+ return tmp;
+}
+
+
+KoChangePathDia::KoChangePathDia( const QString & _path, QWidget *parent, const char *name )
+ : KDialogBase( parent, name , true, "", Ok|Cancel, Ok, true )
+{
+ setCaption( i18n("Edit Path") );
+
+ QVBox *page =makeVBoxMainWidget();
+ new QLabel( i18n("Location:"), page);
+ m_urlReq = new KURLRequester(page);
+ m_urlReq->setMinimumWidth( m_urlReq->sizeHint().width() * 3 );
+
+ m_urlReq->lineEdit()->setText( _path );
+ m_urlReq->fileDialog()->setMode(KFile::Directory | KFile::LocalOnly);
+ m_defaultPath = new QCheckBox( i18n("Default path"), page );
+ connect( m_defaultPath, SIGNAL(toggled ( bool )), this, SLOT( slotChangeDefaultValue( bool )));
+ slotChangeDefaultValue( _path.isEmpty() );
+ m_defaultPath->setChecked( _path.isEmpty() );
+}
+
+QString KoChangePathDia::newPath() const
+{
+ return m_defaultPath->isChecked() ? QString::null : m_urlReq->lineEdit()->text();
+}
+
+void KoChangePathDia::slotChangeDefaultValue( bool _b)
+{
+ m_urlReq->setEnabled( !_b);
+}
+
+#include "KoEditPath.moc"