void GlobalBookmarkManager::doExport(ExportType type, const QString & _path) { //it can be null when we use command line to export => there is not interface if ( KEBApp::self() && KEBApp::self()->bkInfo() ) KEBApp::self()->bkInfo()->commitChanges(); QString path(_path); // TODO - add a factory and make all this use the base class if (type == OperaExport) { if (path.isNull()) path = KOperaBookmarkImporterImpl().findDefaultLocation(true); KOperaBookmarkExporterImpl exporter(mgr(), path); exporter.write(mgr()->root()); return; } else if (type == HTMLExport) { if (path.isNull()) path = KFileDialog::getSaveFileName( QDir::homePath(), i18n("*.html|HTML Bookmark Listing"), KEBApp::self() ); HTMLExporter exporter; exporter.write(mgr()->root(), path); return; } else if (type == IEExport) { if (path.isNull()) path = KIEBookmarkImporterImpl().findDefaultLocation(true); KIEBookmarkExporterImpl exporter(mgr(), path); exporter.write(mgr()->root()); return; } bool moz = (type == MozillaExport); if (path.isNull()) { if (moz) { KMozillaBookmarkImporterImpl importer; path = importer.findDefaultLocation(true); } else { KNSBookmarkImporterImpl importer; path = importer.findDefaultLocation(true); } } if (!path.isEmpty()) { KNSBookmarkExporterImpl exporter(mgr(), path); exporter.write(mgr()->root()); } }
QString MozImportCommand::requestFilename() const { static KMozillaBookmarkImporterImpl importer; return importer.findDefaultLocation(); }