summaryrefslogtreecommitdiffstats
path: root/tdeioslave/media/mounthelper
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-01-27 01:02:02 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-01-27 01:02:02 -0600
commitde7e5867a65e0a46f1388e3e50bc7eeddd1aecbf (patch)
treedbb3152c372f8620f9290137d461f3d9f9eba1cb /tdeioslave/media/mounthelper
parent936d3cec490c13f2c5f7dd14f5e364fddaa6da71 (diff)
downloadtdebase-de7e5867a65e0a46f1388e3e50bc7eeddd1aecbf.tar.gz
tdebase-de7e5867a65e0a46f1388e3e50bc7eeddd1aecbf.zip
Rename a number of libraries and executables to avoid conflicts with KDE4
Diffstat (limited to 'tdeioslave/media/mounthelper')
-rw-r--r--tdeioslave/media/mounthelper/CMakeLists.txt36
-rw-r--r--tdeioslave/media/mounthelper/Makefile.am12
-rw-r--r--tdeioslave/media/mounthelper/decryptdialog.ui201
-rw-r--r--tdeioslave/media/mounthelper/dialog.cpp68
-rw-r--r--tdeioslave/media/mounthelper/dialog.h61
-rw-r--r--tdeioslave/media/mounthelper/kio_media_mounthelper.cpp282
-rw-r--r--tdeioslave/media/mounthelper/kio_media_mounthelper.h57
7 files changed, 717 insertions, 0 deletions
diff --git a/tdeioslave/media/mounthelper/CMakeLists.txt b/tdeioslave/media/mounthelper/CMakeLists.txt
new file mode 100644
index 000000000..ea06278a8
--- /dev/null
+++ b/tdeioslave/media/mounthelper/CMakeLists.txt
@@ -0,0 +1,36 @@
+#################################################
+#
+# (C) 2010-2011 Serghei Amelian
+# serghei (DOT) amelian (AT) gmail.com
+#
+# Improvements and feedback are welcome
+#
+# This file is released under GPL >= 2
+#
+#################################################
+
+include_directories(
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_SOURCE_DIR}/tdeioslave/media/libmediacommon
+ ${TDE_INCLUDE_DIR}
+ ${TQT_INCLUDE_DIRS}
+)
+
+link_directories(
+ ${TQT_LIBRARY_DIRS}
+)
+
+
+##### kio_media_mounthelper (executable) ########
+
+set( target kio_media_mounthelper )
+
+set( ${target}_SRCS
+ kio_media_mounthelper.cpp decryptdialog.ui dialog.cpp
+)
+
+tde_add_executable( ${target} AUTOMOC
+ SOURCES ${${target}_SRCS}
+ LINK mediacommon-static tdeio-shared
+ DESTINATION ${BIN_INSTALL_DIR}
+)
diff --git a/tdeioslave/media/mounthelper/Makefile.am b/tdeioslave/media/mounthelper/Makefile.am
new file mode 100644
index 000000000..934559d40
--- /dev/null
+++ b/tdeioslave/media/mounthelper/Makefile.am
@@ -0,0 +1,12 @@
+bin_PROGRAMS = kio_media_mounthelper
+
+INCLUDES = -I$(srcdir)/../libmediacommon $(all_includes)
+AM_LDFLAGS = $(all_libraries)
+
+kio_media_mounthelper_SOURCES = kio_media_mounthelper.cpp decryptdialog.ui dialog.cpp
+
+kio_media_mounthelper_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor
+kio_media_mounthelper_LDADD = ../libmediacommon/libmediacommon.la $(LIB_KIO) $(LIB_TDEUI)
+
+METASOURCES = AUTO
+
diff --git a/tdeioslave/media/mounthelper/decryptdialog.ui b/tdeioslave/media/mounthelper/decryptdialog.ui
new file mode 100644
index 000000000..939f0a36a
--- /dev/null
+++ b/tdeioslave/media/mounthelper/decryptdialog.ui
@@ -0,0 +1,201 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>DecryptDialog</class>
+<widget class="TQWidget">
+ <property name="name">
+ <cstring>DecryptDialog</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>207</width>
+ <height>172</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>3</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="caption">
+ <string>Decrypting Storage Device</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQLayoutWidget" row="0" column="0">
+ <property name="name">
+ <cstring>layout5</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQLayoutWidget">
+ <property name="name">
+ <cstring>layout4</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQLabel">
+ <property name="name">
+ <cstring>encryptedIcon</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>48</width>
+ <height>48</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32</width>
+ <height>32</height>
+ </size>
+ </property>
+ <property name="scaledContents">
+ <bool>true</bool>
+ </property>
+ <property name="alignment">
+ <set>AlignTop</set>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer2_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>31</width>
+ <height>41</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="TQLabel">
+ <property name="name">
+ <cstring>descLabel</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>3</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&lt;p&gt;&lt;b&gt;%1&lt;/b&gt; is an encrypted storage device.&lt;/p&gt;
+&lt;p&gt;Please enter the password to decrypt the storage device.&lt;/p&gt;</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignTop</set>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="TQLayoutWidget" row="1" column="0">
+ <property name="name">
+ <cstring>layout4</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Password:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>passwordEdit</cstring>
+ </property>
+ </widget>
+ <widget class="TQLineEdit">
+ <property name="name">
+ <cstring>passwordEdit</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="echoMode">
+ <enum>Password</enum>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="TQGroupBox" row="2" column="0">
+ <property name="name">
+ <cstring>errorBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>3</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Error</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQLabel" row="0" column="0">
+ <property name="name">
+ <cstring>errorLabel</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>3</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignTop</set>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/tdeioslave/media/mounthelper/dialog.cpp b/tdeioslave/media/mounthelper/dialog.cpp
new file mode 100644
index 000000000..40e99a84d
--- /dev/null
+++ b/tdeioslave/media/mounthelper/dialog.cpp
@@ -0,0 +1,68 @@
+/* This file is part of the KDE project
+ * Copyright (C) 2007 Jan Klötzke <jan kloetzke at freenet de>
+ *
+ * Based on kryptomedia- Another KDE cryto media application.
+ * Copyright (C) 2006 Daniel Gollub <dgollub@suse.de>
+ *
+ * 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 "dialog.h"
+
+Dialog::Dialog(TQString url, TQString iconName) :
+ KDialogBase(NULL, "Dialog", true, "Decrypt Storage Device", (Cancel|User1), User1, false, KGuiItem(i18n("Decrypt"), "decrypted" ))
+{
+ decryptDialog = new DecryptDialog(this);
+
+ decryptDialog->errorBox->hide();
+ decryptDialog->descLabel->setText(decryptDialog->descLabel->text().arg(url));
+ decryptDialog->descLabel->adjustSize();
+ decryptDialog->adjustSize();
+
+ enableButton( User1, false );
+
+ TQPixmap pixmap = TDEGlobal::iconLoader()->loadIcon(iconName, KIcon::NoGroup, KIcon::SizeLarge);
+ decryptDialog->encryptedIcon->setPixmap( pixmap );
+
+ connect(decryptDialog->passwordEdit, TQT_SIGNAL (textChanged(const TQString &)), this, TQT_SLOT (slotPasswordChanged(const TQString &)));
+
+ setMainWidget(decryptDialog);
+}
+
+Dialog::~Dialog()
+{
+ delete decryptDialog;
+}
+
+TQString Dialog::getPassword()
+{
+ return decryptDialog->passwordEdit->text();
+}
+
+void Dialog::slotDialogError(TQString errorMsg)
+{
+ kdDebug() << __func__ << "(" << errorMsg << " )" << endl;
+
+ decryptDialog->errorLabel->setText(TQString("<b>%1</b>").arg(errorMsg));
+ decryptDialog->errorBox->show();
+}
+
+void Dialog::slotPasswordChanged(const TQString &text)
+{
+ enableButton( User1, !text.isEmpty() );
+}
+
+#include "dialog.moc"
diff --git a/tdeioslave/media/mounthelper/dialog.h b/tdeioslave/media/mounthelper/dialog.h
new file mode 100644
index 000000000..dc1d552d8
--- /dev/null
+++ b/tdeioslave/media/mounthelper/dialog.h
@@ -0,0 +1,61 @@
+/* This file is part of the KDE project
+ * Copyright (C) 2007 Jan Klötzke <jan kloetzke at freenet de>
+ *
+ * Based on kryptomedia- Another KDE cryto media application.
+ * Copyright (C) 2006 Daniel Gollub <dgollub@suse.de>
+ *
+ * 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 DIALOG_H_
+#define DIALOG_H_
+
+#include <kmessagebox.h>
+#include <klocale.h>
+#include <tdeconfig.h>
+#include <kdebug.h>
+#include <kdialogbase.h>
+#include <kiconloader.h>
+
+#include <tqlineedit.h>
+#include <tqlabel.h>
+#include <tqgroupbox.h>
+
+#include "decryptdialog.h"
+
+class KryptoMedia;
+
+class Dialog : public KDialogBase
+{
+
+Q_OBJECT
+
+public:
+ Dialog(TQString url, TQString iconName);
+ ~Dialog();
+
+ TQString getPassword();
+
+public slots:
+ void slotDialogError(TQString errorMsg);
+ void slotPasswordChanged(const TQString &text);
+
+private:
+ DecryptDialog *decryptDialog;
+};
+
+#endif // DIALOG_H_
+
diff --git a/tdeioslave/media/mounthelper/kio_media_mounthelper.cpp b/tdeioslave/media/mounthelper/kio_media_mounthelper.cpp
new file mode 100644
index 000000000..f321293d6
--- /dev/null
+++ b/tdeioslave/media/mounthelper/kio_media_mounthelper.cpp
@@ -0,0 +1,282 @@
+/* This file is part of the KDE project
+ Copyright (c) 2004 Kévin Ottens <ervin ipsquad net>
+ Parts of this file are
+ Copyright 2003 Waldo Bastian <bastian@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., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include <kcmdlineargs.h>
+#include <klocale.h>
+#include <kapplication.h>
+#include <kurl.h>
+#include <kmessagebox.h>
+#include <dcopclient.h>
+#include <dcopref.h>
+#include <tqtimer.h>
+#include <stdlib.h>
+#include <kdebug.h>
+#include <kglobal.h>
+#include <kprocess.h>
+#include <kstartupinfo.h>
+#include <kmimetype.h>
+
+#include "dialog.h"
+#include "kio_media_mounthelper.h"
+
+const Medium MountHelper::findMedium(const KURL &url)
+{
+ DCOPRef mediamanager("kded", "mediamanager");
+
+ // Try filename first
+ DCOPReply reply = mediamanager.call( "properties", url.fileName() );
+ if ( !reply.isValid() ) {
+ m_errorStr = i18n("The TDE mediamanager is not running.")+"\n";
+ return Medium(TQString::null, TQString::null, TQString::null);
+ }
+ const Medium& medium = Medium::create(reply);
+ if ( medium.id().isEmpty() ) {
+ // Try full URL now
+ reply = mediamanager.call( "properties", url.prettyURL() );
+ if ( !reply.isValid() ) {
+ m_errorStr = i18n("Internal Error");
+ return Medium(TQString::null, TQString::null, TQString::null);
+ }
+ return Medium::create(reply);
+ } else {
+ return medium;
+ }
+}
+
+MountHelper::MountHelper() : TDEApplication()
+{
+ TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs();
+
+ m_errorStr = TQString::null;
+
+ KURL url(args->url(0));
+ const Medium medium = findMedium(url);
+
+ if ( medium.id().isEmpty() )
+ {
+ if (m_errorStr.isEmpty())
+ m_errorStr+= i18n("%1 cannot be found.").arg(url.prettyURL());
+ TQTimer::singleShot(0, this, TQT_SLOT(error()) );
+ return;
+ }
+
+ if ( !medium.isMountable() && !args->isSet("e") && !args->isSet("s"))
+ {
+ m_errorStr = i18n("%1 is not a mountable media.").arg(url.prettyURL());
+ TQTimer::singleShot(0, this, TQT_SLOT(error()) );
+ return;
+ }
+
+ TQString device = medium.deviceNode();
+ TQString mount_point = medium.mountPoint();
+
+ m_isCdrom = medium.mimeType().find("dvd")!=-1
+ || medium.mimeType().find("cd")!=-1;
+
+ if (args->isSet("d"))
+ {
+ if (!medium.isEncrypted())
+ {
+ m_errorStr = i18n("%1 is not an encrypted media.").arg(url.prettyURL());
+ TQTimer::singleShot(0, this, TQT_SLOT(error()) );
+ return;
+ }
+ if (!medium.needDecryption())
+ {
+ m_errorStr = i18n("%1 is already decrypted.").arg(url.prettyURL());
+ TQTimer::singleShot(0, this, TQT_SLOT(error()) );
+ return;
+ }
+
+ TQString iconName = medium.iconName();
+ if (iconName.isEmpty())
+ {
+ TQString mime = medium.mimeType();
+ iconName = KMimeType::mimeType(mime)->icon(mime, false);
+ }
+
+ m_mediumId = medium.id();
+ dialog = new Dialog(url.prettyURL(), iconName);
+ dialog->show();
+
+ connect(dialog, TQT_SIGNAL (user1Clicked()), this, TQT_SLOT (slotSendPassword()));
+ connect(dialog, TQT_SIGNAL (cancelClicked()), this, TQT_SLOT (slotCancel()));
+ connect(this, TQT_SIGNAL (signalPasswordError(TQString)), dialog, TQT_SLOT (slotDialogError(TQString)));
+ }
+ else if (args->isSet("u"))
+ {
+ DCOPRef mediamanager("kded", "mediamanager");
+ DCOPReply reply = mediamanager.call( "unmount", medium.id());
+ if (reply.isValid())
+ reply.get(m_errorStr);
+ kdDebug() << "medium unmount " << m_errorStr << endl;
+ if (m_errorStr.isNull())
+ ::exit(0);
+ else
+ error();
+ }
+ else if (args->isSet("s") || args->isSet("e"))
+ {
+ DCOPRef mediamanager("kded", "mediamanager");
+
+ /*
+ * We want to call mediamanager unmount before invoking eject. That's
+ * because unmount would provide an informative error message in case of
+ * failure. However, there are cases when unmount would fail
+ * (supermount, slackware, see bug#116209) but eject would succeed.
+ * Thus if unmount fails, save unmount error message and invokeEject()
+ * anyway. Only if both unmount and eject fail, notify the user by
+ * displaying the saved error message (see ejectFinished()).
+ */
+ if (medium.isMounted())
+ {
+ DCOPReply reply = mediamanager.call( "unmount", medium.id());
+ if (reply.isValid())
+ reply.get(m_errorStr);
+ }
+
+ /* If this is a decrypted volume and there is no error yet
+ * we try to teardown the decryption */
+ if (m_errorStr.isNull() && medium.isEncrypted() && !medium.clearDeviceUdi().isNull())
+ {
+ DCOPReply reply = mediamanager.call( "undecrypt", medium.id());
+ if (reply.isValid())
+ reply.get(m_errorStr);
+ }
+
+ if (m_errorStr.isNull())
+ invokeEject(device, true);
+ else
+ error();
+ }
+ else
+ {
+ DCOPRef mediamanager("kded", "mediamanager");
+ DCOPReply reply = mediamanager.call( "mount", medium.id());
+ if (reply.isValid())
+ reply.get(m_errorStr);
+ if (m_errorStr.isNull())
+ ::exit(0);
+ else
+ error();
+ }
+}
+
+void MountHelper::invokeEject(const TQString &device, bool quiet)
+{
+ TDEProcess *proc = new TDEProcess(TQT_TQOBJECT(this));
+ *proc << "kdeeject";
+ if (quiet)
+ {
+ *proc << "-q";
+ }
+ *proc << device;
+ connect( proc, TQT_SIGNAL(processExited(TDEProcess *)),
+ this, TQT_SLOT( ejectFinished(TDEProcess *) ) );
+ proc->start();
+}
+
+void MountHelper::ejectFinished(TDEProcess* proc)
+{
+ /*
+ * If eject failed, report the error stored in m_errorStr
+ */
+ if (proc->normalExit() && proc->exitStatus() == 0) {
+ ::exit(0);
+ } else {
+ if (m_errorStr.isEmpty()) {
+ if (m_isCdrom)
+ m_errorStr = i18n("The device was successfully unmounted, but the tray could not be opened");
+ else
+ m_errorStr = i18n("The device was successfully unmounted, but could not be ejected");
+ }
+//X Comment this because the error is useless as long as the unmount is successful.
+//X TQTimer::singleShot(0, this, TQT_SLOT(error()));
+ ::exit(0);
+ }
+}
+
+void MountHelper::error()
+{
+ TQString prettyErrorString = m_errorStr;
+ if (m_errorStr.contains("<") && m_errorStr.contains(">")) {
+ if (!m_errorStr.contains("<qt>")) {
+ prettyErrorString = TQString("<qt>%1</qt>").arg(m_errorStr);
+ }
+ }
+ KMessageBox::error(0, prettyErrorString);
+ ::exit(1);
+}
+
+void MountHelper::slotSendPassword()
+{
+ DCOPRef mediamanager("kded", "mediamanager");
+
+ DCOPReply reply = mediamanager.call( "decrypt", m_mediumId, dialog->getPassword() );
+ if (!reply.isValid()) {
+ m_errorStr = i18n("The TDE mediamanager is not running.");
+ error();
+ } else {
+ TQString errorMsg = reply;
+ if (errorMsg.isNull()) {
+ exit(0);
+ } else {
+ emit signalPasswordError(errorMsg);
+ }
+ }
+}
+
+void MountHelper::slotCancel()
+{
+ exit(0);
+}
+
+static KCmdLineOptions options[] =
+{
+ { "d", I18N_NOOP("Decrypt given URL"), 0 },
+ { "u", I18N_NOOP("Unmount given URL"), 0 },
+ { "m", I18N_NOOP("Mount given URL (default)"), 0 },
+ { "e", I18N_NOOP("Eject given URL via kdeeject"), 0},
+ { "s", I18N_NOOP("Unmount and Eject given URL (necessary for some USB devices)"), 0},
+ {"!+URL", I18N_NOOP("media:/ URL to mount/unmount/eject/remove"), 0 },
+ KCmdLineLastOption
+};
+
+
+int main(int argc, char **argv)
+{
+ TDECmdLineArgs::init(argc, argv, "kio_media_mounthelper",
+ "kio_media_mounthelper", "kio_media_mounthelper",
+ "0.1");
+
+ TDECmdLineArgs::addCmdLineOptions( options );
+ TDEGlobal::locale()->setMainCatalogue("kio_media");
+ TDEApplication::addCmdLineOptions();
+
+ if (TDECmdLineArgs::parsedArgs()->count()==0) TDECmdLineArgs::usage();
+ TDEApplication *app = new MountHelper();
+
+ KStartupInfo::appStarted();
+ app->dcopClient()->attach();
+ return app->exec();
+}
+
+#include "kio_media_mounthelper.moc"
diff --git a/tdeioslave/media/mounthelper/kio_media_mounthelper.h b/tdeioslave/media/mounthelper/kio_media_mounthelper.h
new file mode 100644
index 000000000..50ea88b3b
--- /dev/null
+++ b/tdeioslave/media/mounthelper/kio_media_mounthelper.h
@@ -0,0 +1,57 @@
+/* This file is part of the KDE project
+ Copyright (c) 2004 Kévin Ottens <ervin ipsquad net>
+ Parts of this file are
+ Copyright 2003 Waldo Bastian <bastian@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., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef _KIO_MEDIA_MOUNTHELPER_H_
+#define _KIO_MEDIA_MOUNTHELPER_H_
+
+#include <kapplication.h>
+#include <tqstring.h>
+#include <tdeio/job.h>
+
+#include "medium.h"
+
+class Dialog;
+
+class MountHelper : public TDEApplication
+{
+ Q_OBJECT
+public:
+ MountHelper();
+
+private:
+ const Medium findMedium(const KURL &url);
+ void invokeEject(const TQString &device, bool quiet=false);
+ TQString m_errorStr;
+ bool m_isCdrom;
+ TQString m_mediumId;
+ Dialog *dialog;
+
+private slots:
+ void slotSendPassword();
+ void slotCancel();
+ void ejectFinished(TDEProcess* proc);
+ void error();
+
+signals:
+ void signalPasswordError(TQString errorMsg);
+};
+
+#endif