summaryrefslogtreecommitdiffstats
path: root/ark/archiveformatdlg.cpp
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit2bda8f7717adf28da4af0d34fb82f63d2868c31d (patch)
tree8d927b7b47a90c4adb646482a52613f58acd6f8c /ark/archiveformatdlg.cpp
downloadtdeutils-2bda8f7717adf28da4af0d34fb82f63d2868c31d.tar.gz
tdeutils-2bda8f7717adf28da4af0d34fb82f63d2868c31d.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeutils@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'ark/archiveformatdlg.cpp')
-rw-r--r--ark/archiveformatdlg.cpp71
1 files changed, 71 insertions, 0 deletions
diff --git a/ark/archiveformatdlg.cpp b/ark/archiveformatdlg.cpp
new file mode 100644
index 0000000..be046fb
--- /dev/null
+++ b/ark/archiveformatdlg.cpp
@@ -0,0 +1,71 @@
+/*
+ ark -- archiver for the KDE project
+
+ Copyright (C) 2003: Georg Robbers <Georg.Robbers@urz.uni-hd.de>
+
+ 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+*/
+
+#include "archiveformatdlg.h"
+#include "archiveformatinfo.h"
+#include "arch.h"
+
+#include <klocale.h>
+
+#include <qlabel.h>
+#include <qvbox.h>
+
+ArchiveFormatDlg::ArchiveFormatDlg( QWidget * parent, const QString & defaultType )
+ :KDialogBase( parent, "archiveformatdialog", true,
+ i18n( "Choose Archive Format" ),
+ KDialogBase::Ok|KDialogBase::Cancel, KDialogBase::Ok),
+ m_combo( 0 )
+{
+ QString defaultDescription = ArchiveFormatInfo::self()->descriptionForMimeType( defaultType );
+ QString text;
+ if ( defaultDescription.isNull() )
+ text = i18n( "This file appears to be of type %1,\n"
+ "which is not a supported archive format.\n"
+ "In order to proceed, please choose the format\n"
+ "of the file." ).arg( defaultType );
+ else
+ text = i18n( "You are about to open a file that has a non-standard extension.\n"
+ "Ark has detected the format: %1\n"
+ "If this is not correct, please choose "
+ "the appropriate format." ).arg( defaultDescription );
+
+ QVBox * page = makeVBoxMainWidget();
+
+ QLabel * label;
+ label = new QLabel( text, page );
+
+ m_combo = new KComboBox( page );
+ QStringList list = ArchiveFormatInfo::self()->allDescriptions();
+ list.sort();
+ m_combo->insertStringList( list );
+ m_combo->setCurrentItem( list.findIndex( defaultDescription ) );
+}
+
+QString ArchiveFormatDlg::mimeType()
+{
+ if (m_combo && !m_combo->currentText().isEmpty())
+ return ArchiveFormatInfo::self()->mimeTypeForDescription( m_combo->currentText() );
+ else
+ return QString();
+}
+
+#include "archiveformatdlg.moc"
+