parley
export.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include "export.h"
00015
00016 #include "xsldialog.h"
00017 #include "parleydocument.h"
00018
00019 #include <KStandardDirs>
00020 #include <KUrl>
00021 #include <KDebug>
00022 #include <KFileDialog>
00023 #include <KLocalizedString>
00024
00025
00026 void ParleyExport::exportDocument(ParleyDocument* document, QWidget * parent)
00027 {
00028
00029 QString filter = "*.html|" + i18n("HTML document") + '\n' + KEduVocDocument::pattern(KEduVocDocument::Writing);
00030
00031 KFileDialog dlg( (document->document()->url().fileName() == i18n("Untitled")) ? "": document->document()->url().path(), filter, parent );
00032 dlg.setOperationMode( KFileDialog::Saving );
00033 dlg.setMode( KFile::File );
00034 dlg.setWindowTitle(i18n("Export As"));
00035 if (dlg.exec() != QDialog::Accepted) {
00036 return;
00037 }
00038
00039 QString filename = dlg.selectedFile();
00040
00041 QString documentType = dlg.currentFilter();
00042 kDebug() << documentType;
00043
00044
00045 if (documentType == "*.html") {
00046 XslDialog dlg(filename, document->document(), parent);
00047 dlg.exec();
00048 } else {
00049 document->saveAs(filename);
00050 }
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00067
00068
00069 }
00070