diff --git a/src/alttransview.cpp b/src/alttransview.cpp --- a/src/alttransview.cpp +++ b/src/alttransview.cpp @@ -69,11 +69,9 @@ { setAcceptDrops(true); -#ifndef NOKDE KConfig config; KConfigGroup group(&config, "AltTransView"); m_everShown = group.readEntry("EverShown", false); -#endif QSignalMapper* signalMapper = new QSignalMapper(this); @@ -230,16 +228,14 @@ cur.insertBlock(i % 2 ? blockFormatAlternate : blockFormatBase); } -#ifndef NOKDE if (!m_everShown) { m_everShown = true; show(); KConfig config; KConfigGroup group(&config, "AltTransView"); group.writeEntry("EverShown", true); } -#endif } diff --git a/src/binunitsview.cpp b/src/binunitsview.cpp --- a/src/binunitsview.cpp +++ b/src/binunitsview.cpp @@ -32,21 +32,17 @@ #include #include -#ifndef NOKDE #include #include -#endif //BEGIN BinUnitsModel BinUnitsModel::BinUnitsModel(Catalog* catalog, QObject* parent) : QAbstractListModel(parent) , m_catalog(catalog) { connect(catalog, QOverload<>::of(&Catalog::signalFileLoaded), this, &BinUnitsModel::fileLoaded); connect(catalog, &Catalog::signalEntryModified, this, &BinUnitsModel::entryModified); -#ifndef NOKDE connect(KDirWatch::self(), &KDirWatch::dirty, this, &BinUnitsModel::updateFile); -#endif } void BinUnitsModel::fileLoaded() @@ -112,9 +108,7 @@ QString path = index.column() == SourceFilePath ? m_catalog->source(pos) : m_catalog->target(pos); if (!m_imageCache.contains(path)) { QString absPath = Project::instance()->absolutePath(path); -#ifndef NOKDE KDirWatch::self()->addFile(absPath); //TODO remember watched files to react only on them in dirty() signal handler -#endif m_imageCache.insert(path, QImage(absPath).scaled(128, 128, Qt::KeepAspectRatio)); } return m_imageCache.value(path); @@ -213,9 +207,7 @@ void BinUnitsView::mouseDoubleClicked(const QModelIndex& item) { -#ifndef NOKDE //FIXME child processes don't notify us about changes ;( if (item.column() < BinUnitsModel::Approved) new KRun(QUrl::fromLocalFile(Project::instance()->absolutePath(item.data().toString())), this); -#endif } diff --git a/src/catalog/catalog.cpp b/src/catalog/catalog.cpp --- a/src/catalog/catalog.cpp +++ b/src/catalog/catalog.cpp @@ -37,9 +37,7 @@ #include "catalog.h" #include "catalog_private.h" #include "project.h" -#ifndef NOKDE #include "projectmodel.h" //to notify about modification -#endif #include "catalogstorage.h" #include "gettextstorage.h" @@ -115,7 +113,6 @@ , d(this) , m_storage(0) { -#ifndef NOKDE //cause refresh events for files modified from lokalize itself aint delivered automatically connect(this, QOverload::of(&Catalog::signalFileSaved), Project::instance()->model(), QOverload::of(&ProjectModel::slotFileSaved), Qt::QueuedConnection); @@ -126,7 +123,6 @@ connect(this, QOverload<>::of(&Catalog::signalFileSaved), t, QOverload<>::of(&QTimer::start)); connect(this, QOverload<>::of(&Catalog::signalFileLoaded), t, QOverload<>::of(&QTimer::start)); connect(this, &Catalog::indexChanged, this, &Catalog::setAutoSaveDirty); -#endif connect(Project::local(), &Project::configChanged, this, &Catalog::projectConfigChanged); } @@ -536,7 +532,6 @@ KAutoSaveFile* Catalog::checkAutoSave(const QString& url) { -#ifndef NOKDE KAutoSaveFile* autoSave = 0; QList staleFiles = KAutoSaveFile::staleFiles(QUrl::fromLocalFile(url)); foreach (KAutoSaveFile *stale, staleFiles) { @@ -549,9 +544,6 @@ if (autoSave) qCInfo(LOKALIZE_LOG) << "autoSave" << autoSave->fileName(); return autoSave; -#else - return 0; -#endif } int Catalog::loadFromUrl(const QString& filePath, const QString& saidUrl, int* fileSize, bool fast) @@ -615,7 +607,6 @@ //set some sane role, a real phase with a nmae will be created later with the first edit command setActivePhase(QString(), Project::local()->role()); -#ifndef NOKDE if (!fast) { KAutoSaveFile* autoSave = checkAutoSave(d._filePath); d._autoSaveRecovered = autoSave; @@ -633,7 +624,6 @@ } else d._autoSave->setManagedFile(QUrl::fromLocalFile(d._filePath)); } -#endif if (fileSize) *fileSize = file.size(); @@ -672,16 +662,12 @@ file.close(); -#ifndef NOKDE d._autoSave->remove(); d._autoSaveRecovered = false; -#endif setClean(); //undo/redo if (nameChanged) { d._filePath = localFilePath; -#ifndef NOKDE d._autoSave->setManagedFile(QUrl::fromLocalFile(localFilePath)); -#endif } //Settings::self()->setCurrentGroup("Bookmarks"); @@ -705,7 +691,6 @@ void Catalog::doAutoSave() { -#ifndef NOKDE if (isClean() || !(d._autoSaveDirty)) return; if (Q_UNLIKELY(!m_storage)) @@ -718,7 +703,6 @@ m_storage->save(d._autoSave); d._autoSave->close(); d._autoSaveDirty = false; -#endif } void Catalog::projectConfigChanged() diff --git a/src/catalog/catalog_private.h b/src/catalog/catalog_private.h --- a/src/catalog/catalog_private.h +++ b/src/catalog/catalog_private.h @@ -42,9 +42,7 @@ #include "pos.h" #include "alttrans.h" -#ifndef NOKDE #include -#endif #include #include @@ -76,9 +74,7 @@ int _numberOfPluralForms; QTimer _autoSaveTimer; -#ifndef NOKDE KAutoSaveFile* _autoSave; -#endif bool _autoSaveDirty; bool _autoSaveRecovered; @@ -110,9 +106,7 @@ explicit CatalogPrivate(QObject* parent) : fileCodec(0) , _numberOfPluralForms(-1) -#ifndef NOKDE , _autoSave(new KAutoSaveFile(parent)) -#endif , _autoSaveDirty(true) , _autoSaveRecovered(false) , _readOnly(false) diff --git a/src/catalog/catalogstring.cpp b/src/catalog/catalogstring.cpp --- a/src/catalog/catalogstring.cpp +++ b/src/catalog/catalogstring.cpp @@ -178,7 +178,7 @@ } if (!ctype.isEmpty()) - result += " (" + ctype + ")"; + result += " (" + ctype + ')'; return result; } diff --git a/src/catalog/gettext/gettextstorage.cpp b/src/catalog/gettext/gettextstorage.cpp --- a/src/catalog/gettext/gettextstorage.cpp +++ b/src/catalog/gettext/gettextstorage.cpp @@ -185,7 +185,7 @@ for (int i = 0; i < plurals.size(); i++) { pluralString += plurals.at(i); if (i != plurals.size() - 1) { - pluralString += "|"; + pluralString += '|'; } } return pluralString; @@ -201,7 +201,7 @@ for (int i = 0; i < plurals.size(); i++) { pluralString += plurals.at(i); if (i != plurals.size() - 1) { - pluralString += "|"; + pluralString += '|'; } } return pluralString; diff --git a/src/catalog/gettextheader.cpp b/src/catalog/gettextheader.cpp --- a/src/catalog/gettextheader.cpp +++ b/src/catalog/gettextheader.cpp @@ -652,12 +652,8 @@ i18nc("@window:title", "Author name missing"), i18n("Your name:"), QLineEdit::Normal, fullUserName(), &ok); -#ifndef NOKDE Settings::self()->authorNameItem()->setValue(ok ? contact : fullUserName()); Settings::self()->save(); -#else - Settings::self()->setAuthorName(ok ? contact : fullUserName()); -#endif } if (Settings::authorEmail().isEmpty()) { bool ok; @@ -667,12 +663,8 @@ QLineEdit::Normal, QString(), &ok); if (ok) { -#ifndef NOKDE Settings::self()->authorEmailItem()->setValue(email); Settings::self()->save(); -#else - Settings::self()->setAuthorEmail(email); -#endif } } } diff --git a/src/catalog/pos.cpp b/src/catalog/pos.cpp --- a/src/catalog/pos.cpp +++ b/src/catalog/pos.cpp @@ -120,7 +120,6 @@ return true; } -#ifndef NOKDE #include const QDBusArgument &operator>>(const QDBusArgument &argument, DocPosition& pos) { @@ -151,4 +150,3 @@ return argument; } -#endif diff --git a/src/cataloglistview/cataloglistview.cpp b/src/cataloglistview/cataloglistview.cpp --- a/src/cataloglistview/cataloglistview.cpp +++ b/src/cataloglistview/cataloglistview.cpp @@ -43,10 +43,8 @@ #include #include -#include -#ifndef NOKDE -#include -#endif +#include +#include class CatalogTreeView: public QTreeView { @@ -88,7 +86,7 @@ m_lineEdit->setClearButtonEnabled(true); m_lineEdit->setPlaceholderText(i18n("Quick search...")); - m_lineEdit->setToolTip(i18nc("@info:tooltip", "Activated by Ctrl+L.") + " " + i18nc("@info:tooltip", "Accepts regular expressions")); + m_lineEdit->setToolTip(i18nc("@info:tooltip", "Activated by Ctrl+L.") + ' ' + i18nc("@info:tooltip", "Accepts regular expressions")); connect(m_lineEdit, &QLineEdit::textChanged, this, &CatalogView::setFilterRegExp, Qt::QueuedConnection); // QShortcut* ctrlEsc=new QShortcut(QKeySequence(Qt::META+Qt::Key_Escape),this,SLOT(reset()),0,Qt::WidgetWithChildrenShortcut); QShortcut* esc = new QShortcut(QKeySequence(Qt::Key_Escape), this, 0, 0, Qt::WidgetWithChildrenShortcut); diff --git a/src/cataloglistview/catalogmodel.cpp b/src/cataloglistview/catalogmodel.cpp --- a/src/cataloglistview/catalogmodel.cpp +++ b/src/cataloglistview/catalogmodel.cpp @@ -28,9 +28,7 @@ #include "catalog.h" #include "project.h" -#ifndef NOKDE #include -#endif #include #include @@ -140,23 +138,14 @@ bool modified = m_catalog->isModified(index.row()); return m_fonts.at(fuzzy * 1 | modified * 2); } else if (role == Qt::ForegroundRole) { -#ifndef NOKDE if (m_catalog->isBookmarked(index.row())) { static KColorScheme colorScheme(QPalette::Normal); return colorScheme.foreground(KColorScheme::LinkText); } if (m_catalog->isObsolete(index.row())) { static KColorScheme colorScheme(QPalette::Normal); return colorScheme.foreground(KColorScheme::InactiveText); } -#else - if (m_catalog->isBookmarked(index.row())) { - return QApplication::palette().link(); - } - if (m_catalog->isObsolete(index.row())) { - return QApplication::palette().brightText(); - } -#endif } else if (role == Qt::UserRole) { switch (index.column()) { case TranslationStatus: return m_catalog->isApproved(index.row()); diff --git a/src/common/fastsizehintitemdelegate.h b/src/common/fastsizehintitemdelegate.h --- a/src/common/fastsizehintitemdelegate.h +++ b/src/common/fastsizehintitemdelegate.h @@ -29,9 +29,7 @@ #include #include -#ifndef NOKDE #include -#endif QString convertToHtml(QString string, bool italics = false); @@ -73,9 +71,7 @@ }; mutable QCache cache; -#ifndef NOKDE KColorScheme activeScheme; -#endif }; #endif // FASTSIZEHINTITEMDELEGATE_H diff --git a/src/common/fastsizehintitemdelegate.cpp b/src/common/fastsizehintitemdelegate.cpp --- a/src/common/fastsizehintitemdelegate.cpp +++ b/src/common/fastsizehintitemdelegate.cpp @@ -33,9 +33,7 @@ : QItemDelegate(parent) , singleLineColumns(slc) , richTextColumns(rtc) -#ifndef NOKDE , activeScheme(QPalette::Active, KColorScheme::View) -#endif {} void FastSizeHintItemDelegate::reset() @@ -67,23 +65,13 @@ painter->setClipping(true); painter->setClipRect(option.rect); QBrush bgBrush; -#ifndef NOKDE const KColorScheme& scheme = activeScheme; if (option.state & QStyle::State_MouseOver) bgBrush = scheme.background(KColorScheme::LinkBackground); else if (index.row() % 2) bgBrush = scheme.background(KColorScheme::AlternateBackground); else bgBrush = scheme.background(KColorScheme::NormalBackground); -#else - static QPalette p; - if (option.state & QStyle::State_MouseOver) - bgBrush = p.highlight(); - else if (index.row() % 2) - bgBrush = p.alternateBase(); - else - bgBrush = p.base(); -#endif painter->fillRect(option.rect, bgBrush); painter->setClipRect(option.rect.adjusted(0, 0, -2, 0)); diff --git a/src/common/languagelistmodel.h b/src/common/languagelistmodel.h --- a/src/common/languagelistmodel.h +++ b/src/common/languagelistmodel.h @@ -60,12 +60,6 @@ QString langCodeForSortModelRow(int); }; -QString getTargetLangCode(const QString& title, bool askUser = -#ifndef NOKDE - false -#else - true -#endif - ); +QString getTargetLangCode(const QString& title, bool askUser = false); #endif // LANGUAGELISTMODEL_H diff --git a/src/common/languagelistmodel.cpp b/src/common/languagelistmodel.cpp --- a/src/common/languagelistmodel.cpp +++ b/src/common/languagelistmodel.cpp @@ -23,11 +23,8 @@ #include "languagelistmodel.h" -#ifndef NOKDE -//#include #include #include -#endif #include #include @@ -66,20 +63,9 @@ LanguageListModel::LanguageListModel(ModelType type, QObject* parent) : QStringListModel(parent) , m_sortModel(new QSortFilterProxyModel(this)) -#ifndef NOKDE , m_systemLangList(new KConfig(QLatin1String("locale/kf5_all_languages"), KConfig::NoGlobals, QStandardPaths::GenericDataLocation)) -#endif { -#ifndef NOKDE setStringList(m_systemLangList->groupList()); -#else - QStringList ll; - QList allLocales = QLocale::matchingLocales(QLocale::AnyLanguage, QLocale::AnyScript, QLocale::AnyCountry); - foreach (const QLocale& l, allLocales) - ll.append(l.name()); - ll = ll.toSet().toList(); - setStringList(ll); -#endif if (type == WithEmptyLang) insertRows(rowCount(), 1); #if 0 //KDE5PORT @@ -94,7 +80,7 @@ QVariant LanguageListModel::data(const QModelIndex& index, int role) const { if (role == Qt::DecorationRole) { -#if 0 //#ifndef NOKDE +#if 0 //# static QMap iconCache; QString langCode = stringList().at(index.row()); @@ -117,15 +103,8 @@ static QVector displayNames(stringList().size()); if (displayNames.at(index.row()).length()) return displayNames.at(index.row()); -#ifndef NOKDE return QVariant::fromValue( displayNames[index.row()] = KConfigGroup(m_systemLangList, code).readEntry("Name") % QStringLiteral(" (") % code % ')'); -#else - QLocale l(code); -// if (l.language()==QLocale::C && code!="C") - return QVariant::fromValue( - displayNames[index.row()] = QLocale::languageToString(l.language()) % QStringLiteral(" (") % code % ')'); -#endif } return QStringListModel::data(index, role); } diff --git a/src/editortab.h b/src/editortab.h --- a/src/editortab.h +++ b/src/editortab.h @@ -34,7 +34,6 @@ #include #include -#ifndef NOKDE namespace Sonnet { class Dialog; @@ -49,7 +48,6 @@ class KFind; class KReplace; class KActionCategory; -#endif class Project; class Catalog; @@ -112,7 +110,6 @@ public: bool queryClose(); EditorState state(); -#ifndef NOKDE KXMLGUIClient* guiClient() { return (KXMLGUIClient*)this; @@ -126,7 +123,6 @@ { return m_adaptor; } -#endif //wrapper for cmdline handling void mergeOpen(QString mergeFilePath); @@ -215,22 +211,18 @@ Q_SCRIPTABLE bool findEntryBySourceContext(const QString& source, const QString& ctxt); -#ifndef NOKDE Q_SCRIPTABLE bool isValid() { return m_valid; } Q_SCRIPTABLE void setSrcFileOpenRequestAccepted(bool a) { m_srcFileOpenRequestAccepted = a; } -#endif private slots: -#ifndef NOKDE void highlightFound(const QString &, int, int); //for find/replace void highlightFound_(const QString &, int, int); //for find/replace -#endif void lookupSelectionInTranslationMemory(); @@ -248,16 +240,14 @@ void undo(); void redo(); -#ifndef NOKDE void findNext(); void findPrev(); void find(); void replace(); void replaceNext();//internal void doReplace(const QString&, int, int, int); //internal void cleanupReplace();//internal -#endif // void selectAll(); // void deselectAll(); @@ -279,14 +269,12 @@ void setApproveActionTitle(); -#ifndef NOKDE void spellcheck(); void spellcheckNext(); void spellcheckShow(const QString&, int); void spellcheckReplace(QString, int, const QString&); void spellcheckStop(); void spellcheckCancel(); -#endif void gotoNextBookmark(); void gotoPrevBookmark(); @@ -327,7 +315,7 @@ EditorView* m_view; QAction* m_approveAndGoAction; QAction* m_approveAction; - QAction* m_stateAction; //is = m_approveAction ifndef NOKDE + QAction* m_stateAction; KProcess* m_pologyProcess; bool m_pologyProcessInProgress; @@ -338,23 +326,19 @@ DocPosition _spellcheckPos; DocPosition _spellcheckStartPos; -#ifndef NOKDE Sonnet::BackgroundChecker* m_sonnetChecker; Sonnet::Dialog* m_sonnetDialog; int m_spellcheckStartUndoIndex; bool m_spellcheckStop: 1; -#endif bool m_currentIsApproved: 1; //for statusbar animation bool m_currentIsUntr: 1; //for statusbar animation bool m_fullPathShown: 1; -#ifndef NOKDE bool m_doReplaceCalled: 1; //used to prevent non-clean catalog status KFind* m_find; KReplace* m_replace; -#endif //BEGIN views MergeView* m_syncView; @@ -370,12 +354,10 @@ bool m_srcFileOpenRequestAccepted; //BEGIN dbus -#ifndef NOKDE bool m_valid; QObject* m_adaptor; int m_dbusId; static QList ids; -#endif //END dbus signals: diff --git a/src/editortab.cpp b/src/editortab.cpp --- a/src/editortab.cpp +++ b/src/editortab.cpp @@ -35,9 +35,7 @@ #include "completionstorage.h" -#ifndef NOKDE #define WEBQUERY_ENABLE -#endif //views #include "msgctxtview.h" @@ -60,15 +58,12 @@ #include "prefs_lokalize.h" #include "languagelistmodel.h" -#ifndef NOKDE #include #include #include #include #include #include -#endif - #include #include @@ -94,37 +89,28 @@ , m_catalog(new Catalog(this)) , m_view(new EditorView(this, m_catalog/*,new keyEventHandler(this,m_catalog)*/)) , m_pologyProcessInProgress(false) -#ifndef NOKDE , m_sonnetDialog(0) , m_spellcheckStartUndoIndex(0) , m_spellcheckStop(false) -#endif , m_currentIsApproved(true) , m_currentIsUntr(true) , m_fullPathShown(false) -#ifndef NOKDE , m_doReplaceCalled(false) , m_find(0) , m_replace(0) -#endif , m_syncView(0) , m_syncViewSecondary(0) -#ifndef NOKDE , m_valid(valid) , m_dbusId(-1) -#endif { //QTime chrono;chrono.start(); setAcceptDrops(true); setCentralWidget(m_view); setupStatusBar(); //--NOT called from initLater() ! setupActions(); - -#ifndef NOKDE dbusObjectPath(); -#endif connect(m_view, &EditorView::signalChanged, this, &EditorTab::msgStrChanged); msgStrChanged(); @@ -159,9 +145,7 @@ emit fileClosed(currentFile()); } -#ifndef NOKDE ids.removeAll(m_dbusId); -#endif } @@ -177,7 +161,6 @@ connect(m_catalog, &Catalog::signalNumberOfEmptyChanged, this, &EditorTab::numberOfUntranslatedChanged); } -#ifndef NOKDE void LokalizeSubwindowBase::reflectNonApprovedCount(int count, int total) { QString text = i18nc("@info:status message entries\n'fuzzy' in gettext terminology", "Not ready: %1", count); @@ -193,7 +176,6 @@ text += i18nc("percentages in statusbar", " (%1%)", int(100.0 * count / total)); statusBarItems.insert(ID_STATUS_UNTRANS, text); } -#endif void EditorTab::numberOfFuzziesChanged() { @@ -510,11 +492,6 @@ connect(this, &EditorTab::signalApprovedEntryDisplayed, this, &EditorTab::msgStrChanged, Qt::QueuedConnection); m_approveAction = action; -#ifdef NOKDE - QMenu* am = new QMenu(i18nc("@option:check whether message is marked as translated/reviewed/approved (depending on your role)", "State"), this); - action = am->menuAction(); - ac->addAction(QStringLiteral("edit_state"), action); -#endif m_stateAction = action; connect(Project::local(), &ProjectLocal::configChanged, this, &EditorTab::setApproveActionTitle); connect(m_catalog, &Catalog::activePhaseChanged, this, &EditorTab::setApproveActionTitle); @@ -565,15 +542,13 @@ ac->setDefaultShortcut(action, QKeySequence(Qt::CTRL + Qt::Key_M)); action->setText(i18nc("@action:inmenu", "Insert Next Tag")); -#ifndef NOKDE action = edit->addAction(QStringLiteral("edit_completion"), m_view, SIGNAL(doExplicitCompletion())); ac->setDefaultShortcut(action, QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_Space)); action->setText(i18nc("@action:inmenu", "Completion")); action = edit->addAction(QStringLiteral("edit_spellreplace"), m_view->viewPort(), SLOT(spellReplace())); ac->setDefaultShortcut(action, QKeySequence(Qt::CTRL + Qt::Key_Equal)); action->setText(i18nc("@action:inmenu", "Replace with best spellcheck suggestion")); -#endif // action = ac->addAction("glossary_define",m_view,SLOT(defineNewTerm())); // action->setText(i18nc("@action:inmenu","Define new term")); @@ -887,7 +862,6 @@ //Project if (!m_project->isLoaded()) { QFileInfo fileInfo(filePath); -#ifndef NOKDE //search for it int i = 4; QDir dir = fileInfo.dir(); @@ -898,7 +872,6 @@ if (!dir.cdUp()) break; } else m_project->load(dir.absoluteFilePath(dir.entryList().first())); } -#endif //enforce autosync m_syncViewSecondary->mergeOpen(filePath); @@ -927,12 +900,8 @@ } if (!silent) { -#ifndef NOKDE if (errorLine > 0) KMessageBox::error(this, i18nc("@info", "Error opening the file %1, line: %2", filePath, errorLine)); else KMessageBox::error(this, i18nc("@info", "Error opening the file %1", filePath)); -#else - KMessageBox::error(this, i18nc("@info", "Error opening the file")); -#endif } return false; } @@ -963,19 +932,11 @@ return true; } const QString errorFilePath = filePath.isEmpty() ? m_catalog->url() : filePath; -#ifndef NOKDE if (KMessageBox::Continue == KMessageBox::warningContinueCancel(this, i18nc("@info", "Error saving the file %1\n" "Do you want to save to another file or cancel?", errorFilePath), i18nc("@title", "Error"), KStandardGuiItem::save()) ) -#else - if (QMessageBox::Yes == QMessageBox::warning(this, QString(), - i18nc("@info", "Error saving the file %1\n" - "Do you want to save to another file or cancel?").arg(errorFilePath), - QMessageBox::Yes | QMessageBox::No) - ) -#endif return saveFileAs(errorFilePath); return false; } @@ -1308,9 +1269,6 @@ m_approveAction->setText(i18nc("@option:check trans-unit state", titles[role])); m_approveAction->setToolTip(i18nc("@info:tooltip", helpText[role])); m_approveAndGoAction->setVisible(role == ProjectLocal::Approver); -#ifdef NOKDE - m_stateAction->setVisible(m_catalog->capabilities()&ExtendedStates); -#endif } void EditorTab::showStatesMenu() @@ -1690,7 +1648,6 @@ //BEGIN DBus interface -#ifndef NOKDE #include "editoradaptor.h" QList EditorTab::ids; @@ -1709,7 +1666,6 @@ } return EDITOR_PATH + QString::number(m_dbusId); } -#endif QString EditorTab::currentFilePath() diff --git a/src/editorview.h b/src/editorview.h --- a/src/editorview.h +++ b/src/editorview.h @@ -118,7 +118,6 @@ }; -#ifndef NOKDE class KLed; class QLabel; class LedsWidget: public QWidget @@ -137,6 +136,5 @@ KLed* ledUntr; QLabel* lblColumn; }; -#endif #endif diff --git a/src/editorview.cpp b/src/editorview.cpp --- a/src/editorview.cpp +++ b/src/editorview.cpp @@ -54,14 +54,11 @@ #include #include -#ifndef NOKDE #include #include #include -#endif //parent is set on qsplitter insertion -#ifndef NOKDE LedsWidget::LedsWidget(QWidget* parent): QWidget(parent) { KColorScheme colorScheme(QPalette::Normal); @@ -93,18 +90,15 @@ { lblColumn->setText(i18nc("@info:label cursor position", "Column: %1", column)); } -#endif EditorView::EditorView(QWidget *parent, Catalog* catalog/*,keyEventHandler* kh*/) : QSplitter(Qt::Vertical, parent) , m_catalog(catalog) , m_sourceTextEdit(new TranslationUnitTextEdit(catalog, DocPosition::Source, this)) , m_targetTextEdit(new TranslationUnitTextEdit(catalog, DocPosition::Target, this)) , m_pluralTabBar(new QTabBar(this)) -#ifndef NOKDE , m_leds(0) -#endif , m_modifiedAfterFind(false) { m_pluralTabBar->hide(); @@ -169,7 +163,6 @@ m_targetTextEdit->document()->setDefaultFont(Settings::msgFont()); m_sourceTextEdit->setVisualizeSeparators(Settings::self()->visualizeSeparators()); m_targetTextEdit->setVisualizeSeparators(Settings::self()->visualizeSeparators()); -#ifndef NOKDE if (m_leds) m_leds->setVisible(Settings::leds()); else if (Settings::leds()) { m_leds = new LedsWidget(this); @@ -181,7 +174,6 @@ connect(m_targetTextEdit, &TranslationUnitTextEdit::translatedEntryDisplayed, m_leds->ledUntr, &KLed::off); m_targetTextEdit->showPos(m_targetTextEdit->currentPos()); } -#endif } diff --git a/src/filesearch/filesearchtab.h b/src/filesearch/filesearchtab.h --- a/src/filesearch/filesearchtab.h +++ b/src/filesearch/filesearchtab.h @@ -65,7 +65,6 @@ void hideDocks() {}; void showDocks() {}; -#ifndef NOKDE KXMLGUIClient* guiClient() { return (KXMLGUIClient*)this; @@ -75,7 +74,6 @@ { return m_dbusId; } -#endif public slots: void copySourceToClipboard(); @@ -85,13 +83,11 @@ Q_SCRIPTABLE void addFilesToSearch(const QStringList&); Q_SCRIPTABLE void setSourceQuery(const QString&); Q_SCRIPTABLE void setTargetQuery(const QString&); -#ifndef NOKDE Q_SCRIPTABLE bool findGuiText(QString text) { return findGuiTextPackage(text, QString()); } Q_SCRIPTABLE bool findGuiTextPackage(QString text, QString package); -#endif void fileSearchNext(); void stopSearch(); void massReplace(const QRegExp &what, const QString& with); diff --git a/src/filesearch/filesearchtab.cpp b/src/filesearch/filesearchtab.cpp --- a/src/filesearch/filesearchtab.cpp +++ b/src/filesearch/filesearchtab.cpp @@ -56,11 +56,9 @@ #include -#ifndef NOKDE #include #include #include -#endif static QStringList doScanRecursive(const QDir& dir); @@ -514,10 +512,8 @@ while (--i > ID_STATUS_PROGRESS) statusBarItems.insert(i, QString()); -#ifndef NOKDE setXMLFile(QStringLiteral("filesearchtabui.rc"), true); dbusObjectPath(); -#endif KActionCollection* ac = actionCollection(); KActionCategory* srf = new KActionCategory(i18nc("@title actions category", "Search and replace in files"), ac); @@ -552,9 +548,7 @@ writeUiState("FileSearchResultsHeaderState", ui_fileSearchOptions->treeView->header()->saveState()); -#ifndef NOKDE ids.removeAll(m_dbusId); -#endif } void FileSearchTab::performSearch() @@ -891,7 +885,6 @@ ui->doReplace->setEnabled(false); } -#ifndef NOKDE #include "filesearchadaptor.h" #include @@ -925,5 +918,4 @@ } //END DBus interface -#endif diff --git a/src/glossary/glossarywindow.cpp b/src/glossary/glossarywindow.cpp --- a/src/glossary/glossarywindow.cpp +++ b/src/glossary/glossarywindow.cpp @@ -32,9 +32,7 @@ #include #include -#ifndef NOKDE #include -#endif #include #include @@ -237,7 +235,7 @@ m_filterEdit->setClearButtonEnabled(true); m_filterEdit->setPlaceholderText(i18n("Quick search...")); m_filterEdit->setFocus(); - m_filterEdit->setToolTip(i18nc("@info:tooltip", "Activated by Ctrl+L.") + " " + i18nc("@info:tooltip", "Accepts regular expressions")); + m_filterEdit->setToolTip(i18nc("@info:tooltip", "Activated by Ctrl+L.") + ' ' + i18nc("@info:tooltip", "Accepts regular expressions")); new QShortcut(Qt::CTRL + Qt::Key_L, this, SLOT(setFocus()), 0, Qt::WidgetWithChildrenShortcut); connect(m_filterEdit, &QLineEdit::textChanged, m_proxyModel, &GlossaryNS::GlossarySortFilterProxyModel::setFilterRegExp); @@ -249,13 +247,9 @@ QPushButton* rmBtn = new QPushButton(w); connect(rmBtn, &QPushButton::clicked, this, QOverload<>::of(&GlossaryWindow::rmTermEntry)); -#ifndef NOKDE KGuiItem::assign(addBtn, KStandardGuiItem::add()); KGuiItem::assign(rmBtn, KStandardGuiItem::remove()); -#else - addBtn->setText(QApplication::translate("KStandardGuiItem", "Add")); - rmBtn->setText(QApplication::translate("KStandardGuiItem", "Remove")); -#endif + QPushButton* restoreBtn = new QPushButton(i18nc("@action:button reloads glossary from disk", "Restore from disk"), w); restoreBtn->setToolTip(i18nc("@info:tooltip", "Reload glossary from disk, discarding any changes")); connect(restoreBtn, &QPushButton::clicked, this, &GlossaryWindow::restore); @@ -327,9 +321,7 @@ //TODO //connect(m_targetTermsModel,SIGNAL(dataChanged(QModelIndex,QModelIndex)),m_browser,SLOT(setFocus())); -#ifndef NOKDE setAutoSaveSettings(QLatin1String("GlossaryWindow"), true); -#endif //Glossary* glossary=Project::instance()->glossary(); /*setCaption(i18nc("@title:window","Glossary"), !glossary->changedIds.isEmpty()||!glossary->addedIds.isEmpty()||!glossary->removedIds.isEmpty()); diff --git a/src/lokalize.pro b/src/lokalize.pro --- a/src/lokalize.pro +++ b/src/lokalize.pro @@ -73,10 +73,7 @@ catalog/gettext/gettextimport.cpp\ catalog/gettext/gettextexport.cpp\ catalog/xliff/xliffstorage.cpp\ - catalog/ts/tsstorage.cpp\ - nokde-stubs/prefs.cpp\ - nokde-stubs/lokalizesubwindowbase.cpp\ - nokde-stubs/welcometab.cpp + catalog/ts/tsstorage.cpp mac: CONFIG += objective_c mac: OBJECTIVE_SOURCES += common/machelpers.mm @@ -129,25 +126,16 @@ catalog/cmd.h\ catalog/pos.h\ catalog/catalog.h\ - catalog/catalogstring.h\ - nokde-stubs/prefs.h\ - nokde-stubs/prefs_lokalize.h\ - nokde-stubs/projectbase.h\ - nokde-stubs/projectlocal.h\ - nokde-stubs/kaboutdata.h\ - nokde-stubs/welcometab.h + catalog/catalogstring.h FORMS += glossary/termedit.ui\ tm/queryoptions.ui\ tm/managedatabases.ui\ tm/dbparams.ui\ filesearch/filesearchoptions.ui\ - filesearch/massreplaceoptions.ui\ - nokde-stubs/welcomewidget.ui + filesearch/massreplaceoptions.ui -INCLUDEPATH += catalog catalog/gettext catalog/xliff catalog/ts cataloglistview mergemode glossary tm filesearch project common nokde-stubs filesearch - -DEFINES += NOKDE +INCLUDEPATH += catalog catalog/gettext catalog/xliff catalog/ts cataloglistview mergemode glossary tm filesearch project common filesearch #unix: LIBS += -lhunspell diff --git a/src/lokalizesubwindowbase.h b/src/lokalizesubwindowbase.h --- a/src/lokalizesubwindowbase.h +++ b/src/lokalizesubwindowbase.h @@ -32,7 +32,6 @@ #include "actionproxy.h" -#ifndef NOKDE #include #include @@ -112,156 +111,5 @@ } } }; -#else -#include -#include -#include -#include -#include -#include -#include "kmainwindow.h" -namespace KStandardAction -{ -/** - * The standard menubar and toolbar actions. - */ -enum StandardAction { - ActionNone, - - // File Menu - New, Open, OpenRecent, Save, SaveAs, Revert, Close, - Print, PrintPreview, Mail, Quit, - - // Edit Menu - Undo, Redo, Cut, Copy, Paste, SelectAll, Deselect, Find, FindNext, FindPrev, - Replace, - - // View Menu - ActualSize, FitToPage, FitToWidth, FitToHeight, ZoomIn, ZoomOut, - Zoom, Redisplay, - - // Go Menu - Up, Back, Forward, Home /*Home page*/, Prior, Next, Goto, GotoPage, GotoLine, - FirstPage, LastPage, DocumentBack, DocumentForward, - - // Bookmarks Menu - AddBookmark, EditBookmarks, - - // Tools Menu - Spelling, - - // Settings Menu - ShowMenubar, ShowToolbar, ShowStatusbar, - SaveOptions, KeyBindings, - Preferences, ConfigureToolbars, - - // Help Menu - Help, HelpContents, WhatsThis, ReportBug, AboutApp, AboutKDE, - TipofDay, - - // Other standard actions - ConfigureNotifications, - FullScreen, - Clear, - PasteText, - SwitchApplicationLanguage -}; -}; -class KActionCategory; -class KActionCollection -{ -public: - KActionCollection(QMainWindow* w); - ~KActionCollection() - { - qDeleteAll(categories); - } - static void setDefaultShortcut(QAction* a, const QKeySequence& s) - { - a->setShortcut(s); - } - static void setDefaultShortcuts(QAction* a, const QList& l) - { - a->setShortcuts(l); - } - - QAction* addAction(const QString& name, QAction* a); - - QMainWindow* m_mainWindow; - QMenu* file; - QMenu* edit; - QMenu* view; - QMenu* go; - QMenu* sync; - QMenu* tools; - QMenu* tm; - QMenu* glossary; - - QVector categories; -}; -class KActionCategory -{ -public: - KActionCategory(const QString&, KActionCollection* c_): c(c_) - { - c->categories.append(this); - } - QAction* addAction(const char* name, QAction* a) - { - return c->addAction(name, a); - } - QAction* addAction(const QString& name, QAction* a) - { - return c->addAction(name, a); - } - QAction* addAction(const QLatin1String& name, QAction* a) - { - return c->addAction(name, a); - } - QAction* addAction(const QString& name) - { - return c->addAction(name, new QAction(name, c->m_mainWindow)); - } - QAction* addAction(const QString& name, QObject* rcv, const char* slot) - { - QAction* a = new QAction(name, rcv); - QObject::connect(a, &QAction::triggered, rcv, slot); - return c->addAction(name, a); - } - QAction* addAction(KStandardAction::StandardAction, QObject* rcv, const char* slot); - - static void setDefaultShortcut(QAction* a, const QKeySequence& s) - { - a->setShortcut(s); - } - - KActionCollection* c; -}; -#define KToolBarPopupAction QAction -class LokalizeSubwindowBase2: public KMainWindow -{ -public: - LokalizeSubwindowBase2(QWidget* parent): KMainWindow(parent), c(new KActionCollection(this)) - { - } - virtual ~LokalizeSubwindowBase2() - { - delete c; - } - - void setXMLFile(const char*, bool f = false) {} - void setXMLFile(const QString&, bool f = false) {} - KActionCollection* actionCollection() const - { - return c; - } - - StatusBarProxy statusBarItems; -protected: - void reflectNonApprovedCount(int count, int total) {} - void reflectUntranslatedCount(int count, int total) {} - KActionCollection* c; -}; -#endif #endif diff --git a/src/main.cpp b/src/main.cpp --- a/src/main.cpp +++ b/src/main.cpp @@ -28,17 +28,12 @@ #include "prefs.h" #include "prefs_lokalize.h" -#ifndef NOKDE #include "version.h" #include "projecttab.h" #include "projectmodel.h" #include "lokalizemainwindow.h" #include "stemming.h" -#else -#define LOKALIZE_VERSION QStringLiteral("2.0") -#include "welcometab.h" -#endif #include "jobs.h" #include "catalogstring.h" @@ -53,38 +48,13 @@ #include #include -#ifndef NOKDE #include -#endif #include #include #include "editortab.h" -#ifdef NOKDE -#ifdef Q_OS_WIN -#include -#define FILEPATHMESSAGE 10 -char sentPath[256]; -COPYDATASTRUCT MyCDS; - -PCOPYDATASTRUCT pMyCDS; -LONG_PTR WINAPI windowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - if (message == WM_COPYDATA) { - pMyCDS = (PCOPYDATASTRUCT)lParam; - if (pMyCDS->dwData == FILEPATHMESSAGE) { - EditorTab* t = Project::instance()->fileOpen(QString::fromUtf8((char*)pMyCDS->lpData)); - if (t) t->activateWindow(); - } - return 0; - } - return DefWindowProc(hWnd, message, wParam, lParam); -} -#endif -#endif - int main(int argc, char **argv) { TM::threadPool()->setMaxThreadCount(1); @@ -108,7 +78,6 @@ about.addCredit(i18n("Papp Laszlo"), i18n("bug fixing patches"), QStringLiteral("djszapi@archlinux.us")); about.addCredit(i18n("Albert Astals Cid"), i18n("XLIFF improvements"), QStringLiteral("aacid@kde.org")); about.addCredit(i18n("Simon Depiets"), i18n("bug fixing and improvements"), QStringLiteral("sdepiets@gmail.com")); -#ifndef NOKDE KAboutData::setApplicationData(about); about.setupCommandLine(&parser); //parser.addOption(QCommandLineOption(QStringList() << QLatin1String("source"), i18n( "Source for the merge mode" ), QLatin1String("URL"))); @@ -118,22 +87,13 @@ parser.process(app); about.processCommandLine(&parser); -#else - QCoreApplication::setApplicationName(QStringLiteral("Lokalize")); - QCoreApplication::setApplicationVersion(LOKALIZE_VERSION); - QCoreApplication::setOrganizationName(QStringLiteral("KDE")); - QCoreApplication::setOrganizationDomain(QStringLiteral("kde.org")); - parser.process(app); -#endif - //qCDebug(LOKALIZE_LOG) is important as it avoids compile 'optimization'. qCDebug(LOKALIZE_LOG) << qRegisterMetaType(); qCDebug(LOKALIZE_LOG) << qRegisterMetaType(); qCDebug(LOKALIZE_LOG) << qRegisterMetaType(); qCDebug(LOKALIZE_LOG) << qRegisterMetaType(); qRegisterMetaTypeStreamOperators("InlineTag"); qRegisterMetaTypeStreamOperators("CatalogString"); -#ifndef NOKDE qAddPostRoutine(&cleanupSpellers); const KDBusService dbusService(KDBusService::Multiple); @@ -172,61 +132,12 @@ //Project::instance()->model()->setCompleteScan(parser.isSet("noprojectscan"));// TODO: negate check (and ensure nobody passes the no-op --noprojectscan argument) } -#else -#ifdef Q_OS_WIN - TCHAR gClassName[100]; - wsprintf(gClassName, TEXT("LokalizeResponder")); - - HWND responder = FindWindow(gClassName, L"LokalizeResponder"); - if (responder) { - for (int j = 0; j < parser.positionalArguments().count(); j++) { - if (!QFileInfo::exists(parser.positionalArguments().at(j))) continue; - strncpy(sentPath, parser.positionalArguments().at(j).toUtf8().constData(), 255); - MyCDS.dwData = FILEPATHMESSAGE; - MyCDS.cbData = sizeof(sentPath); // size of data - MyCDS.lpData = &sentPath; // data structure - SendMessage(responder, WM_COPYDATA, 0, (LPARAM)(LPVOID) &MyCDS); - } - return 0; - } - - WNDCLASS windowClass; - windowClass.style = CS_GLOBALCLASS | CS_DBLCLKS; - windowClass.lpfnWndProc = windowProc; - windowClass.cbClsExtra = 0; - windowClass.cbWndExtra = 0; - windowClass.hInstance = (HINSTANCE) GetModuleHandle(NULL); - windowClass.hIcon = 0; - windowClass.hCursor = 0; - windowClass.hbrBackground = 0; - windowClass.lpszMenuName = 0; - windowClass.lpszClassName = gClassName; - RegisterClass(&windowClass); - responder = CreateWindow(gClassName, L"LokalizeResponder", 0, 0, 0, 10, 10, 0, (HMENU)0, (HINSTANCE)GetModuleHandle(NULL), 0); -#endif - - SettingsController::instance()->ensureProjectIsLoaded(); - for (int j = 0; j < parser.positionalArguments().count(); j++) - if (QFileInfo::exists(parser.positionalArguments().at(j))) Project::instance()->fileOpen(parser.positionalArguments().at(j)); - if (!parser.positionalArguments().count()) { - WelcomeTab* welcome = new WelcomeTab(0); - welcome->move(QApplication::desktop()->screen()->rect().center() - welcome->rect().center()); - welcome->show(); - } - app.installEventFilter(Project::instance()); -#endif int code = app.exec(); -#ifdef NOKDE -#ifdef Q_OS_WIN - DestroyWindow(responder); -#endif -#endif QThreadPool::globalInstance()->clear(); TM::cancelAllJobs(); TM::threadPool()->clear(); TM::threadPool()->waitForDone(1000); -#ifndef NOKDE Project::instance()->model()->threadPool()->clear(); if (SettingsController::instance()->dirty) //for config changes done w/o config dialog @@ -246,9 +157,6 @@ QCoreApplication::processEvents(); QCoreApplication::sendPostedEvents(0, 0); } -#else - Settings::self()->save(); -#endif return code; } diff --git a/src/mergemode/mergeview.cpp b/src/mergemode/mergeview.cpp --- a/src/mergemode/mergeview.cpp +++ b/src/mergemode/mergeview.cpp @@ -31,10 +31,7 @@ #include #include #include - -#ifndef NOKDE #include -#endif #include #include @@ -230,7 +227,6 @@ } else { //KMessageBox::error(this, KIO::NetAccess::lastErrorString() ); cleanup(); -#ifndef NOKDE if (errorLine > 0) KMessageBox::error(this, i18nc("@info", "Error opening the file %1 for synchronization, error line: %2", mergeFilePath, errorLine)); else { @@ -240,7 +236,6 @@ notification->sendEvent(); */ } -#endif //i18nc("@info %1 is w/o path","No branch counterpart for %1",url.fileName()), } diff --git a/src/nokde-stubs/kaboutdata.h b/src/nokde-stubs/kaboutdata.h deleted file mode 100644 --- a/src/nokde-stubs/kaboutdata.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef KABOUTDATA_H -#define KABOUTDATA_H - -#include -#include -#include - -namespace KAboutLicense -{ -enum L {GPL}; -}; -struct Credit { - QString name, what, mail, site; -}; -class KAboutData: public QObject -{ - Q_OBJECT -public: - KAboutData(const QString&, const QString& n, const QString& v, const QString& d, KAboutLicense::L, const QString& c); - void addAuthor(const QString& name, const QString&, const QString& mail); - void addCredit(const QString& who, const QString& forwhat, const QString& mail, const QString& site = QString()); - - static KAboutData* instance; -public slots: - void doAbout(); -private: - QString name, version, description, copyright; - QVector credits; -}; - -#endif diff --git a/src/nokde-stubs/kcombobox.h b/src/nokde-stubs/kcombobox.h deleted file mode 100644 --- a/src/nokde-stubs/kcombobox.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef KCOMBOBOX_H -#define KCOMBOBOX_H - -#include -#include - -class KComboBox: public QComboBox -{ -public: - KComboBox(QWidget* p): QComboBox(p) {} - void setCurrentItem(const QString& s, bool insert = false) - { - setCurrentText(s); - if (insert) - if (QStringListModel* lm = qobject_cast(model())) { - QStringList l = lm->stringList(); - if (!l.contains(s)) l.append(s); - lm->setStringList(l); - } - } -}; - -#endif - diff --git a/src/nokde-stubs/klocalizedstring.h b/src/nokde-stubs/klocalizedstring.h deleted file mode 100644 --- a/src/nokde-stubs/klocalizedstring.h +++ /dev/null @@ -1,93 +0,0 @@ -/* **************************************************************************** - This file is part of Lokalize - - Copyright (C) 2007-2014 by Nick Shaforostoff - - 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) version 3 or any later version - accepted by the membership of KDE e.V. (or its successor approved - by the membership of KDE e.V.), which shall act as a proxy - defined in Section 14 of version 3 of the license. - - 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, see . - -**************************************************************************** */ - -#ifndef KLOCALIZEDSTRING_H -#define KLOCALIZEDSTRING_H - -#include - -static inline QString i18nc(const char* y, const char* x) -{ - return QObject::tr(x, y); -} -static inline QString i18nc(const char* y, const char* x, int n) -{ - return QObject::tr(x, y, n); -} -static inline QString i18nc(const char* y, const char* x, const QString& s) -{ - return QObject::tr(x, y).arg(s); -} -static inline QString i18nc(const char* y, const char* x, const QString& s1, const QString& s2) -{ - return QObject::tr(x, y).arg(s1).arg(s2); -} -static inline QString i18nc(const char* y, const char* x, int n, int m) -{ - return QObject::tr(x, y).arg(n).arg(m); -} -static inline QString i18n(const char* x, int n, int m) -{ - return QObject::tr(x).arg(n).arg(m); -} -static inline QString i18n(const char* x, const QString& s1, const QString& s2) -{ - return QObject::tr(x).arg(s1).arg(s2); -} -static inline QString i18n(const char* x) -{ - return QObject::tr(x); -} - -namespace KLocalizedString -{ -void setApplicationDomain(const char*); -}; - -#if 0 -QString i18nc(const char* y, const char* x); -QString i18nc(const char* y, const char* x, int n); -QString i18nc(const char* y, const char* x, const QString& s); -QString i18nc(const char* y, const char* x, const QString& s1, const QString& s2); -QString i18nc(const char* y, const char* x, int n, int m) -{ - return QObject::tr(x, y).arg(n).arg(m); -} -QString i18n(const char* x, int n, int m) -{ - return QObject::tr(x).arg(n).arg(m); -} -QString i18n(const char* x, const QString& s1, const QString& s2) -{ - return QObject::tr(x).arg(s1).arg(s2); -} -QString i18n(const char* x) -{ - return QObject::tr(x); -} -#endif - -#define I18N_NOOP2(y, x) x -#define I18N_NOOP(x) x - -#endif diff --git a/src/nokde-stubs/kmainwindow.h b/src/nokde-stubs/kmainwindow.h deleted file mode 100644 --- a/src/nokde-stubs/kmainwindow.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef KMAINWINDOW_H -#define KMAINWINDOW_H - -#include "lokalize_debug.h" - -#include -#include -#include - -class KMainWindow: public QMainWindow -{ -public: - KMainWindow(QWidget*): QMainWindow(0) - { - setAttribute(Qt::WA_DeleteOnClose, true); - } - void setCaption(const QString& s, bool m = false) - { - Q_UNUSED(m) setWindowTitle(s); - } - - virtual bool queryClose() - { - return true; - } - -protected: - void closeEvent(QCloseEvent *event) - { - event->setAccepted(queryClose()); - } -}; - -#endif - diff --git a/src/nokde-stubs/kmessagebox.h b/src/nokde-stubs/kmessagebox.h deleted file mode 100644 --- a/src/nokde-stubs/kmessagebox.h +++ /dev/null @@ -1,78 +0,0 @@ -#ifndef KMESSAGEBOX_H -#define KMESSAGEBOX_H - -#include - -namespace KStandardGuiItem -{ -static inline int save() -{ - return 0; -} -static inline int discard() -{ - return 0; -} -static inline int yes() -{ - return 0; -} -static inline int no() -{ - return 0; -} -}; - -#define KGuiItem(x) 0 - -class KMessageBox: public QMessageBox -{ -public: - enum {Continue = QMessageBox::Ignore}; - static QMessageBox::StandardButton warningYesNoCancel(QWidget *parent, const QString &text, - const QString &caption, - int y = 0, - int n = 0, - int c = 0, - const QString &dontAskAgainName = QString()) - { - Q_UNUSED(y) Q_UNUSED(n) Q_UNUSED(c) Q_UNUSED(dontAskAgainName) - return warning(parent, caption, text, Yes | No | Cancel, Yes); - } - static QMessageBox::StandardButton questionYesNoCancel(QWidget *parent, const QString &text, - const QString &caption, - int y = 0, - int n = 0, - int c = 0, - const QString &dontAskAgainName = QString()) - { - Q_UNUSED(y) Q_UNUSED(n) Q_UNUSED(c) Q_UNUSED(dontAskAgainName) - return question(parent, caption, text, Yes | No | Cancel, Yes); - } - - static QMessageBox::StandardButton questionYesNo(QWidget *parent, const QString &text, - const QString &caption, - int y = 0, - int n = 0, - const QString &dontAskAgainName = QString()) - { - Q_UNUSED(y) Q_UNUSED(n) Q_UNUSED(dontAskAgainName) - return question(parent, caption, text, Yes | No | Cancel, Yes); - } - static void information(QWidget *parent, - const QString &text, - const QString &caption = QString(), - const QString &dontShowAgainName = QString()) - { - Q_UNUSED(dontShowAgainName) - QMessageBox::information(parent, caption, text); - } - - static QMessageBox::StandardButton error(QWidget *parent, const QString &text) - { - return critical(parent, QString(), text); - } -}; - -#endif - diff --git a/src/nokde-stubs/kpassivepopup.h b/src/nokde-stubs/kpassivepopup.h deleted file mode 100644 --- a/src/nokde-stubs/kpassivepopup.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef KPASSIVEPOPUP_H -#define KPASSIVEPOPUP_H - - -namespace KPassivePopup -{ -enum {Balloon}; -void message(int, const QString &caption, const QString &text, - QWidget *parent) -{} - -}; - -#endif - diff --git a/src/nokde-stubs/ktextedit.h b/src/nokde-stubs/ktextedit.h deleted file mode 100644 --- a/src/nokde-stubs/ktextedit.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef KTEXTEDIT_H -#define KTEXTEDIT_H - -#include - -class KTextEdit: public QTextEdit -{ -public: - KTextEdit(QWidget* p): QTextEdit(p) {} - void setHighlighter(void*) {} - -}; - -#endif - diff --git a/src/nokde-stubs/lokalizesubwindowbase.cpp b/src/nokde-stubs/lokalizesubwindowbase.cpp deleted file mode 100644 --- a/src/nokde-stubs/lokalizesubwindowbase.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/* **************************************************************************** - This file is part of Lokalize - - Copyright (C) 2014 by Nick Shaforostoff - - 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) version 3 or any later version - accepted by the membership of KDE e.V. (or its successor approved - by the membership of KDE e.V.), which shall act as a proxy - defined in Section 14 of version 3 of the license. - - 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, see . - -**************************************************************************** */ - -#include "lokalizesubwindowbase.h" -#include "project.h" -#include "kaboutdata.h" -#include "klocalizedstring.h" -#include -#include -#include - -KActionCollection::KActionCollection(QMainWindow* w) - : m_mainWindow(w) - , file(m_mainWindow->menuBar()->addMenu(QApplication::translate("QMenuBar", "File"))) - , edit(m_mainWindow->menuBar()->addMenu(QApplication::translate("QMenuBar", "Edit"))) - , view(m_mainWindow->menuBar()->addMenu(QApplication::translate("QMenuBar", "View"))) - , go(m_mainWindow->menuBar()->addMenu(QApplication::translate("QMenuBar", "Go"))) - , sync(m_mainWindow->menuBar()->addMenu(QApplication::translate("QMenuBar", "Sync"))) - , tools(m_mainWindow->menuBar()->addMenu(QApplication::translate("QMenuBar", "Tools"))) - , tm(new QMenu(QApplication::translate("QMenuBar", "Translation Memory"))) - , glossary(new QMenu(QApplication::translate("QMenuBar", "Glossary"))) -{ - QAction* a = file->addAction(QApplication::translate("QMenuBar", "Open..."), Project::instance(), SLOT(fileOpen())); - a->setShortcut(QKeySequence::Open); - - a = file->addAction(QApplication::translate("QMenuBar", "Close"), m_mainWindow, SLOT(close())); - a->setShortcut(QKeySequence::Close); - - QMenu* help = m_mainWindow->menuBar()->addMenu(QApplication::translate("QMenuBar", "Help")); - a = help->addAction(QApplication::translate("QMenuBar", "About Lokalize"), KAboutData::instance, SLOT(doAbout())); - a->setMenuRole(QAction::AboutRole); - a = help->addAction(QApplication::translate("QMenuBar", "About Qt"), qApp, SLOT(aboutQt())); - a->setMenuRole(QAction::AboutQtRole); - - a = tools->addAction(i18nc("@action:inmenu", "Search and replace in files"), Project::instance(), &Project::showFileSearch); - a->setShortcut(QKeySequence::Find); - - a = tools->addAction(i18nc("@action:inmenu", "Find next in files"), Project::instance(), &Project::fileSearchNext); - a->setShortcut(QKeySequence::FindNext); - - tools->addSeparator(); - - a = tools->addAction(i18nc("@action:inmenu", "Translation memory"), Project::instance(), &Project::showTM); - a->setShortcut(Qt::Key_F7); -} - -QAction* KActionCollection::addAction(const QString& name, QAction* a) -{ - if (name.startsWith("file_")) file->addAction(a); - if (name.startsWith("edit_")) edit->addAction(a); - if (name.startsWith("merge_")) sync->addAction(a); - if (name.startsWith("go_")) go->addAction(a); - if (name.startsWith("tmquery_")) tm->addAction(a); - if (name.startsWith("glossary_insert")) glossary->addAction(a); - if (name.startsWith("show")) view->addAction(a); - if (name.startsWith("tools")) tools->addAction(a); - - if (name == "mergesecondary_back") { - if (!tm->isEmpty()) edit->addMenu(tm); - if (!glossary->isEmpty()) edit->addMenu(glossary); - } - return a; -} - - -QAction* KActionCategory::addAction(KStandardAction::StandardAction t, QObject* rcv, const char* slot) -{ - QString name = QStringLiteral("std"); - QMenu* m = 0; - QKeySequence::StandardKey k = QKeySequence::UnknownKey; - switch (t) { - case KStandardAction::Save: name = QApplication::translate("QMenuBar", "Save"); m = c->file; k = QKeySequence::Save; break; - case KStandardAction::SaveAs: name = QApplication::translate("QMenuBar", "Save As..."); m = c->file; k - QKeySequence::SaveAs; break; - case KStandardAction::Next: m = c->go; k = QKeySequence::MoveToNextPage; break; - case KStandardAction::Prior: m = c->go; k = QKeySequence::MoveToPreviousPage; break; - default:; - } - if (m) { - QAction* a = m->addAction(name, rcv, slot); - if ((int)k) a->setShortcut(k); - if (t == KStandardAction::SaveAs) - c->file->addSeparator(); - return a; - } - - QAction* a = new QAction(name, rcv); - QObject::connect(a, SIGNAL(triggered(bool)), rcv, slot); - return a; -} diff --git a/src/nokde-stubs/prefs.h b/src/nokde-stubs/prefs.h deleted file mode 100644 --- a/src/nokde-stubs/prefs.h +++ /dev/null @@ -1,81 +0,0 @@ -/* **************************************************************************** - This file is part of Lokalize - - Copyright (C) 2007-2014 by Nick Shaforostoff - - 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) version 3 or any later version - accepted by the membership of KDE e.V. (or its successor approved - by the membership of KDE e.V.), which shall act as a proxy - defined in Section 14 of version 3 of the license. - - 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, see . - -**************************************************************************** */ - -#ifndef PREFS_H -#define PREFS_H - -#include - -/** - * Singleton that manages cfgs for Lokalize and projects - */ -class SettingsController: public QObject -{ - Q_OBJECT - -public: - SettingsController(): dirty(false), m_mainWindowPtr(0) {} - ~SettingsController() {} - - bool dirty; - - void setMainWindowPtr(QWidget* w) - { - m_mainWindowPtr = w; - } - QWidget* mainWindowPtr() - { - return m_mainWindowPtr; - } - -public slots: - void showSettingsDialog() {} - - bool ensureProjectIsLoaded(); - QString projectOpen(QString path = QString(), bool doOpen = true) - { - return QString(); - } - bool projectCreate() - { - return true; - } - void projectConfigure() {} - -signals: - void generalSettingsChanged(); - -private: - QWidget* m_mainWindowPtr; - -private: - static SettingsController* _instance; - static void cleanupSettingsController(); -public: - static SettingsController* instance(); -}; - -void writeUiState(const char* elementName, const QByteArray&); -QByteArray readUiState(const char* elementName); - -#endif diff --git a/src/nokde-stubs/prefs.cpp b/src/nokde-stubs/prefs.cpp deleted file mode 100644 --- a/src/nokde-stubs/prefs.cpp +++ /dev/null @@ -1,365 +0,0 @@ -#include "prefs.h" -#include "prefs_lokalize.h" -#include "projectbase.h" -#include "projectlocal.h" -#include "project.h" -#include "tmtab.h" -#include "filesearchtab.h" - -#include "kaboutdata.h" - -#include -#include -#include -#include -#include -#include -#include - -SettingsController* SettingsController::_instance = 0; -void SettingsController::cleanupSettingsController() -{ - delete SettingsController::_instance; - SettingsController::_instance = 0; -} - -SettingsController* SettingsController::instance() -{ - if (_instance == 0) { - _instance = new SettingsController; - ///qAddPostRoutine(SettingsController::cleanupSettingsController); - } - - return _instance; -} - -bool SettingsController::ensureProjectIsLoaded() -{ - Project::instance()->populateGlossary(); - return true; -} - -QString fullUserName();// defined in helpers.cpp - -Settings::Settings() - : mAddColor(0x99, 0xCC, 0xFF) - , mDelColor(0xFF, 0x99, 0x99) - , mMsgFont() - , mHighlightSpaces(true) - , mLeds(false) - - // Editor - , mAutoApprove(true) - , mAutoSpellcheck(true) - , mMouseWheelGo(false) - , mAltTransViewEverShownWithData(false) - - // TM - , mPrefetchTM(false) - , mAutoaddTM(true) - , mScanToTMOnOpen(false) - , mDeleteFromTMOnMissing(false) - - , mWordCompletionLength(3) - , mTabSwitch(0) - , mSuggCount(10) - , mSuggScore(0) -{ - QSettings s; - mAuthorName = s.value(QStringLiteral("Author/Name"), QString()).toString(); - if (mAuthorName.isEmpty()) { - mAuthorName = fullUserName(); - if (mAuthorName.length()) mAuthorName[0] = mAuthorName.at(0).toUpper(); - } - mAuthorEmail = s.value(QStringLiteral("Author/Email"), QString()).toString(); - - mDefaultLangCode = s.value(QStringLiteral("Editor/TargetLangCode"), QLocale::system().name()).toString(); - - mAltTransViewEverShownWithData = s.value(QStringLiteral("Editor/AltTransViewEverShownWithData"), false).toBool(); -} - -void Settings::save() -{ - QSettings s; - s.setValue(QStringLiteral("Author/Name"), mAuthorName); - s.setValue(QStringLiteral("Author/Email"), mAuthorEmail); - - s.setValue(QStringLiteral("Editor/TargetLangCode"), mDefaultLangCode); - - s.setValue(QStringLiteral("Editor/AltTransViewEverShownWithData"), mAltTransViewEverShownWithData); -} - -Settings *Settings::self() -{ - static Settings* s = new Settings; - return s; -} - - - -void writeUiState(const char* elementName, const QByteArray& state) -{ - QSettings s; - s.setValue(QStringLiteral("UI/") + QLatin1String(elementName), state.toBase64()); -} -QByteArray readUiState(const char* elementName) -{ - QSettings s; - return QByteArray::fromBase64(s.value(QStringLiteral("UI/") + QLatin1String(elementName), QByteArray()).toByteArray()); -} - - - - - -#include "editortab.h" - -ProjectBase::ProjectBase() - : m_tmTab(0) - , mProjectID(QStringLiteral("default")) - , mKind() - , mTargetLangCode(Settings::defaultLangCode()) - , mSourceLangCode("en_US") - , mPoBaseDir(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation)) - , mPotBaseDir() - , mBranchDir() - , mAltDir() - , mGlossaryTbx(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation) + "/terms.tbx") - , mMainQA(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation) + "/main.lqa") - - // RegExps - , mAccel("&") - , mMarkup("(<[^>]+>)+|(&[A-Za-z_:][A-Za-z0-9_\\.:-]*;)+") - , mWordWrap(80) -{ - QSettings s; - mSourceLangCode = s.value(QStringLiteral("Project/SourceLangCode"), mSourceLangCode).toString(); - mTargetLangCode = s.value(QStringLiteral("Project/TargetLangCode"), mTargetLangCode).toString(); -} - -void ProjectBase::save() -{ - QSettings s; - s.setValue(QStringLiteral("Project/SourceLangCode"), mSourceLangCode); - s.setValue(QStringLiteral("Project/TargetLangCode"), mTargetLangCode); -} - -ProjectLocal::ProjectLocal() - : mRole(Translator) - , mFirstRun(true) -{ - QSettings s; - mRole = s.value("Project/AuthorRole", mRole).toInt(); - mSourceDir = s.value("Project/SourceDir", mSourceDir).toString(); -} - -void ProjectLocal::save() -{ - QSettings s; - s.setValue(QStringLiteral("Project/AuthorRole"), mRole); - s.setValue(QStringLiteral("Project/SourceDir"), mSourceDir); -} - -EditorTab* ProjectBase::fileOpen(QString filePath, int entry, bool setAsActive, const QString& mergeFile, bool silent) -{ - if (filePath.length()) { - FileToEditor::const_iterator it = m_fileToEditor.constFind(filePath); - if (it != m_fileToEditor.constEnd()) { - qCWarning(LOKALIZE_LOG) << "already opened:" << filePath; - if (EditorTab* e = it.value()) { - e->activateWindow(); - return e; - } - } - } - - QByteArray state = m_lastEditorState; - EditorTab* w = new EditorTab(0); - - QString suggestedDirPath; - if (EditorTab* e = qobject_cast(QApplication::activeWindow())) { - QString fp = e->currentFilePath(); - if (fp.length()) suggestedDirPath = QFileInfo(fp).absolutePath(); - } - - if (!w->fileOpen(filePath, suggestedDirPath, silent)) { - w->deleteLater(); - return 0; - } - if (filePath.length()) { - FileToEditor::const_iterator it = m_fileToEditor.constFind(filePath); - if (it != m_fileToEditor.constEnd()) { - qCWarning(LOKALIZE_LOG) << "already opened:" << filePath; - if (EditorTab* e = it.value()) { - e->activateWindow(); - w->deleteLater(); - return e; - } - } - } - - w->show(); - - if (!state.isEmpty()) - w->restoreState(QByteArray::fromBase64(state)); - - if (entry/* || offset*/) - w->gotoEntry(DocPosition(entry/*, DocPosition::Target, 0, offset*/)); - - if (!mergeFile.isEmpty()) - w->mergeOpen(mergeFile); - -// m_openRecentFileAction->addUrl(QUrl::fromLocalFile(filePath));//(w->currentUrl()); - connect(w, SIGNAL(destroyed(QObject*)), this, SLOT(editorClosed(QObject*))); - connect(w, SIGNAL(fileOpenRequested(QString, QString, QString, bool)), this, SLOT(fileOpen(QString, QString, QString, bool))); - connect(w, SIGNAL(tmLookupRequested(QString, QString)), this, SLOT(lookupInTranslationMemory(QString, QString))); - - filePath = w->currentFilePath(); - QStringRef fnSlashed = filePath.midRef(filePath.lastIndexOf('/')); - FileToEditor::const_iterator i = m_fileToEditor.constBegin(); - while (i != m_fileToEditor.constEnd()) { - if (i.key().endsWith(fnSlashed)) { - i.value()->setFullPathShown(true); - w->setFullPathShown(true); - } - ++i; - } - m_fileToEditor.insert(filePath, w); - - //emit editorAdded(); - return w; -} - -EditorTab* ProjectBase::fileOpen(const QString& filePath, const QString& source, const QString& ctxt, const bool setAsActive) -{ - EditorTab* w = fileOpen(filePath, 0, setAsActive); - if (!w) - return 0;//TODO message - w->findEntryBySourceContext(source, ctxt); - return w; -} - -EditorTab* ProjectBase::fileOpen(const QString& filePath, DocPosition docPos, int selection, const bool setAsActive) -{ - EditorTab* w = fileOpen(filePath, 0, setAsActive); - if (!w) - return 0;//TODO message - w->gotoEntry(docPos, selection); - return w; -} - -void ProjectBase::editorClosed(QObject* obj) -{ - m_fileToEditor.remove(m_fileToEditor.key(static_cast(obj))); -} - -bool ProjectBase::eventFilter(QObject *obj, QEvent *event) -{ - if (event->type() == QEvent::FileOpen) { - QFileOpenEvent *e = static_cast(event); - fileOpen(e->file()); - return true; - } - return QObject::eventFilter(obj, event); -} - -void ProjectBase::lookupInTranslationMemory(const QString& source, const QString& target) -{ - TM::TMTab* w = showTM(); - w->lookup(source, target); -} - -TM::TMTab* ProjectBase::showTM() -{ - if (!m_tmTab) { - m_tmTab = new TM::TMTab(0); - connect(m_tmTab, SIGNAL(fileOpenRequested(QString, QString, QString, bool)), this, SLOT(fileOpen(QString, QString, QString, bool))); - } - m_tmTab->show(); - m_tmTab->activateWindow(); - return m_tmTab; -} - -void ProjectBase::showFileSearch() -{ - if (!m_fileSearchTab) { - m_fileSearchTab = new FileSearchTab(0); - connect(m_fileSearchTab, SIGNAL(fileOpenRequested(QString, DocPosition, int, bool)), this, SLOT(fileOpen(QString, DocPosition, int, bool))); - connect(m_fileSearchTab, SIGNAL(fileOpenRequested(QString, bool)), this, SLOT(fileOpen(QString, bool))); - } - - if (EditorTab* e = qobject_cast(QApplication::activeWindow())) { - QString fp = e->currentFilePath(); - if (fp.length()) { - m_fileSearchTab->addFilesToSearch(QStringList(fp)); - m_fileSearchTab->setSourceQuery(e->selectionInSource()); - m_fileSearchTab->setTargetQuery(e->selectionInTarget()); - } - } - - m_fileSearchTab->show(); - m_fileSearchTab->activateWindow(); -} - -void ProjectBase::fileSearchNext() -{ - if (!m_fileSearchTab) - showFileSearch(); - else - m_fileSearchTab->fileSearchNext(); -} - - - -KAboutData* KAboutData::instance = 0; - -KAboutData::KAboutData(const QString&, const QString& n, const QString& v, const QString& d, KAboutLicense::L, const QString& c) - : name(n) - , version(v) - , description(d) - , copyright(c) -{ - KAboutData::instance = this; -} - -void KAboutData::addAuthor(const QString& name, const QString&, const QString& mail) -{ -// Credit c; -// c.name=name; -// c.mail=mail; -// credits.append(c); -} - -void KAboutData::addCredit(const QString& name, const QString& forwhat, const QString& mail, const QString& site) -{ - Credit c; - c.name = name; - c.mail = mail; - c.what = forwhat; - c.site = site; - credits.append(c); -} - - -void KAboutData::doAbout() -{ - QString cs; - foreach (const Credit& c, credits) { - cs += c.name % ": " % c.what % "
"; - } - QMessageBox::about(0, name, "

" % name % ' ' % version % "

" % description % "

" % copyright.replace('\n', "
") % "


Credits:
" % cs % "
"); -} - -namespace KLocalizedString -{ -void setApplicationDomain(const char*) {} -}; - - - - - - - - - diff --git a/src/nokde-stubs/prefs_lokalize.h b/src/nokde-stubs/prefs_lokalize.h deleted file mode 100644 --- a/src/nokde-stubs/prefs_lokalize.h +++ /dev/null @@ -1,218 +0,0 @@ -// This file is generated by kconfig_compiler_kf5 from lokalize.kcfg. -#ifndef SETTINGS_H -#define SETTINGS_H - -#include - -#include -#include -#include -class Settings: public QObject -{ - Q_OBJECT -public: - - static Settings *self(); - ~Settings() {} - - void save(); - -public slots: - static void setAuthorName(const QString& v) - { - self()->mAuthorName = v; - } - static void setAuthorEmail(const QString& v) - { - self()->mAuthorEmail = v; - } - static void setDefaultLangCode(const QString& v) - { - self()->mDefaultLangCode = v; - } - -public: - static QString authorName() - { - return self()->mAuthorName; - } - static QString authorLocalizedName() - { - return self()->mAuthorLocalizedName; - } - static QString authorEmail() - { - return self()->mAuthorEmail; - } - - static - QString defaultLangCode() - { - return self()->mDefaultLangCode; - } - - static - QString defaultMailingList() - { - return self()->mDefaultMailingList; - } - - static - QColor addColor() - { - return self()->mAddColor; - } - - static - QColor delColor() - { - return self()->mDelColor; - } - - static - bool highlightSpaces() - { - return self()->mHighlightSpaces; - } - - static - QFont msgFont() - { - return self()->mMsgFont; - } - - static - void setLeds(bool v) - { - self()->mLeds = v; - } - - static - bool leds() - { - return self()->mLeds; - } - - static - bool autoApprove() - { - return self()->mAutoApprove; - } - - static - void setAutoSpellcheck(bool v) - { - self()->mAutoSpellcheck = v; - } - - static - bool autoSpellcheck() - { - return self()->mAutoSpellcheck; - } - - static - bool mouseWheelGo() - { - return self()->mMouseWheelGo; - } - - static - bool altTransViewEverShownWithData() - { - return self()->mAltTransViewEverShownWithData; - } - - static - void setAltTransViewEverShownWithData(bool v) - { - self()->mAltTransViewEverShownWithData = v; - } - - static - int wordCompletionLength() - { - return self()->mWordCompletionLength; - } - - static - int tabSwitch() - { - return self()->mTabSwitch; - } - - static - bool prefetchTM() - { - return self()->mPrefetchTM; - } - - static - int suggCount() - { - return self()->mSuggCount; - } - - static - int suggScore() - { - return self()->mSuggScore; - } - - static - bool autoaddTM() - { - return self()->mAutoaddTM; - } - - static - bool scanToTMOnOpen() - { - return self()->mScanToTMOnOpen; - } - -protected: - static - bool deleteFromTMOnMissing() - { - return self()->mDeleteFromTMOnMissing; - } - - Settings(); - friend class SettingsHelper; - - - // Identity - QString mAuthorName; - QString mAuthorLocalizedName; - QString mAuthorEmail; - QString mDefaultLangCode; - QString mDefaultMailingList; - - // Appearance - QColor mAddColor; - QColor mDelColor; - QFont mMsgFont; - bool mHighlightSpaces; - bool mLeds; - - // Editor - bool mAutoApprove; - bool mAutoSpellcheck; - bool mMouseWheelGo; - bool mAltTransViewEverShownWithData; - - // TM - bool mPrefetchTM; - bool mAutoaddTM; - bool mScanToTMOnOpen; - bool mDeleteFromTMOnMissing; - - int mWordCompletionLength; - int mTabSwitch; - int mSuggCount; - int mSuggScore; -}; - -#endif - diff --git a/src/nokde-stubs/projectbase.h b/src/nokde-stubs/projectbase.h deleted file mode 100644 --- a/src/nokde-stubs/projectbase.h +++ /dev/null @@ -1,280 +0,0 @@ -// This file is generated by kconfig_compiler_kf5 from projectbase.kcfg. -#ifndef PROJECTBASE_H -#define PROJECTBASE_H - -#include "lokalize_debug.h" - -#include -#include -#include -#include - -#include "pos.h" - -class FileSearchTab; -class EditorTab; -namespace TM -{ -class TMTab; -}; - -class ProjectBase: public QObject -{ - Q_OBJECT -public: - - ProjectBase(); - ~ProjectBase() - { - save(); - } - - bool eventFilter(QObject *obj, QEvent *event); - -public slots: - EditorTab* fileOpen(QString url = QString(), int entry = 0, bool setAsActive = true, const QString& mergeFile = QString(), bool silent = false); - EditorTab* fileOpen(const QString& filePath, const QString& source, const QString& ctxt, const bool setAsActive); - EditorTab* fileOpen(const QString& filePath, DocPosition docPos, int selection, const bool setAsActive); - - void lookupInTranslationMemory(const QString& source, const QString& target); - TM::TMTab* showTM(); - void showFileSearch(); - void fileSearchNext(); - - void editorClosed(QObject* obj); -private: - //using QPointer switches it.value() to 0 before we get to destroyed() handler - //typedef QMap > FileToEditor; - typedef QMap FileToEditor; - FileToEditor m_fileToEditor; - QByteArray m_lastEditorState; - QPointer m_tmTab; - QPointer m_fileSearchTab; - - -public: - void setProjectID(const QString & v) - { - mProjectID = v; - } - - QString projectID() const - { - return mProjectID; - } - - void setKind(const QString & v) - { - mKind = v; - } - - QString kind() const - { - return mKind; - } - - void setLangCode(const QString &) - { - //this is called from setDefaults() - //mTargetLangCode = v; - } - - QString langCode() const - { - return mTargetLangCode; - } -public slots: - void setTargetLangCode(const QString & v) - { - mTargetLangCode = v; - } - void setSourceLangCode(const QString & v) - { - mSourceLangCode = v; - } -public: - QString targetLangCode() const - { - return mTargetLangCode; - } - QString sourceLangCode() const - { - return mSourceLangCode; - } - - void setMailingList(const QString & v) - { - mMailingList = v; - } - - QString mailingList() const - { - return mMailingList; - } - - void setPoBaseDir(const QString & v) - { - mPoBaseDir = v; - } - - QString poBaseDir() const - { - return mPoBaseDir; - } - - /** - Set PotBaseDir - */ - void setPotBaseDir(const QString & v) - { - mPotBaseDir = v; - } - - /** - Get PotBaseDir - */ - QString potBaseDir() const - { - return mPotBaseDir; - } - - /** - Set BranchDir - */ - void setBranchDir(const QString & v) - { - mBranchDir = v; - } - - /** - Get BranchDir - */ - QString branchDir() const - { - return mBranchDir; - } - - /** - Set AltDir - */ - void setAltDir(const QString & v) - { - mAltDir = v; - } - - /** - Get AltDir - */ - QString altDir() const - { - return mAltDir; - } - - /** - Set GlossaryTbx - */ - void setGlossaryTbx(const QString & v) - { - mGlossaryTbx = v; - } - - /** - Get GlossaryTbx - */ - QString glossaryTbx() const - { - return mGlossaryTbx; - } - - /** - Set MainQA - */ - void setMainQA(const QString & v) - { - mMainQA = v; - } - - /** - Get MainQA - */ - QString mainQA() const - { - return mMainQA; - } - - /** - Set Accel - */ - void setAccel(const QString & v) - { - mAccel = v; - } - - /** - Get Accel - */ - QString accel() const - { - return mAccel; - } - - /** - Set Markup - */ - void setMarkup(const QString & v) - { - mMarkup = v; - } - - /** - Get Markup - */ - QString markup() const - { - return mMarkup; - } - - /** - Set WordWrap - */ - void setWordWrap(int v) - { - mWordWrap = v; - } - - /** - Get WordWrap - */ - int wordWrap() const - { - return mWordWrap; - } - - void save(); - void setDefaults() {} -protected: - - // General - QString mProjectID; - QString mKind; - QString mLangCode; - QString mTargetLangCode; - QString mSourceLangCode; - QString mMailingList; - QString mPoBaseDir; - QString mPotBaseDir; - QString mBranchDir; - QString mAltDir; - QString mGlossaryTbx; - QString mMainQA; - - // RegExps - QString mAccel; - QString mMarkup; - int mWordWrap; - -private: -}; - -#endif - diff --git a/src/nokde-stubs/projectlocal.h b/src/nokde-stubs/projectlocal.h deleted file mode 100644 --- a/src/nokde-stubs/projectlocal.h +++ /dev/null @@ -1,65 +0,0 @@ -#ifndef PROJECTLOCAL_H -#define PROJECTLOCAL_H - -#include - -class ProjectLocal: public QObject -{ - Q_OBJECT - -public: - enum PersonRole { Translator, Reviewer, Approver, Undefined }; - - ProjectLocal(); - ~ProjectLocal() - { - save(); - } - -public slots: - void setRole(int v) - { - mRole = (PersonRole)v; - } -public: - void setRole(PersonRole v) - { - mRole = v; - } - PersonRole role() const - { - return static_cast(mRole); - } - - void setFirstRun(bool v) - { - mFirstRun = v; - } - bool firstRun() const - { - return mFirstRun; - } - - void setSourceDir(const QString& s) - { - mSourceDir = s; - } - QString sourceDir() const - { - return mSourceDir; - } - - void save(); - void setDefaults() {} -protected: - - // Personal - int mRole; - bool mFirstRun; - QString mSourceDir; - -private: -}; - -#endif - diff --git a/src/nokde-stubs/welcometab.h b/src/nokde-stubs/welcometab.h deleted file mode 100644 --- a/src/nokde-stubs/welcometab.h +++ /dev/null @@ -1,57 +0,0 @@ -/* **************************************************************************** - This file is part of Lokalize - - Copyright (C) 2014 by Nick Shaforostoff - - 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) version 3 or any later version - accepted by the membership of KDE e.V. (or its successor approved - by the membership of KDE e.V.), which shall act as a proxy - defined in Section 14 of version 3 of the license. - - 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, see . - -**************************************************************************** */ - -#ifndef WELCOMETAB_H -#define WELCOMETAB_H - -#include "lokalizesubwindowbase.h" -#include "ui_welcomewidget.h" - -class WelcomeTab: public LokalizeSubwindowBase2, public Ui_WelcomeWidget -{ - Q_OBJECT - -public: - WelcomeTab(QWidget* parent); - ~WelcomeTab(); - -protected: - virtual void dragEnterEvent(QDragEnterEvent*); - virtual void dropEvent(QDropEvent*); - -}; - -//helps translate 'Russian (ru_UA)' -> 'ru_UA' -class LangCodeSaver: public QObject -{ - Q_OBJECT -public: - LangCodeSaver(QWidget* p): QObject(p) {} -public slots: - void setLangCode(int index); -signals: - void langCodeSelected(const QString&); -}; - - -#endif diff --git a/src/nokde-stubs/welcometab.cpp b/src/nokde-stubs/welcometab.cpp deleted file mode 100644 --- a/src/nokde-stubs/welcometab.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* **************************************************************************** - This file is part of Lokalize - - Copyright (C) 2014 by Nick Shaforostoff - - 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) version 3 or any later version - accepted by the membership of KDE e.V. (or its successor approved - by the membership of KDE e.V.), which shall act as a proxy - defined in Section 14 of version 3 of the license. - - 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, see . - -**************************************************************************** */ - -#include "welcometab.h" -#include "prefs_lokalize.h" -#include "languagelistmodel.h" -#include "tmscanapi.h" -#include "project.h" -#include "catalog.h" -#include - -#include -#include -#include - -WelcomeTab::WelcomeTab(QWidget *parent) - : LokalizeSubwindowBase2(parent) -{ -#ifndef Q_OS_DARWIN - menuBar()->hide(); -#endif - setWindowTitle("Lokalize"/*i18nc("@title:window","Lokalize")*/);//setCaption(i18nc("@title:window","Project"),false); - setAcceptDrops(true); - setCentralWidget(new QWidget(this)); - - setupUi(centralWidget()); - - QStringList i; - i << i18n("Translator") << i18n("Reviewer") << i18n("Approver"); - roleCombo->addItems(i); - roleCombo->setCurrentIndex(Project::instance()->local()->role()); - connect(roleCombo, SIGNAL(currentIndexChanged(int)), Project::instance()->local(), SLOT(setRole(int))); - - sourceLangCombo->setModel(LanguageListModel::instance()->sortModel()); - targetLangCombo->setModel(LanguageListModel::instance()->sortModel()); - sourceLangCombo->setCurrentIndex(LanguageListModel::instance()->sortModelRowForLangCode(Project::instance()->sourceLangCode())); - targetLangCombo->setCurrentIndex(LanguageListModel::instance()->sortModelRowForLangCode(Project::instance()->targetLangCode())); - LangCodeSaver* s = new LangCodeSaver(this); - LangCodeSaver* t = new LangCodeSaver(this); - connect(sourceLangCombo, SIGNAL(currentIndexChanged(int)), s, SLOT(setLangCode(int))); - connect(targetLangCombo, SIGNAL(currentIndexChanged(int)), t, SLOT(setLangCode(int))); - connect(s, SIGNAL(langCodeSelected(QString)), Project::instance(), SLOT(setSourceLangCode(QString))); - connect(t, SIGNAL(langCodeSelected(QString)), Project::instance(), SLOT(setTargetLangCode(QString))); - connect(t, SIGNAL(langCodeSelected(QString)), Settings::self(), SLOT(setDefaultLangCode(QString))); - - authorNameEdit->setText(Settings::self()->authorName()); - connect(authorNameEdit, SIGNAL(textChanged(QString)), Settings::self(), SLOT(setAuthorName(QString))); - - glossaryPathEdit->setText(Project::instance()->glossaryPath()); -} - -WelcomeTab::~WelcomeTab() -{ -} - -void LangCodeSaver::setLangCode(int index) -{ - emit langCodeSelected(LanguageListModel::instance()->langCodeForSortModelRow(index)); -} - -void WelcomeTab::dragEnterEvent(QDragEnterEvent* event) -{ - if (dragIsAcceptable(event->mimeData()->urls())) - event->acceptProposedAction(); -} - -void WelcomeTab::dropEvent(QDropEvent* event) -{ - foreach (const QUrl& url, event->mimeData()->urls()) { - const QString& filePath = url.toLocalFile(); - if (Catalog::extIsSupported(filePath) - && Project::instance()->fileOpen(filePath)) { - event->acceptProposedAction(); - } - } -} - diff --git a/src/nokde-stubs/welcomewidget.ui b/src/nokde-stubs/welcomewidget.ui deleted file mode 100644 --- a/src/nokde-stubs/welcomewidget.ui +++ /dev/null @@ -1,81 +0,0 @@ - - - WelcomeWidget - - - - 0 - 0 - 389 - 276 - - - - - QFormLayout::AllNonFixedFieldsGrow - - - - - <html><head/><body><p align="center">Welcome to Lokalize!</p><p>Drop a translation file here to start editing it.</p><p>You can help translating KDE into your mother language by going to <a href="http://l10n.kde.org/"><span style=" text-decoration: underline; color:#0000ff;">KDE localization site</span></a> and contacting appropriate language team.</p><p><br/></p><p><br/></p></body></html> - - - true - - - - - - - Your name: - - - - - - - - - - Your role (XLIFF only): - - - - - - - - - - Default source language: - - - - - - - Default target language: - - - - - - - - - - - - - Glossary file: - - - - - - - - - - - diff --git a/src/phaseswindow.cpp b/src/phaseswindow.cpp --- a/src/phaseswindow.cpp +++ b/src/phaseswindow.cpp @@ -29,10 +29,7 @@ #include #include - -#ifndef NOKDE #include -#endif #include #include @@ -223,11 +220,8 @@ l->addLayout(btns); QPushButton* add = new QPushButton(this); -#ifndef NOKDE KGuiItem::assign(add, KStandardGuiItem::add()); -#else - add->setText(tr("Add")); -#endif + connect(add, &QPushButton::clicked, this, &PhasesWindow::addPhase); btns->addWidget(add); btns->addStretch(5); diff --git a/src/project/project.cpp b/src/project/project.cpp --- a/src/project/project.cpp +++ b/src/project/project.cpp @@ -46,7 +46,6 @@ #include #include -#ifndef NOKDE #include "projectmodel.h" #include "webquerycontroller.h" @@ -62,7 +61,6 @@ #include using namespace Kross; -#endif QString getMailingList() { @@ -165,21 +163,16 @@ } TM::threadPool()->waitForDone(500);//more safety -#ifndef NOKDE setSharedConfig(KSharedConfig::openConfig(newProjectPath, KConfig::NoGlobals)); if (!QFileInfo::exists(newProjectPath)) Project::instance()->setDefaults(); ProjectBase::load(); -#else -#endif m_path = newProjectPath; m_desirablePath.clear(); //cache: m_projectDir = QFileInfo(m_path).absolutePath(); -#ifndef NOKDE m_localConfig->setSharedConfig(KSharedConfig::openConfig(projectID() + QStringLiteral(".local"), KConfig::NoGlobals, QStandardPaths::DataLocation)); m_localConfig->load(); -#endif if (forcedTargetLangCode.length()) setLangCode(forcedTargetLangCode); @@ -243,15 +236,13 @@ void Project::populateDirModel() { -#ifndef NOKDE if (Q_UNLIKELY(m_path.isEmpty() || !QFileInfo::exists(poDir()))) return; QUrl potUrl; if (QFileInfo::exists(potDir())) potUrl = QUrl::fromLocalFile(potDir()); model()->setUrl(QUrl::fromLocalFile(poDir()), potUrl); -#endif } void Project::populateGlossary() @@ -331,14 +322,10 @@ ProjectModel* Project::model() { -#ifndef NOKDE if (Q_UNLIKELY(!m_model)) m_model = new ProjectModel(this); return m_model; -#else - return 0; -#endif } void Project::setDefaults() @@ -394,7 +381,6 @@ } -#ifndef NOKDE class SourceFilesSearchJob: public KJob { public: @@ -451,26 +437,19 @@ i18n("Scanning folders with source files"), qMakePair(i18n("Editor"), m_folderName)); } -#endif const QMultiMap& Project::sourceFilePaths() { if (m_sourceFilePaths.isEmpty()) { QDir dir(local()->sourceDir()); if (dir.exists()) { -#ifndef NOKDE SourceFilesSearchJob* metaJob = new SourceFilesSearchJob(local()->sourceDir()); KIO::getJobTracker()->registerJob(metaJob); metaJob->start(); //KNotification* notification=new KNotification("SourceFileScan", 0); //notification->setText( i18nc("@info","Please wait while %1 is being scanned for source files.", local()->sourceDir()) ); //notification->sendEvent(); -#else - QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); - fillFilePathsRecursive(dir, m_sourceFilePaths); - QApplication::restoreOverrideCursor(); -#endif } } return m_sourceFilePaths; diff --git a/src/syntaxhighlighter.h b/src/syntaxhighlighter.h --- a/src/syntaxhighlighter.h +++ b/src/syntaxhighlighter.h @@ -25,25 +25,17 @@ #define HIGHLIGHTER_H #include -#ifndef NOKDE #include #include -#elif defined(SONNET_STATIC) -#include "highlighter.h" -#endif #include #include class QTextDocument; class QTextEdit; -#if !defined(NOKDE) || defined(SONNET_STATIC) class SyntaxHighlighter : public Sonnet::Highlighter -#else -class SyntaxHighlighter : public QSyntaxHighlighter -#endif { Q_OBJECT @@ -79,9 +71,7 @@ // bool fromDocbook; QTextCharFormat tagFormat; -#ifndef NOKDE KStatefulBrush tagBrush; -#endif bool m_approved; QString m_sourceString; }; diff --git a/src/syntaxhighlighter.cpp b/src/syntaxhighlighter.cpp --- a/src/syntaxhighlighter.cpp +++ b/src/syntaxhighlighter.cpp @@ -29,9 +29,7 @@ #include "prefs_lokalize.h" #include "prefs.h" -#ifndef NOKDE #include -#endif #include #include @@ -45,31 +43,20 @@ #define NUM_OF_RULES 5 SyntaxHighlighter::SyntaxHighlighter(QTextEdit *parent) -#ifndef NOKDE : Sonnet::Highlighter(parent) , tagBrush(KColorScheme::View, KColorScheme::VisitedText) -#elif defined(SONNET_STATIC) - : Sonnet::Highlighter(parent) -#else - : QSyntaxHighlighter(parent->document()) -#endif , m_approved(true) // , fromDocbook(docbook) { highlightingRules.reserve(NUM_OF_RULES); HighlightingRule rule; //rule.format.setFontItalic(true); // tagFormat.setForeground(tagBrush.brush(QApplication::palette())); -#if !defined(NOKDE) || defined(SONNET_STATIC) setAutomatic(false); -#endif -#ifndef NOKDE tagFormat.setForeground(tagBrush.brush(QApplication::palette())); -#else - tagFormat.setForeground(QApplication::palette().linkVisited()); -#endif + //QTextCharFormat format; //tagFormat.setForeground(Qt::darkBlue); // if (!docbook) //support multiline tags @@ -114,26 +101,18 @@ HighlightingRule rule; rule.format.clearForeground(); -#ifndef NOKDE KColorScheme colorScheme(QPalette::Normal); //nbsp //rule.format.setBackground(colorScheme.background(KColorScheme::NegativeBackground)); rule.format.setBackground(colorScheme.foreground(KColorScheme::InactiveText)); -#else - rule.format.setBackground(QApplication::palette().alternateBase()); -#endif rule.format.setFontLetterSpacing(200); rule.pattern = QRegExp(QChar(0x00a0U), Qt::CaseSensitive, QRegExp::FixedString); highlightingRules.append(rule); //usual spaces at the end rule.format.setFontLetterSpacing(100); -#ifndef NOKDE rule.format.setBackground(colorScheme.background(KColorScheme::ActiveBackground)); -#else - rule.format.setBackground(QApplication::palette().midlight()); -#endif rule.pattern = re; highlightingRules.append(rule); rehighlight(); @@ -195,10 +174,8 @@ } } -#if !defined(NOKDE) || defined(SONNET_STATIC) if (spellCheckerFound()) Sonnet::Highlighter::highlightBlock(text); // Resets current block state -#endif setCurrentBlockState(currentBlockState); } @@ -227,7 +204,6 @@ void SyntaxHighlighter::setMisspelled(int start, int count) { -#if !defined(NOKDE) || defined(SONNET_STATIC) const Project& project = *Project::instance(); const QString text = currentBlock().text(); @@ -286,7 +262,6 @@ f.setUnderlineColor(Qt::red); setFormat(start + i, 1, f); } -#endif } void SyntaxHighlighter::unsetMisspelled(int start, int count) diff --git a/src/tm/tmscanapi.h b/src/tm/tmscanapi.h --- a/src/tm/tmscanapi.h +++ b/src/tm/tmscanapi.h @@ -30,9 +30,7 @@ #include #include -#ifndef NOKDE #include -#endif bool dragIsAcceptable(const QList& urls); QString shorterFilePath(const QString path); @@ -48,7 +46,6 @@ ///wrapper. returns gross number of jobs started int scanRecursive(const QStringList& urls, const QString& dbName); -#ifndef NOKDE class RecursiveScanJob: public KJob { Q_OBJECT @@ -67,7 +64,6 @@ QTime m_time; QVector m_jobs; }; -#endif } #endif diff --git a/src/tm/tmscanapi.cpp b/src/tm/tmscanapi.cpp --- a/src/tm/tmscanapi.cpp +++ b/src/tm/tmscanapi.cpp @@ -34,22 +34,17 @@ #include -#ifndef NOKDE #include #include #include -#else -class KJob; -#endif namespace TM { static QVector doScanRecursive(const QDir& dir, const QString& dbName, KJob* metaJob); } using namespace TM; -#ifndef NOKDE RecursiveScanJob::RecursiveScanJob(const QString& dbName, QObject* parent) : KJob(parent) , m_dbName(dbName) @@ -100,17 +95,12 @@ i18n("Adding files to Lokalize translation memory"), qMakePair(i18n("TM"), m_dbName)); } -#endif int TM::scanRecursive(const QStringList& filePaths, const QString& dbName) { -#ifndef NOKDE RecursiveScanJob* metaJob = new RecursiveScanJob(dbName); KIO::getJobTracker()->registerJob(metaJob); metaJob->start(); -#else - KJob* metaJob = 0; -#endif if (!askAuthorInfoIfEmpty()) return 0; @@ -121,21 +111,15 @@ if (filePath.isEmpty()) continue; if (Catalog::extIsSupported(filePath)) { -#ifndef NOKDE ScanJobFeedingBack* job = new ScanJobFeedingBack(filePath, dbName); QObject::connect(job, &ScanJobFeedingBack::done, metaJob, &RecursiveScanJob::scanJobFinished); -#else - ScanJob* job = new ScanJob(filePath, dbName); -#endif TM::threadPool()->start(job, SCAN); result.append(job); } else result += doScanRecursive(QDir(filePath), dbName, metaJob); } -#ifndef NOKDE metaJob->setJobs(result); -#endif DBFilesModel::instance()->openDB(dbName); //update stats after it finishes return result.size(); @@ -158,12 +142,8 @@ i = files.size(); while (--i >= 0) { -#ifndef NOKDE ScanJobFeedingBack* job = new ScanJobFeedingBack(dir.filePath(files.at(i)), dbName); QObject::connect(job, &ScanJobFeedingBack::done, (RecursiveScanJob*)metaJob, &RecursiveScanJob::scanJobFinished); -#else - ScanJob* job = new ScanJob(dir.filePath(files.at(i)), dbName); -#endif TM::threadPool()->start(job, SCAN); result.append(job); } diff --git a/src/tm/tmtab.cpp b/src/tm/tmtab.cpp --- a/src/tm/tmtab.cpp +++ b/src/tm/tmtab.cpp @@ -53,13 +53,11 @@ #include #include -#ifndef NOKDE #include #include #include #include #include -#endif #if defined(Q_OS_WIN) && defined(QStringLiteral) #undef QStringLiteral @@ -517,22 +515,18 @@ connect(m_qaView->toggleViewAction(), &QAction::toggled, this, QOverload::of(&TMTab::setQAMode)); -#ifndef NOKDE KConfig config; KConfigGroup cg(&config, "MainWindow"); view->header()->restoreState(QByteArray::fromBase64(cg.readEntry("TMSearchResultsHeaderState", QByteArray()))); -#endif } TMTab::~TMTab() { -#ifndef NOKDE KConfig config; KConfigGroup cg(&config, "MainWindow"); cg.writeEntry("TMSearchResultsHeaderState", ui_queryOptions->treeView->header()->saveState().toBase64()); ids.removeAll(m_dbusId); -#endif delete ui_queryOptions; } @@ -737,15 +731,12 @@ event->acceptProposedAction(); } -#ifndef NOKDE #include "translationmemoryadaptor.h" -#endif //BEGIN DBus interface QList TMTab::ids; QString TMTab::dbusObjectPath() { -#ifndef NOKDE const QString TM_PATH = QStringLiteral("/ThisIsWhatYouWant/TranslationMemory/"); if (m_dbusId == -1) { new TranslationMemoryAdaptor(this); @@ -759,9 +750,6 @@ } return TM_PATH + QString::number(m_dbusId); -#else - return QString(); -#endif } void TMTab::lookup(QString source, QString target) diff --git a/src/xlifftextedit.cpp b/src/xlifftextedit.cpp --- a/src/xlifftextedit.cpp +++ b/src/xlifftextedit.cpp @@ -34,9 +34,7 @@ #include "completionstorage.h" #include -#ifndef NOKDE #include -#endif #include #include @@ -73,7 +71,6 @@ // qCWarning(LOKALIZE_LOG)<setActive(m_enabled); setHighlighter(m_highlighter); -#endif if (part == DocPosition::Target) { connect(document(), &QTextDocument::contentsChange, this, &TranslationUnitTextEdit::contentsChanged); @@ -142,9 +136,7 @@ { Settings::setAutoSpellcheck(enable); m_enabled = enable; -#if !defined(NOKDE) || defined(SONNET_STATIC) m_highlighter->setActive(enable); -#endif SettingsController::instance()->dirty = true; } @@ -167,16 +159,14 @@ QString langCode = m_part == DocPosition::Source ? m_catalog->sourceLangCode() : m_catalog->targetLangCode(); QLocale langLocale(langCode); -#if !defined(NOKDE) || defined(SONNET_STATIC) // First try to use a locale name derived from the language code m_highlighter->setCurrentLanguage(langLocale.name()); // If that fails, try to use the language code directly if (m_highlighter->currentLanguage() != langLocale.name() || m_highlighter->currentLanguage().isEmpty()) { m_highlighter->setCurrentLanguage(langCode); if (m_highlighter->currentLanguage() != langCode && langCode.length() > 2) m_highlighter->setCurrentLanguage(langCode.left(2)); } -#endif //"i use an english locale while translating kde pot files from english to hebrew" Bug #181989 Qt::LayoutDirection targetLanguageDirection = Qt::LeftToRight; static QLocale::Language rtlLanguages[] = {QLocale::Arabic, QLocale::Hebrew, QLocale::Urdu, QLocale::Persian, QLocale::Pashto}; @@ -511,7 +501,6 @@ // for mergecatalog (remove entry from index) // and for statusbar emit contentsModified(m_currentPos); -#ifndef NOKDE if (charsAdded == 1) { int sp = target.lastIndexOf(CompletionStorage::instance()->rxSplit, offset - 1); int len = (offset - sp); @@ -522,7 +511,6 @@ m_completionBox->hide(); } else if (m_completionBox) m_completionBox->hide(); -#endif //qCWarning(LOKALIZE_LOG)<<"finish"; } @@ -792,16 +780,14 @@ insertPlainText(QChar(0x0000AD)); //BEGIN clever editing else if (keyEvent->key() == Qt::Key_Return || keyEvent->key() == Qt::Key_Enter) { -#ifndef NOKDE if (m_completionBox && m_completionBox->isVisible()) { if (m_completionBox->currentItem()) completionActivated(m_completionBox->currentItem()->text()); else qCWarning(LOKALIZE_LOG) << "avoided a crash. a case for bug 238835!"; m_completionBox->hide(); return; } -#endif if (m_catalog->type() != Gettext) return KTextEdit::keyPressEvent(keyEvent); @@ -1068,7 +1054,6 @@ } void TranslationUnitTextEdit::spellReplace() { -#ifndef NOKDE QTextCursor wordSelectCursor = textCursor(); wordSelectCursor.select(QTextCursor::WordUnderCursor); if (!m_highlighter->isWordMisspelled(wordSelectCursor.selectedText())) @@ -1081,7 +1066,6 @@ m_catalog->beginMacro(i18nc("@item Undo action item", "Replace text")); wordSelectCursor.insertText(suggestions.first()); m_catalog->endMacro(); -#endif } bool TranslationUnitTextEdit::event(QEvent * event) { @@ -1103,7 +1087,6 @@ return true; } -#if !defined(NOKDE) || defined(SONNET_STATIC) QString tip; QString langCode = m_highlighter->currentLanguage(); @@ -1117,7 +1100,6 @@ if (nospell) tip += QLatin1String(" - ") % i18n("no spellcheck available"); QToolTip::showText(helpEvent->globalPos(), tip); -#endif } return KTextEdit::event(event); } @@ -1275,7 +1257,6 @@ void TranslationUnitTextEdit::doCompletion(int pos) { -#ifndef NOKDE QTime a; a.start(); QString target = m_catalog->targetWithTags(m_currentPos).string; int sp = target.lastIndexOf(CompletionStorage::instance()->rxSplit, pos - 1); @@ -1303,7 +1284,6 @@ m_completionBox->move(viewport()->mapToGlobal(p)); } else m_completionBox->hide(); -#endif } void TranslationUnitTextEdit::doExplicitCompletion() {