1
mirror of https://invent.kde.org/network/falkon.git synced 2024-09-21 09:42:10 +02:00

plugins: Port to KI18n

This commit is contained in:
David Rosca 2019-04-22 15:10:53 +02:00
parent 0d3fea1c93
commit 2cce43a1c3
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8
52 changed files with 241 additions and 192 deletions

View File

@ -89,10 +89,10 @@ endif()
find_package(OpenSSL REQUIRED) find_package(OpenSSL REQUIRED)
# Mandatory: KF5 # Mandatory: KF5
find_package(KF5 REQUIRED COMPONENTS I18n Archive)
# Optional: KWallet, KIO, KCrash, KCoreAddons
set(KF5_MIN_VERSION "5.54.0") set(KF5_MIN_VERSION "5.54.0")
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS I18n Archive)
# Optional: KWallet, KIO, KCrash, KCoreAddons, KPurpose
find_package(KF5Wallet ${KF5_MIN_VERSION} CONFIG) find_package(KF5Wallet ${KF5_MIN_VERSION} CONFIG)
set_package_properties(KF5Wallet PROPERTIES DESCRIPTION "KDE Frameworks Integration plugin" TYPE OPTIONAL) set_package_properties(KF5Wallet PROPERTIES DESCRIPTION "KDE Frameworks Integration plugin" TYPE OPTIONAL)
find_package(KF5KIO ${KF5_MIN_VERSION} CONFIG) find_package(KF5KIO ${KF5_MIN_VERSION} CONFIG)

View File

@ -1,3 +1,3 @@
#! /bin/sh #! /bin/sh
$EXTRACTRC `find . -name \*.ui` >> rc.cpp $EXTRACTRC `find . -name \*.ui` >> rc.cpp
$EXTRACT_TR_STRINGS `find . -name '*.cpp' -o -name '*.h'` -o $podir/falkon.pot $XGETTEXT `find . -name '*.cpp' -o -name '*.h'` -o $podir/falkon.pot

View File

@ -1,3 +1,5 @@
add_definitions(-DTRANSLATION_DOMAIN="falkon_autoscroll")
set( AutoScroll_SRCS set( AutoScroll_SRCS
autoscrollplugin.cpp autoscrollplugin.cpp
autoscroller.cpp autoscroller.cpp
@ -5,12 +7,10 @@ set( AutoScroll_SRCS
autoscrollsettings.cpp autoscrollsettings.cpp
) )
ecm_create_qm_loader( AutoScroll_SRCS falkon_autoscroll_qt )
set( AutoScroll_UIS set( AutoScroll_UIS
autoscrollsettings.ui autoscrollsettings.ui
) )
qt5_wrap_ui(UIS ${AutoScroll_UIS}) ki18n_wrap_ui(UIS ${AutoScroll_UIS})
set( AutoScroll_RSCS set( AutoScroll_RSCS
autoscroll.qrc autoscroll.qrc

View File

@ -1,2 +1,2 @@
#! /bin/sh #! /bin/sh
$EXTRACT_TR_STRINGS `find . -name '*.cpp' -o -name '*.h' -o -name '*.ui'` -o $podir/falkon_autoscroll_qt.pot $XGETTEXT `find . -name '*.cpp' -o -name '*.h'` -o $podir/falkon_autoscroll.pot

View File

@ -1,3 +1,5 @@
add_definitions(-DTRANSLATION_DOMAIN="falkon_flashcookiemanager")
set( FlashCookieManager_SRCS set( FlashCookieManager_SRCS
fcm_plugin.cpp fcm_plugin.cpp
fcm_dialog.cpp fcm_dialog.cpp
@ -10,7 +12,7 @@ set( FlashCookieManager_UIS
fcm_dialog.ui fcm_dialog.ui
fcm_notification.ui fcm_notification.ui
) )
qt5_wrap_ui(UIS ${FlashCookieManager_UIS}) ki18n_wrap_ui(UIS ${FlashCookieManager_UIS})
set( FlashCookieManager_RSCS set( FlashCookieManager_RSCS
flashcookiemanager.qrc flashcookiemanager.qrc

View File

@ -1,2 +1,2 @@
#! /bin/sh #! /bin/sh
$EXTRACT_TR_STRINGS `find . -name '*.cpp' -o -name '*.h' -o -name '*.ui'` -o $podir/falkon_flashcookiemanager_qt.pot $XGETTEXT `find . -name '*.cpp' -o -name '*.h'` -o $podir/falkon_flashcookiemanager.pot

View File

@ -31,6 +31,8 @@
#include <QCloseEvent> #include <QCloseEvent>
#include <QMenu> #include <QMenu>
#include <KLocalizedString>
FCM_Dialog::FCM_Dialog(FCM_Plugin* manager, QWidget* parent) FCM_Dialog::FCM_Dialog(FCM_Plugin* manager, QWidget* parent)
: QDialog(parent, Qt::WindowStaysOnTopHint) : QDialog(parent, Qt::WindowStaysOnTopHint)
, ui(new Ui::FCM_Dialog) , ui(new Ui::FCM_Dialog)
@ -73,7 +75,7 @@ FCM_Dialog::FCM_Dialog(FCM_Plugin* manager, QWidget* parent)
ui->labelNotification->setEnabled(ui->autoMode->isChecked()); ui->labelNotification->setEnabled(ui->autoMode->isChecked());
ui->search->setPlaceholderText(tr("Search")); ui->search->setPlaceholderText(i18n("Search"));
ui->flashCookieTree->setDefaultItemShowMode(TreeWidget::ItemsCollapsed); ui->flashCookieTree->setDefaultItemShowMode(TreeWidget::ItemsCollapsed);
ui->flashCookieTree->sortItems(0, Qt::AscendingOrder); ui->flashCookieTree->sortItems(0, Qt::AscendingOrder);
ui->flashCookieTree->header()->setDefaultSectionSize(220); ui->flashCookieTree->header()->setDefaultSectionSize(220);
@ -90,8 +92,8 @@ FCM_Dialog::FCM_Dialog(FCM_Plugin* manager, QWidget* parent)
void FCM_Dialog::removeAll() void FCM_Dialog::removeAll()
{ {
QMessageBox::StandardButton button = QMessageBox::warning(this, tr("Confirmation"), QMessageBox::StandardButton button = QMessageBox::warning(this, i18n("Confirmation"),
tr("Are you sure you want to delete all flash cookies on your computer?"), QMessageBox::Yes | QMessageBox::No); i18n("Are you sure you want to delete all flash cookies on your computer?"), QMessageBox::Yes | QMessageBox::No);
if (button != QMessageBox::Yes) { if (button != QMessageBox::Yes) {
return; return;
} }
@ -148,12 +150,12 @@ void FCM_Dialog::currentItemChanged(QTreeWidgetItem* current, QTreeWidgetItem* p
ui->textEdit->clear(); ui->textEdit->clear();
const QVariant data = current->data(0, Qt::UserRole + 10); const QVariant data = current->data(0, Qt::UserRole + 10);
if (data.isNull()) { if (data.isNull()) {
ui->name->setText(tr("<flash cookie not selected>")); ui->name->setText(i18n("<flash cookie not selected>"));
ui->size->setText(tr("<flash cookie not selected>")); ui->size->setText(i18n("<flash cookie not selected>"));
ui->server->setText(tr("<flash cookie not selected>")); ui->server->setText(i18n("<flash cookie not selected>"));
ui->lastModified->setText(tr("<flash cookie not selected>")); ui->lastModified->setText(i18n("<flash cookie not selected>"));
ui->removeOne->setText(tr("Remove flash cookies")); ui->removeOne->setText(i18n("Remove flash cookies"));
ui->path->hide(); ui->path->hide();
ui->labelPath->hide(); ui->labelPath->hide();
return; return;
@ -163,16 +165,16 @@ void FCM_Dialog::currentItemChanged(QTreeWidgetItem* current, QTreeWidgetItem* p
QString suffix; QString suffix;
if (flashCookie.path.startsWith(m_manager->flashPlayerDataPath() + QL1S("/macromedia.com/support/flashplayer/sys"))) { if (flashCookie.path.startsWith(m_manager->flashPlayerDataPath() + QL1S("/macromedia.com/support/flashplayer/sys"))) {
suffix = tr(" (settings)"); suffix = i18n(" (settings)");
} }
ui->name->setText(flashCookie.name + suffix); ui->name->setText(flashCookie.name + suffix);
ui->size->setText(QString::number(flashCookie.size) + tr(" Byte")); ui->size->setText(QString::number(flashCookie.size) + i18n(" Byte"));
ui->textEdit->setPlainText(flashCookie.contents); ui->textEdit->setPlainText(flashCookie.contents);
ui->server->setText(flashCookie.origin); ui->server->setText(flashCookie.origin);
ui->path->setText(QString("<a href=\"%1\">%2</a>").arg(QUrl::fromLocalFile(flashCookie.path).toString()).arg(QDir::toNativeSeparators(flashCookie.path))); ui->path->setText(QString("<a href=\"%1\">%2</a>").arg(QUrl::fromLocalFile(flashCookie.path).toString()).arg(QDir::toNativeSeparators(flashCookie.path)));
ui->lastModified->setText(flashCookie.lastModification.toString()); ui->lastModified->setText(flashCookie.lastModification.toString());
ui->removeOne->setText(tr("Remove flash cookie")); ui->removeOne->setText(i18n("Remove flash cookie"));
ui->labelPath->show(); ui->labelPath->show();
ui->path->show(); ui->path->show();
@ -234,11 +236,11 @@ void FCM_Dialog::refreshFlashCookiesTree()
QString suffix; QString suffix;
if (flashCookie.path.startsWith(m_manager->flashPlayerDataPath() + QL1S("/macromedia.com/support/flashplayer/sys"))) { if (flashCookie.path.startsWith(m_manager->flashPlayerDataPath() + QL1S("/macromedia.com/support/flashplayer/sys"))) {
suffix = tr(" (settings)"); suffix = i18n(" (settings)");
} }
if (m_manager->newCookiesList().contains(flashCookie.path + QL1C('/') + flashCookie.name)) { if (m_manager->newCookiesList().contains(flashCookie.path + QL1C('/') + flashCookie.name)) {
suffix += tr(" [new]"); suffix += i18n(" [new]");
QFont font = item->font(0); QFont font = item->font(0);
font.setBold(true); font.setBold(true);
item->setFont(0, font); item->setFont(0, font);
@ -274,7 +276,7 @@ void FCM_Dialog::refreshFilters()
void FCM_Dialog::addWhitelist() void FCM_Dialog::addWhitelist()
{ {
const QString origin = QInputDialog::getText(this, tr("Add to whitelist"), tr("Origin:")); const QString origin = QInputDialog::getText(this, i18n("Add to whitelist"), i18n("Origin:"));
addWhitelist(origin); addWhitelist(origin);
} }
@ -286,7 +288,7 @@ void FCM_Dialog::addWhitelist(const QString &origin)
} }
if (!ui->blackList->findItems(origin, Qt::MatchFixedString).isEmpty()) { if (!ui->blackList->findItems(origin, Qt::MatchFixedString).isEmpty()) {
QMessageBox::information(this, tr("Already whitelisted!"), tr("The server \"%1\" is already in blacklist, please remove it first.").arg(origin)); QMessageBox::information(this, i18n("Already whitelisted!"), i18n("The server \"%1\" is already in blacklist, please remove it first.", origin));
return; return;
} }
@ -302,7 +304,7 @@ void FCM_Dialog::removeWhitelist()
void FCM_Dialog::addBlacklist() void FCM_Dialog::addBlacklist()
{ {
const QString origin = QInputDialog::getText(this, tr("Add to blacklist"), tr("Origin:")); const QString origin = QInputDialog::getText(this, i18n("Add to blacklist"), i18n("Origin:"));
addBlacklist(origin); addBlacklist(origin);
} }
@ -314,7 +316,7 @@ void FCM_Dialog::addBlacklist(const QString &origin)
} }
if (!ui->whiteList->findItems(origin, Qt::MatchFixedString).isEmpty()) { if (!ui->whiteList->findItems(origin, Qt::MatchFixedString).isEmpty()) {
QMessageBox::information(this, tr("Already whitelisted!"), tr("The origin \"%1\" is already in whitelist, please remove it first.").arg(origin)); QMessageBox::information(this, i18n("Already whitelisted!"), i18n("The origin \"%1\" is already in whitelist, please remove it first.", origin));
return; return;
} }
@ -371,8 +373,8 @@ void FCM_Dialog::reloadFromDisk()
void FCM_Dialog::cookieTreeContextMenuRequested(const QPoint &pos) void FCM_Dialog::cookieTreeContextMenuRequested(const QPoint &pos)
{ {
QMenu menu; QMenu menu;
QAction* actAddBlacklist = menu.addAction(tr("Add to blacklist")); QAction* actAddBlacklist = menu.addAction(i18n("Add to blacklist"));
QAction* actAddWhitelist = menu.addAction(tr("Add to whitelist")); QAction* actAddWhitelist = menu.addAction(i18n("Add to whitelist"));
QTreeWidgetItem* item = ui->flashCookieTree->itemAt(pos); QTreeWidgetItem* item = ui->flashCookieTree->itemAt(pos);

View File

@ -20,6 +20,8 @@
#include "iconprovider.h" #include "iconprovider.h"
#include "fcm_plugin.h" #include "fcm_plugin.h"
#include <KLocalizedString>
FCM_Notification::FCM_Notification(FCM_Plugin* manager, int newOriginsCount) FCM_Notification::FCM_Notification(FCM_Plugin* manager, int newOriginsCount)
: AnimatedWidget(AnimatedWidget::Down, 300, 0) : AnimatedWidget(AnimatedWidget::Down, 300, 0)
, ui(new Ui::FCM_Notification) , ui(new Ui::FCM_Notification)
@ -31,10 +33,10 @@ FCM_Notification::FCM_Notification(FCM_Plugin* manager, int newOriginsCount)
ui->close->setIcon(IconProvider::standardIcon(QStyle::SP_DialogCloseButton)); ui->close->setIcon(IconProvider::standardIcon(QStyle::SP_DialogCloseButton));
if (newOriginsCount == 1) { if (newOriginsCount == 1) {
ui->textLabel->setText(tr("A new flash cookie was detected")); ui->textLabel->setText(i18n("A new flash cookie was detected"));
} }
else { else {
ui->textLabel->setText(tr("%1 new flash cookies were detected").arg(newOriginsCount)); ui->textLabel->setText(i18n("%1 new flash cookies were detected", newOriginsCount));
} }
connect(ui->buttonView, SIGNAL(clicked()), m_manager, SLOT(showFlashCookieManager())); connect(ui->buttonView, SIGNAL(clicked()), m_manager, SLOT(showFlashCookieManager()));
connect(ui->buttonView, SIGNAL(clicked()), this, SLOT(hide())); connect(ui->buttonView, SIGNAL(clicked()), this, SLOT(hide()));

View File

@ -34,6 +34,8 @@
#include <QDir> #include <QDir>
#include <QMenu> #include <QMenu>
#include <KLocalizedString>
#if defined(Q_OS_WIN) || defined(Q_OS_OS2) #if defined(Q_OS_WIN) || defined(Q_OS_OS2)
#include <QProcessEnvironment> #include <QProcessEnvironment>
#endif #endif
@ -55,7 +57,7 @@ public:
QString name() const override QString name() const override
{ {
return tr("Flash Cookie Manager button"); return i18n("Flash Cookie Manager button");
} }
}; };
@ -123,7 +125,7 @@ void FCM_Plugin::showSettings(QWidget* parent)
void FCM_Plugin::populateExtensionsMenu(QMenu* menu) void FCM_Plugin::populateExtensionsMenu(QMenu* menu)
{ {
QAction* showFCM = new QAction(QIcon(":/flashcookiemanager/data/flash-cookie-manager.png"), tr("Flash Cookie Manager"), menu); QAction* showFCM = new QAction(QIcon(":/flashcookiemanager/data/flash-cookie-manager.png"), i18n("Flash Cookie Manager"), menu);
connect(showFCM, &QAction::triggered, this, &FCM_Plugin::showFlashCookieManager); connect(showFCM, &QAction::triggered, this, &FCM_Plugin::showFlashCookieManager);
menu->addAction(showFCM); menu->addAction(showFCM);
} }
@ -353,8 +355,8 @@ AbstractButtonInterface* FCM_Plugin::createStatusBarIcon(BrowserWindow* mainWind
FCM_Button* icon = new FCM_Button(this); FCM_Button* icon = new FCM_Button(this);
icon->setIcon(QIcon(QSL(":/flashcookiemanager/data/flash-cookie-manager.png"))); icon->setIcon(QIcon(QSL(":/flashcookiemanager/data/flash-cookie-manager.png")));
icon->setTitle(tr("Flash Cookie Manager")); icon->setTitle(i18n("Flash Cookie Manager"));
icon->setToolTip(tr("Show Flash Cookie Manager")); icon->setToolTip(i18n("Show Flash Cookie Manager"));
connect(icon, &AbstractButtonInterface::clicked, this, &FCM_Plugin::showFlashCookieManager); connect(icon, &AbstractButtonInterface::clicked, this, &FCM_Plugin::showFlashCookieManager);
m_statusBarIcons.insert(mainWindow, icon); m_statusBarIcons.insert(mainWindow, icon);
@ -435,7 +437,7 @@ QString FCM_Plugin::extractOriginFrom(const QString &path)
else if (path.startsWith(flashPlayerDataPath() + QL1S("/macromedia.com/support/flashplayer/sys/"))) { else if (path.startsWith(flashPlayerDataPath() + QL1S("/macromedia.com/support/flashplayer/sys/"))) {
origin.remove(flashPlayerDataPath() + QL1S("/macromedia.com/support/flashplayer/sys/")); origin.remove(flashPlayerDataPath() + QL1S("/macromedia.com/support/flashplayer/sys/"));
if (origin == QL1S("settings.sol")) { if (origin == QL1S("settings.sol")) {
return tr("!default"); return i18n("!default");
} }
else if (origin.startsWith(QL1C('#'))) { else if (origin.startsWith(QL1C('#'))) {
origin.remove(0, 1); origin.remove(0, 1);
@ -447,7 +449,7 @@ QString FCM_Plugin::extractOriginFrom(const QString &path)
int index = origin.indexOf(QL1C('/')); int index = origin.indexOf(QL1C('/'));
if (index == -1) { if (index == -1) {
return tr("!other"); return i18n("!other");
} }
origin = origin.remove(index, origin.size()); origin = origin.remove(index, origin.size());
if (origin == QL1S("localhost") || origin == QL1S("local")) { if (origin == QL1S("localhost") || origin == QL1S("local")) {

View File

@ -1,3 +1,5 @@
add_definitions(-DTRANSLATION_DOMAIN="falkon_greasemonkey")
include_directories(settings) include_directories(settings)
set( GreaseMonkey_SRCS set( GreaseMonkey_SRCS
@ -15,15 +17,13 @@ set( GreaseMonkey_SRCS
settings/gm_settingslistwidget.cpp settings/gm_settingslistwidget.cpp
) )
ecm_create_qm_loader( GreaseMonkey_SRCS falkon_greasemonkey_qt )
set( GreaseMonkey_UIS set( GreaseMonkey_UIS
gm_addscriptdialog.ui gm_addscriptdialog.ui
gm_notification.ui gm_notification.ui
settings/gm_settings.ui settings/gm_settings.ui
settings/gm_settingsscriptinfo.ui settings/gm_settingsscriptinfo.ui
) )
qt5_wrap_ui(UIS ${GreaseMonkey_UIS}) ki18n_wrap_ui(UIS ${GreaseMonkey_UIS})
set( GreaseMonkey_RSCS set( GreaseMonkey_RSCS
greasemonkey.qrc greasemonkey.qrc

View File

@ -1,2 +1,2 @@
#! /bin/sh #! /bin/sh
$EXTRACT_TR_STRINGS `find . -name '*.cpp' -o -name '*.h' -o -name '*.ui'` -o $podir/falkon_greasemonkey_qt.pot $XGETTEXT `find . -name '*.cpp' -o -name '*.h'` -o $podir/falkon_greasemonkey.pot

View File

@ -31,6 +31,8 @@
#include <QFile> #include <QFile>
#include <QDir> #include <QDir>
#include <KLocalizedString>
GM_AddScriptDialog::GM_AddScriptDialog(GM_Manager* manager, GM_Script* script, QWidget* parent) GM_AddScriptDialog::GM_AddScriptDialog(GM_Manager* manager, GM_Script* script, QWidget* parent)
: QDialog(parent) : QDialog(parent)
, ui(new Ui::GM_AddScriptDialog) , ui(new Ui::GM_AddScriptDialog)
@ -47,11 +49,11 @@ GM_AddScriptDialog::GM_AddScriptDialog(GM_Manager* manager, GM_Script* script, Q
const QStringList exclude = script->exclude(); const QStringList exclude = script->exclude();
if (!include.isEmpty()) { if (!include.isEmpty()) {
runsAt = tr("<p>runs at<br/><i>%1</i></p>").arg(include.join("<br/>")); runsAt = i18n("<p>runs at<br/><i>%1</i></p>", include.join("<br/>"));
} }
if (!exclude.isEmpty()) { if (!exclude.isEmpty()) {
dontRunsAt = tr("<p>does not run at<br/><i>%1</i></p>").arg(exclude.join("<br/>")); dontRunsAt = i18n("<p>does not run at<br/><i>%1</i></p>", exclude.join("<br/>"));
} }
QString scriptInfo = QString("<b>%1</b> %2<br/>%3 %4 %5").arg(script->name(), script->version(), script->description(), runsAt, dontRunsAt); QString scriptInfo = QString("<b>%1</b> %2<br/>%3 %4 %5").arg(script->name(), script->version(), script->description(), runsAt, dontRunsAt);
@ -81,10 +83,10 @@ void GM_AddScriptDialog::showSource()
void GM_AddScriptDialog::accepted() void GM_AddScriptDialog::accepted()
{ {
QString message = tr("Cannot install script"); QString message = i18n("Cannot install script");
if (m_manager->addScript(m_script)) { if (m_manager->addScript(m_script)) {
message = tr("'%1' installed successfully").arg(m_script->name()); message = i18n("'%1' installed successfully", m_script->name());
} }
m_manager->showNotification(message); m_manager->showNotification(message);

View File

@ -20,13 +20,15 @@
#include "webview.h" #include "webview.h"
#include <KLocalizedString>
GM_Icon::GM_Icon(GM_Manager *manager) GM_Icon::GM_Icon(GM_Manager *manager)
: AbstractButtonInterface(manager) : AbstractButtonInterface(manager)
, m_manager(manager) , m_manager(manager)
{ {
setIcon(QIcon(":gm/data/icon.svg")); setIcon(QIcon(":gm/data/icon.svg"));
setTitle(tr("GreaseMonkey")); setTitle(i18n("GreaseMonkey"));
setToolTip(tr("Open GreaseMonkey settings")); setToolTip(i18n("Open GreaseMonkey settings"));
connect(this, &AbstractButtonInterface::clicked, this, &GM_Icon::openSettings); connect(this, &AbstractButtonInterface::clicked, this, &GM_Icon::openSettings);
} }
@ -38,7 +40,7 @@ QString GM_Icon::id() const
QString GM_Icon::name() const QString GM_Icon::name() const
{ {
return tr("GreaseMonkey Icon"); return i18n("GreaseMonkey Icon");
} }
void GM_Icon::openSettings() void GM_Icon::openSettings()

View File

@ -39,6 +39,8 @@
#include <QWebEngineProfile> #include <QWebEngineProfile>
#include <QWebEngineScriptCollection> #include <QWebEngineScriptCollection>
#include <KLocalizedString>
GM_Manager::GM_Manager(const QString &sPath, QObject* parent) GM_Manager::GM_Manager(const QString &sPath, QObject* parent)
: QObject(parent) : QObject(parent)
, m_settingsPath(sPath) , m_settingsPath(sPath)
@ -74,7 +76,7 @@ void GM_Manager::downloadScript(const QUrl &url)
deleteScript = dialog.exec() != QDialog::Accepted; deleteScript = dialog.exec() != QDialog::Accepted;
} }
else { else {
showNotification(tr("'%1' is already installed").arg(script->name())); showNotification(i18n("'%1' is already installed", script->name()));
} }
} }
@ -227,7 +229,7 @@ void GM_Manager::showNotification(const QString &message, const QString &title)
{ {
QIcon icon(":gm/data/icon.svg"); QIcon icon(":gm/data/icon.svg");
mApp->desktopNotifications()->showNotification(icon.pixmap(48), title.isEmpty() ? tr("GreaseMonkey") : title, message); mApp->desktopNotifications()->showNotification(icon.pixmap(48), title.isEmpty() ? i18n("GreaseMonkey") : title, message);
} }
void GM_Manager::load() void GM_Manager::load()

View File

@ -24,6 +24,8 @@
#include <QFile> #include <QFile>
#include <KLocalizedString>
GM_Notification::GM_Notification(GM_Manager* manager, const QString &tmpfileName, const QString &fileName) GM_Notification::GM_Notification(GM_Manager* manager, const QString &tmpfileName, const QString &fileName)
: AnimatedWidget(AnimatedWidget::Down, 300, 0) : AnimatedWidget(AnimatedWidget::Down, 300, 0)
, ui(new Ui::GM_Notification) , ui(new Ui::GM_Notification)
@ -48,7 +50,7 @@ void GM_Notification::installScript()
bool success = false; bool success = false;
GM_Script* script = 0; GM_Script* script = 0;
QString message = tr("Cannot install script"); QString message = i18n("Cannot install script");
if (QFile::copy(m_tmpFileName, m_fileName)) { if (QFile::copy(m_tmpFileName, m_fileName)) {
script = new GM_Script(m_manager, m_fileName); script = new GM_Script(m_manager, m_fileName);
@ -56,7 +58,7 @@ void GM_Notification::installScript()
} }
if (success) { if (success) {
message = tr("'%1' installed successfully").arg(script->name()); message = i18n("'%1' installed successfully", script->name());
} }
m_manager->showNotification(message); m_manager->showNotification(message);

View File

@ -28,6 +28,8 @@
#include <QMessageBox> #include <QMessageBox>
#include <QInputDialog> #include <QInputDialog>
#include <KLocalizedString>
GM_Settings::GM_Settings(GM_Manager* manager, QWidget* parent) GM_Settings::GM_Settings(GM_Manager* manager, QWidget* parent)
: QDialog(parent) : QDialog(parent)
, ui(new Ui::GM_Settings) , ui(new Ui::GM_Settings)
@ -88,8 +90,8 @@ void GM_Settings::removeItem(QListWidgetItem* item)
return; return;
} }
QMessageBox::StandardButton button = QMessageBox::question(this, tr("Remove script"), QMessageBox::StandardButton button = QMessageBox::question(this, i18n("Remove script"),
tr("Are you sure you want to remove '%1'?").arg(script->name()), i18n("Are you sure you want to remove '%1'?", script->name()),
QMessageBox::Yes | QMessageBox::No); QMessageBox::Yes | QMessageBox::No);
if (button == QMessageBox::Yes) { if (button == QMessageBox::Yes) {
@ -119,7 +121,7 @@ void GM_Settings::openScriptsDirectory()
void GM_Settings::newScript() void GM_Settings::newScript()
{ {
const QString name = QInputDialog::getText(this, tr("Add script"), tr("Choose name for script:")); const QString name = QInputDialog::getText(this, i18n("Add script"), i18n("Choose name for script:"));
if (name.isEmpty()) if (name.isEmpty())
return; return;

View File

@ -21,6 +21,8 @@
#include <QDesktopServices> #include <QDesktopServices>
#include <KLocalizedString>
GM_SettingsScriptInfo::GM_SettingsScriptInfo(GM_Script* script, QWidget* parent) GM_SettingsScriptInfo::GM_SettingsScriptInfo(GM_Script* script, QWidget* parent)
: QDialog(parent) : QDialog(parent)
, ui(new Ui::GM_SettingsScriptInfo) , ui(new Ui::GM_SettingsScriptInfo)
@ -42,7 +44,7 @@ void GM_SettingsScriptInfo::editInTextEditor()
void GM_SettingsScriptInfo::loadScript() void GM_SettingsScriptInfo::loadScript()
{ {
setWindowTitle(tr("Script Details of %1").arg(m_script->name())); setWindowTitle(i18n("Script Details of %1", m_script->name()));
ui->name->setText(m_script->name()); ui->name->setText(m_script->name());
ui->nspace->setText(m_script->nameSpace()); ui->nspace->setText(m_script->nameSpace());

View File

@ -1,11 +1,11 @@
add_definitions(-DTRANSLATION_DOMAIN="falkon_kdeframeworksintegration")
set(KDEFrameworksIntegration_SRCS set(KDEFrameworksIntegration_SRCS
kdeframeworksintegrationplugin.cpp kdeframeworksintegrationplugin.cpp
kwalletpasswordbackend.cpp kwalletpasswordbackend.cpp
kioschemehandler.cpp kioschemehandler.cpp
) )
ecm_create_qm_loader(KDEFrameworksIntegration_SRCS falkon_kdeframeworksintegration_qt)
set(KDEFrameworksIntegration_RSCS set(KDEFrameworksIntegration_RSCS
kdeframeworksintegration.qrc kdeframeworksintegration.qrc
) )

View File

@ -1,2 +1,2 @@
#! /bin/sh #! /bin/sh
$EXTRACT_TR_STRINGS `find . -name '*.cpp' -o -name '*.h' -o -name '*.ui'` -o $podir/falkon_kdeframeworksintegration_qt.pot $XGETTEXT `find . -name '*.cpp' -o -name '*.h'` -o $podir/falkon_kdeframeworksintegration.pot

View File

@ -36,6 +36,8 @@
#include <QWebEngineProfile> #include <QWebEngineProfile>
#include <QMenu> #include <QMenu>
#include <KLocalizedString>
KDEFrameworksIntegrationPlugin::KDEFrameworksIntegrationPlugin() KDEFrameworksIntegrationPlugin::KDEFrameworksIntegrationPlugin()
: QObject() : QObject()
{ {
@ -66,7 +68,7 @@ void KDEFrameworksIntegrationPlugin::init(InitState state, const QString &settin
} }
m_sharePageMenu = new Purpose::Menu(); m_sharePageMenu = new Purpose::Menu();
m_sharePageMenu->setTitle(tr("Share page")); m_sharePageMenu->setTitle(i18n("Share page"));
m_sharePageMenu->setIcon(QIcon::fromTheme(QStringLiteral("document-share"))); m_sharePageMenu->setIcon(QIcon::fromTheme(QStringLiteral("document-share")));
m_sharePageMenu->model()->setPluginType(QStringLiteral("ShareUrl")); m_sharePageMenu->model()->setPluginType(QStringLiteral("ShareUrl"));

View File

@ -23,6 +23,7 @@
#include <QDateTime> #include <QDateTime>
#include <KWallet> #include <KWallet>
#include <KLocalizedString>
static PasswordEntry decodeEntry(const QByteArray &data) static PasswordEntry decodeEntry(const QByteArray &data)
{ {
@ -48,7 +49,7 @@ KWalletPasswordBackend::KWalletPasswordBackend()
QString KWalletPasswordBackend::name() const QString KWalletPasswordBackend::name() const
{ {
return KDEFrameworksIntegrationPlugin::tr("KWallet"); return i18n("KWallet");
} }
QVector<PasswordEntry> KWalletPasswordBackend::getEntries(const QUrl &url) QVector<PasswordEntry> KWalletPasswordBackend::getEntries(const QUrl &url)

View File

@ -1,3 +1,5 @@
add_definitions(-DTRANSLATION_DOMAIN="falkon_mousegestures")
include_directories(3rdparty) include_directories(3rdparty)
set( MouseGestures_HDRS set( MouseGestures_HDRS
@ -14,12 +16,10 @@ set( MouseGestures_SRCS
mousegesturessettingsdialog.cpp mousegesturessettingsdialog.cpp
) )
ecm_create_qm_loader( MouseGestures_SRCS falkon_mousegestures_qt )
set( MouseGestures_UIS set( MouseGestures_UIS
mousegesturessettingsdialog.ui mousegesturessettingsdialog.ui
) )
qt5_wrap_ui(UIS ${MouseGestures_UIS}) ki18n_wrap_ui(UIS ${MouseGestures_UIS})
set( MouseGestures_RSCS set( MouseGestures_RSCS
mousegestures.qrc mousegestures.qrc

View File

@ -1,2 +1,2 @@
#! /bin/sh #! /bin/sh
$EXTRACT_TR_STRINGS `find . -name '*.cpp' -o -name '*.h' -o -name '*.ui'` -o $podir/falkon_mousegestures_qt.pot $XGETTEXT `find . -name '*.cpp' -o -name '*.h'` -o $podir/falkon_mousegestures.pot

View File

@ -1,15 +1,15 @@
add_definitions(-DTRANSLATION_DOMAIN="falkon_pim")
set( PIM_SRCS set( PIM_SRCS
PIM_plugin.cpp PIM_plugin.cpp
PIM_handler.cpp PIM_handler.cpp
PIM_settings.cpp PIM_settings.cpp
) )
ecm_create_qm_loader( PIM_SRCS falkon_pim_qt )
set( PIM_UIS set( PIM_UIS
PIM_settings.ui PIM_settings.ui
) )
qt5_wrap_ui(UIS ${PIM_UIS}) ki18n_wrap_ui(UIS ${PIM_UIS})
set( PIM_RSCS set( PIM_RSCS
PIM_res.qrc PIM_res.qrc

View File

@ -1,2 +1,2 @@
#! /bin/sh #! /bin/sh
$EXTRACT_TR_STRINGS `find . -name '*.cpp' -o -name '*.h' -o -name '*.ui'` -o $podir/falkon_pim_qt.pot $XGETTEXT `find . -name '*.cpp' -o -name '*.h'` -o $podir/falkon_pim.pot

View File

@ -28,6 +28,8 @@
#include <QToolTip> #include <QToolTip>
#include <QKeyEvent> #include <QKeyEvent>
#include <KLocalizedString>
PIM_Handler::PIM_Handler(const QString &sPath, QObject* parent) PIM_Handler::PIM_Handler(const QString &sPath, QObject* parent)
: QObject(parent) : QObject(parent)
, m_settingsFile(sPath + QL1S("/extensions.ini")) , m_settingsFile(sPath + QL1S("/extensions.ini"))
@ -56,20 +58,20 @@ void PIM_Handler::loadSettings()
m_allInfo[PI_Special3] = settings.value("Special3", QString()).toString(); m_allInfo[PI_Special3] = settings.value("Special3", QString()).toString();
settings.endGroup(); settings.endGroup();
m_translations[PI_LastName] = tr("Last Name"); m_translations[PI_LastName] = i18n("Last Name");
m_translations[PI_FirstName] = tr("First Name"); m_translations[PI_FirstName] = i18n("First Name");
m_translations[PI_Email] = tr("E-mail"); m_translations[PI_Email] = i18n("E-mail");
m_translations[PI_Mobile] = tr("Mobile"); m_translations[PI_Mobile] = i18n("Mobile");
m_translations[PI_Phone] = tr("Phone"); m_translations[PI_Phone] = i18n("Phone");
m_translations[PI_Address] = tr("Address"); m_translations[PI_Address] = i18n("Address");
m_translations[PI_City] = tr("City"); m_translations[PI_City] = i18n("City");
m_translations[PI_Zip] = tr("ZIP Code"); m_translations[PI_Zip] = i18n("ZIP Code");
m_translations[PI_State] = tr("State/Region"); m_translations[PI_State] = i18n("State/Region");
m_translations[PI_Country] = tr("Country"); m_translations[PI_Country] = i18n("Country");
m_translations[PI_HomePage] = tr("Home Page"); m_translations[PI_HomePage] = i18n("Home Page");
m_translations[PI_Special1] = tr("Custom 1"); m_translations[PI_Special1] = i18n("Custom 1");
m_translations[PI_Special2] = tr("Custom 2"); m_translations[PI_Special2] = i18n("Custom 2");
m_translations[PI_Special3] = tr("Custom 3"); m_translations[PI_Special3] = i18n("Custom 3");
m_infoMatches[PI_LastName] << "lastname" << "surname"; m_infoMatches[PI_LastName] << "lastname" << "surname";
m_infoMatches[PI_FirstName] << "firstname" << "name"; m_infoMatches[PI_FirstName] << "firstname" << "name";
@ -111,7 +113,7 @@ void PIM_Handler::populateWebViewMenu(QMenu* menu, WebView* view, const WebHitTe
loadSettings(); loadSettings();
} }
QMenu* pimMenu = new QMenu(tr("Insert Personal Information")); QMenu* pimMenu = new QMenu(i18n("Insert Personal Information"));
pimMenu->setIcon(QIcon(":/PIM/data/PIM.png")); pimMenu->setIcon(QIcon(":/PIM/data/PIM.png"));
if (!m_allInfo[PI_FirstName].isEmpty() && !m_allInfo[PI_LastName].isEmpty()) { if (!m_allInfo[PI_FirstName].isEmpty() && !m_allInfo[PI_LastName].isEmpty()) {
@ -132,7 +134,7 @@ void PIM_Handler::populateWebViewMenu(QMenu* menu, WebView* view, const WebHitTe
} }
pimMenu->addSeparator(); pimMenu->addSeparator();
pimMenu->addAction(tr("Edit"), this, SLOT(showSettings())); pimMenu->addAction(i18n("Edit"), this, SLOT(showSettings()));
menu->addMenu(pimMenu); menu->addMenu(pimMenu);
menu->addSeparator(); menu->addSeparator();

View File

@ -3,7 +3,7 @@ if(POLICY CMP0071)
cmake_policy(SET CMP0071 NEW) cmake_policy(SET CMP0071 NEW)
endif() endif()
# Get all relevant Qt include dirs, to pass them on to shiboken. # Get all relevant include dirs, to pass them on to shiboken.
get_property(QT_CORE_INCLUDE_DIRS TARGET Qt5::Core PROPERTY INTERFACE_INCLUDE_DIRECTORIES) get_property(QT_CORE_INCLUDE_DIRS TARGET Qt5::Core PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
get_property(QT_GUI_INCLUDE_DIRS TARGET Qt5::Gui PROPERTY INTERFACE_INCLUDE_DIRECTORIES) get_property(QT_GUI_INCLUDE_DIRS TARGET Qt5::Gui PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
get_property(QT_SQL_INCLUDE_DIRS TARGET Qt5::Sql PROPERTY INTERFACE_INCLUDE_DIRECTORIES) get_property(QT_SQL_INCLUDE_DIRS TARGET Qt5::Sql PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
@ -11,7 +11,9 @@ get_property(QT_WIDGETS_INCLUDE_DIRS TARGET Qt5::Widgets PROPERTY INTERFACE_INCL
get_property(QT_NETWORK_INCLUDE_DIRS TARGET Qt5::Network PROPERTY INTERFACE_INCLUDE_DIRECTORIES) get_property(QT_NETWORK_INCLUDE_DIRS TARGET Qt5::Network PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
get_property(QT_WEBENGINECORE_INCLUDE_DIRS TARGET Qt5::WebEngineCore PROPERTY INTERFACE_INCLUDE_DIRECTORIES) get_property(QT_WEBENGINECORE_INCLUDE_DIRS TARGET Qt5::WebEngineCore PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
get_property(QT_WEBENGINEWIDGETS_INCLUDE_DIRS TARGET Qt5::WebEngineWidgets PROPERTY INTERFACE_INCLUDE_DIRECTORIES) get_property(QT_WEBENGINEWIDGETS_INCLUDE_DIRS TARGET Qt5::WebEngineWidgets PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
set(QT_INCLUDE_DIRS get_property(KF5_I18N_INCLUDE_DIRS TARGET KF5::I18n PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
get_property(FalkonPrivate_INCLUDE_DIRS TARGET FalkonPrivate PROPERTY INCLUDE_DIRECTORIES)
set(INCLUDE_DIRS
${QT_CORE_INCLUDE_DIRS} ${QT_CORE_INCLUDE_DIRS}
${QT_GUI_INCLUDE_DIRS} ${QT_GUI_INCLUDE_DIRS}
${QT_SQL_INCLUDE_DIRS} ${QT_SQL_INCLUDE_DIRS}
@ -19,14 +21,12 @@ set(QT_INCLUDE_DIRS
${QT_NETWORK_INCLUDE_DIRS} ${QT_NETWORK_INCLUDE_DIRS}
${QT_WEBENGINECORE_INCLUDE_DIRS} ${QT_WEBENGINECORE_INCLUDE_DIRS}
${QT_WEBENGINEWIDGETS_INCLUDE_DIRS} ${QT_WEBENGINEWIDGETS_INCLUDE_DIRS}
${KF5_I18N_INCLUDE_DIRS}
${FalkonPrivate_INCLUDE_DIRS}
) )
set(INCLUDES "") set(SHIBOKEN_INCLUDES "")
foreach(INCLUDE_DIR ${QT_INCLUDE_DIRS}) foreach(INCLUDE_DIR ${INCLUDE_DIRS})
list(APPEND INCLUDES "-I${INCLUDE_DIR}") list(APPEND SHIBOKEN_INCLUDES "-I${INCLUDE_DIR}")
endforeach()
get_property(FalkonPrivate_INCLUDE_DIRS TARGET FalkonPrivate PROPERTY INCLUDE_DIRECTORIES)
foreach(INCLUDE_DIR ${FalkonPrivate_INCLUDE_DIRS})
list(APPEND INCLUDES "-I${INCLUDE_DIR}")
endforeach() endforeach()
# Set up the options to pass to shiboken. # Set up the options to pass to shiboken.
@ -36,7 +36,7 @@ set(TYPESYSTEM_FILE ${CMAKE_CURRENT_SOURCE_DIR}/typesystem_pyfalkon.xml)
set(SHIBOKEN_OPTIONS --generator-set=shiboken --enable-parent-ctor-heuristic set(SHIBOKEN_OPTIONS --generator-set=shiboken --enable-parent-ctor-heuristic
--enable-pyside-extensions --enable-return-value-heuristic --use-isnull-as-nb_nonzero --enable-pyside-extensions --enable-return-value-heuristic --use-isnull-as-nb_nonzero
--avoid-protected-hack --avoid-protected-hack
${INCLUDES} ${SHIBOKEN_INCLUDES}
-T${PYSIDE_TYPESYSTEMS} -T${PYSIDE_TYPESYSTEMS}
--output-directory=${CMAKE_CURRENT_BINARY_DIR} --output-directory=${CMAKE_CURRENT_BINARY_DIR}
--api-version="${Qt5_VERSION_MAJOR}.${Qt5_VERSION_MINOR}" --api-version="${Qt5_VERSION_MAJOR}.${Qt5_VERSION_MINOR}"

View File

@ -166,13 +166,7 @@
<object-type name="TabMruModel"/> <object-type name="TabMruModel"/>
<object-type name="TabStackedWidget"/> <object-type name="TabStackedWidget"/>
<object-type name="TabTreeModel"/> <object-type name="TabTreeModel"/>
<object-type name="TabWidget"> <object-type name="TabWidget"/>
<modify-function signature="addView(LoadRequest,QString,QFlags&lt;Qz::NewTabPositionFlag&gt;,bool,int,bool)">
<modify-argument index="2">
<replace-default-expression with="TabWidget::tr(&quot;New tab&quot;)"/>
</modify-argument>
</modify-function>
</object-type>
<object-type name="AbstractButtonInterface"> <object-type name="AbstractButtonInterface">
<object-type name="ClickController"/> <object-type name="ClickController"/>

View File

@ -1,3 +1,5 @@
add_definitions(-DTRANSLATION_DOMAIN="falkon_statusbaricons")
set( StatusBarIcons_SRCS set( StatusBarIcons_SRCS
statusbariconsplugin.cpp statusbariconsplugin.cpp
sbi_iconsmanager.cpp sbi_iconsmanager.cpp
@ -13,14 +15,12 @@ set( StatusBarIcons_SRCS
sbi_zoomwidget.cpp sbi_zoomwidget.cpp
) )
ecm_create_qm_loader( StatusBarIcons_SRCS falkon_statusbaricons_qt )
set( StatusBarIcons_UIS set( StatusBarIcons_UIS
sbi_proxywidget.ui sbi_proxywidget.ui
sbi_networkicondialog.ui sbi_networkicondialog.ui
sbi_settingsdialog.ui sbi_settingsdialog.ui
) )
qt5_wrap_ui(UIS ${StatusBarIcons_UIS}) ki18n_wrap_ui(UIS ${StatusBarIcons_UIS})
set( StatusBarIcons_RSCS set( StatusBarIcons_RSCS
statusbaricons.qrc statusbaricons.qrc

View File

@ -1,2 +1,2 @@
#! /bin/sh #! /bin/sh
$EXTRACT_TR_STRINGS `find . -name '*.cpp' -o -name '*.h' -o -name '*.ui'` -o $podir/falkon_statusbaricons_qt.pot $XGETTEXT `find . -name '*.cpp' -o -name '*.h'` -o $podir/falkon_statusbaricons.pot

View File

@ -26,12 +26,14 @@
#include <QSettings> #include <QSettings>
#include <QMenu> #include <QMenu>
#include <KLocalizedString>
SBI_ImagesIcon::SBI_ImagesIcon(BrowserWindow* window, const QString &settingsPath) SBI_ImagesIcon::SBI_ImagesIcon(BrowserWindow* window, const QString &settingsPath)
: SBI_Icon(window, settingsPath) : SBI_Icon(window, settingsPath)
{ {
setObjectName(QSL("sbi_imagesicon")); setObjectName(QSL("sbi_imagesicon"));
setCursor(Qt::PointingHandCursor); setCursor(Qt::PointingHandCursor);
setToolTip(tr("Modify images loading settings per-site and globally")); setToolTip(i18n("Modify images loading settings per-site and globally"));
m_icon = QIcon::fromTheme("image-x-generic", QIcon(":sbi/data/images.png")); m_icon = QIcon::fromTheme("image-x-generic", QIcon(":sbi/data/images.png"));
setPixmap(m_icon.pixmap(16)); setPixmap(m_icon.pixmap(16));
@ -55,19 +57,19 @@ void SBI_ImagesIcon::showMenu(const QPoint &point)
boldFont.setBold(true); boldFont.setBold(true);
QMenu menu; QMenu menu;
menu.addAction(m_icon, tr("Current Page Settings"))->setFont(boldFont); menu.addAction(m_icon, i18n("Current Page Settings"))->setFont(boldFont);
if (testCurrentPageWebAttribute(QWebEngineSettings::AutoLoadImages)) { if (testCurrentPageWebAttribute(QWebEngineSettings::AutoLoadImages)) {
menu.addAction(tr("Disable loading images (temporarily)"), this, &SBI_ImagesIcon::toggleLoadingImages); menu.addAction(i18n("Disable loading images (temporarily)"), this, &SBI_ImagesIcon::toggleLoadingImages);
} }
else { else {
menu.addAction(tr("Enable loading images (temporarily)"), this, &SBI_ImagesIcon::toggleLoadingImages); menu.addAction(i18n("Enable loading images (temporarily)"), this, &SBI_ImagesIcon::toggleLoadingImages);
} }
menu.addSeparator(); menu.addSeparator();
menu.addAction(m_icon, tr("Global Settings"))->setFont(boldFont); menu.addAction(m_icon, i18n("Global Settings"))->setFont(boldFont);
QAction* act = menu.addAction(tr("Automatically load images")); QAction* act = menu.addAction(i18n("Automatically load images"));
act->setCheckable(true); act->setCheckable(true);
act->setChecked(m_loadingImages); act->setChecked(m_loadingImages);
connect(act, &QAction::toggled, this, &SBI_ImagesIcon::setGlobalLoadingImages); connect(act, &QAction::toggled, this, &SBI_ImagesIcon::setGlobalLoadingImages);

View File

@ -26,12 +26,14 @@
#include <QWebEngineSettings> #include <QWebEngineSettings>
#include <QMenu> #include <QMenu>
#include <KLocalizedString>
SBI_JavaScriptIcon::SBI_JavaScriptIcon(BrowserWindow* window) SBI_JavaScriptIcon::SBI_JavaScriptIcon(BrowserWindow* window)
: SBI_Icon(window) : SBI_Icon(window)
{ {
setObjectName(QSL("sbi_javascripticon")); setObjectName(QSL("sbi_javascripticon"));
setCursor(Qt::PointingHandCursor); setCursor(Qt::PointingHandCursor);
setToolTip(tr("Modify JavaScript settings per-site and globally")); setToolTip(i18n("Modify JavaScript settings per-site and globally"));
m_icon = QIcon::fromTheme("application-x-javascript", QIcon(":sbi/data/javascript.png")); m_icon = QIcon::fromTheme("application-x-javascript", QIcon(":sbi/data/javascript.png"));
setPixmap(m_icon.pixmap(16)); setPixmap(m_icon.pixmap(16));
@ -48,13 +50,13 @@ void SBI_JavaScriptIcon::showMenu(const QPoint &point)
boldFont.setBold(true); boldFont.setBold(true);
QMenu menu; QMenu menu;
menu.addAction(m_icon, tr("Current Page Settings"))->setFont(boldFont); menu.addAction(m_icon, i18n("Current Page Settings"))->setFont(boldFont);
if (testCurrentPageWebAttribute(QWebEngineSettings::JavascriptEnabled)) { if (testCurrentPageWebAttribute(QWebEngineSettings::JavascriptEnabled)) {
menu.addAction(tr("Disable JavaScript (temporarily)"), this, &SBI_JavaScriptIcon::toggleJavaScript); menu.addAction(i18n("Disable JavaScript (temporarily)"), this, &SBI_JavaScriptIcon::toggleJavaScript);
} }
else { else {
menu.addAction(tr("Enable JavaScript (temporarily)"), this, &SBI_JavaScriptIcon::toggleJavaScript); menu.addAction(i18n("Enable JavaScript (temporarily)"), this, &SBI_JavaScriptIcon::toggleJavaScript);
} }
// JavaScript needs to be always enabled for falkon: sites // JavaScript needs to be always enabled for falkon: sites
@ -63,8 +65,8 @@ void SBI_JavaScriptIcon::showMenu(const QPoint &point)
} }
menu.addSeparator(); menu.addSeparator();
menu.addAction(m_icon, tr("Global Settings"))->setFont(boldFont); menu.addAction(m_icon, i18n("Global Settings"))->setFont(boldFont);
menu.addAction(tr("Manage JavaScript settings"), this, &SBI_JavaScriptIcon::openJavaScriptSettings); menu.addAction(i18n("Manage JavaScript settings"), this, &SBI_JavaScriptIcon::openJavaScriptSettings);
menu.exec(point); menu.exec(point);
} }

View File

@ -25,6 +25,8 @@
#include <QMenu> #include <QMenu>
#include <QNetworkConfigurationManager> #include <QNetworkConfigurationManager>
#include <KLocalizedString>
SBI_NetworkIcon::SBI_NetworkIcon(BrowserWindow* window) SBI_NetworkIcon::SBI_NetworkIcon(BrowserWindow* window)
: SBI_Icon(window) : SBI_Icon(window)
, m_networkConfiguration(new QNetworkConfigurationManager(this)) , m_networkConfiguration(new QNetworkConfigurationManager(this))
@ -62,9 +64,9 @@ void SBI_NetworkIcon::showMenu(const QPoint &pos)
boldFont.setBold(true); boldFont.setBold(true);
QMenu menu; QMenu menu;
menu.addAction(QIcon::fromTheme("preferences-system-network", QIcon(":sbi/data/preferences-network.png")), tr("Proxy Configuration"))->setFont(boldFont); menu.addAction(QIcon::fromTheme("preferences-system-network", QIcon(":sbi/data/preferences-network.png")), i18n("Proxy Configuration"))->setFont(boldFont);
QMenu* proxyMenu = menu.addMenu(tr("Select proxy")); QMenu* proxyMenu = menu.addMenu(i18n("Select proxy"));
const QHash<QString, SBI_NetworkProxy*> &proxies = SBINetManager->proxies(); const QHash<QString, SBI_NetworkProxy*> &proxies = SBINetManager->proxies();
@ -78,11 +80,11 @@ void SBI_NetworkIcon::showMenu(const QPoint &pos)
} }
if (proxyMenu->actions().count() == 0) { if (proxyMenu->actions().count() == 0) {
proxyMenu->addAction(tr("Empty"))->setEnabled(false); proxyMenu->addAction(i18n("Empty"))->setEnabled(false);
} }
menu.addSeparator(); menu.addSeparator();
menu.addAction(tr("Manage proxies"), this, &SBI_NetworkIcon::showDialog); menu.addAction(i18n("Manage proxies"), this, &SBI_NetworkIcon::showDialog);
menu.exec(pos); menu.exec(pos);
} }
@ -98,23 +100,23 @@ void SBI_NetworkIcon::updateToolTip()
QString tooltip = tr("Shows network status and manages proxy<br/><br/><b>Network:</b><br/>%1<br/><br/><b>Proxy:</b><br/>%2"); QString tooltip = tr("Shows network status and manages proxy<br/><br/><b>Network:</b><br/>%1<br/><br/><b>Proxy:</b><br/>%2");
if (m_networkConfiguration->isOnline()) { if (m_networkConfiguration->isOnline()) {
tooltip = tooltip.arg(tr("Connected")); tooltip = tooltip.arg(i18n("Connected"));
} }
else { else {
tooltip = tooltip.arg(tr("Offline")); tooltip = tooltip.arg(i18n("Offline"));
} }
switch (QNetworkProxy::applicationProxy().type()) { switch (QNetworkProxy::applicationProxy().type()) {
case QNetworkProxy::DefaultProxy: case QNetworkProxy::DefaultProxy:
tooltip = tooltip.arg(tr("System proxy")); tooltip = tooltip.arg(i18n("System proxy"));
break; break;
case QNetworkProxy::NoProxy: case QNetworkProxy::NoProxy:
tooltip = tooltip.arg(tr("No proxy")); tooltip = tooltip.arg(i18n("No proxy"));
break; break;
default: default:
tooltip = tooltip.arg(tr("User defined")); tooltip = tooltip.arg(i18n("User defined"));
break; break;
} }

View File

@ -23,6 +23,8 @@
#include <QInputDialog> #include <QInputDialog>
#include <QMessageBox> #include <QMessageBox>
#include <KLocalizedString>
SBI_NetworkIconDialog::SBI_NetworkIconDialog(QWidget* parent) SBI_NetworkIconDialog::SBI_NetworkIconDialog(QWidget* parent)
: QDialog(parent) : QDialog(parent)
, ui(new Ui::SBI_NetworkIconDialog) , ui(new Ui::SBI_NetworkIconDialog)
@ -54,7 +56,7 @@ SBI_NetworkIconDialog::SBI_NetworkIconDialog(QWidget* parent)
void SBI_NetworkIconDialog::addProxy() void SBI_NetworkIconDialog::addProxy()
{ {
const QString name = QInputDialog::getText(this, tr("Add proxy"), tr("Name of proxy:")); const QString name = QInputDialog::getText(this, i18n("Add proxy"), i18n("Name of proxy:"));
if (name.isEmpty() || ui->comboBox->findText(name) > -1) { if (name.isEmpty() || ui->comboBox->findText(name) > -1) {
return; return;
} }
@ -67,7 +69,7 @@ void SBI_NetworkIconDialog::addProxy()
void SBI_NetworkIconDialog::removeProxy() void SBI_NetworkIconDialog::removeProxy()
{ {
QMessageBox::StandardButton button = QMessageBox::warning(this, tr("Remove current proxy"), tr("Are you sure you want to remove current proxy?"), QMessageBox::StandardButton button = QMessageBox::warning(this, i18n("Remove current proxy"), i18n("Are you sure you want to remove current proxy?"),
QMessageBox::Yes | QMessageBox::No, QMessageBox::No); QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
if (button != QMessageBox::Yes) { if (button != QMessageBox::Yes) {

View File

@ -20,6 +20,8 @@
#include "browserwindow.h" #include "browserwindow.h"
#include "tabwidget.h" #include "tabwidget.h"
#include <KLocalizedString>
SBI_ZoomWidget::SBI_ZoomWidget(BrowserWindow* parent) SBI_ZoomWidget::SBI_ZoomWidget(BrowserWindow* parent)
: QSlider(parent) : QSlider(parent)
, m_window(parent) , m_window(parent)
@ -45,7 +47,7 @@ void SBI_ZoomWidget::valueChanged(int value)
if (view) { if (view) {
view->setZoomLevel(value); view->setZoomLevel(value);
setToolTip(tr("Zoom: %1%").arg(view->zoomFactor() * 100)); setToolTip(i18n("Zoom: %1%", view->zoomFactor() * 100));
} }
} }

View File

@ -1,3 +1,5 @@
add_definitions(-DTRANSLATION_DOMAIN="falkon_tabmanager")
set( TabManager_SRCS set( TabManager_SRCS
tabmanagerplugin.cpp tabmanagerplugin.cpp
tabmanagerwidget.cpp tabmanagerwidget.cpp
@ -7,13 +9,11 @@ set( TabManager_SRCS
tldextractor/tldextractor.cpp tldextractor/tldextractor.cpp
) )
ecm_create_qm_loader( TabManager_SRCS falkon_tabmanager_qt )
set( TabManager_UIS set( TabManager_UIS
tabmanagerwidget.ui tabmanagerwidget.ui
tabmanagersettings.ui tabmanagersettings.ui
) )
qt5_wrap_ui(UIS ${TabManager_UIS}) ki18n_wrap_ui(UIS ${TabManager_UIS})
set( TabManager_RSCS set( TabManager_RSCS
tabmanagerplugin.qrc tabmanagerplugin.qrc

View File

@ -1,2 +1,2 @@
#! /bin/sh #! /bin/sh
$EXTRACT_TR_STRINGS `find . -name '*.cpp' -o -name '*.h' -o -name '*.ui'` -o $podir/falkon_tabmanager_qt.pot $XGETTEXT `find . -name '*.cpp' -o -name '*.h'` -o $podir/falkon_tabmanager.pot

View File

@ -42,6 +42,7 @@
#include <QLabel> #include <QLabel>
#include <QMimeData> #include <QMimeData>
#include <KLocalizedString>
TLDExtractor* TabManagerWidget::s_tldExtractor = 0; TLDExtractor* TabManagerWidget::s_tldExtractor = 0;
@ -108,13 +109,13 @@ QString TabManagerWidget::domainFromUrl(const QUrl &url, bool useHostName)
QString urlString = url.toString(); QString urlString = url.toString();
if (url.scheme() == "file") { if (url.scheme() == "file") {
return tr("Local File System:"); return i18n("Local File System:");
} }
else if (url.scheme() == "falkon" || urlString.isEmpty()) { else if (url.scheme() == "falkon" || urlString.isEmpty()) {
return tr("Falkon:"); return i18n("Falkon:");
} }
else if (url.scheme() == "ftp") { else if (url.scheme() == "ftp") {
appendString.prepend(tr(" [FTP]")); appendString.prepend(i18n(" [FTP]"));
} }
QString host = url.host(); QString host = url.host();
@ -303,18 +304,18 @@ void TabManagerWidget::customContextMenuRequested(const QPoint &pos)
menu->setAttribute(Qt::WA_DeleteOnClose); menu->setAttribute(Qt::WA_DeleteOnClose);
QAction* action; QAction* action;
QMenu groupTypeSubmenu(tr("Group by")); QMenu groupTypeSubmenu(i18n("Group by"));
action = groupTypeSubmenu.addAction(tr("&Window"), this, &TabManagerWidget::changeGroupType); action = groupTypeSubmenu.addAction(i18n("&Window"), this, &TabManagerWidget::changeGroupType);
action->setData(GroupByWindow); action->setData(GroupByWindow);
action->setCheckable(true); action->setCheckable(true);
action->setChecked(m_groupType == GroupByWindow); action->setChecked(m_groupType == GroupByWindow);
action = groupTypeSubmenu.addAction(tr("&Domain"), this, &TabManagerWidget::changeGroupType); action = groupTypeSubmenu.addAction(i18n("&Domain"), this, &TabManagerWidget::changeGroupType);
action->setData(GroupByDomain); action->setData(GroupByDomain);
action->setCheckable(true); action->setCheckable(true);
action->setChecked(m_groupType == GroupByDomain); action->setChecked(m_groupType == GroupByDomain);
action = groupTypeSubmenu.addAction(tr("&Host"), this, &TabManagerWidget::changeGroupType); action = groupTypeSubmenu.addAction(i18n("&Host"), this, &TabManagerWidget::changeGroupType);
action->setData(GroupByHost); action->setData(GroupByHost);
action->setCheckable(true); action->setCheckable(true);
action->setChecked(m_groupType == GroupByHost); action->setChecked(m_groupType == GroupByHost);
@ -322,16 +323,16 @@ void TabManagerWidget::customContextMenuRequested(const QPoint &pos)
menu->addMenu(&groupTypeSubmenu); menu->addMenu(&groupTypeSubmenu);
if (m_isDefaultWidget) { if (m_isDefaultWidget) {
menu->addAction(QIcon(":/tabmanager/data/side-by-side.png"), tr("&Show side by side"), this, &TabManagerWidget::showSideBySide)->setObjectName("sideBySide"); menu->addAction(QIcon(":/tabmanager/data/side-by-side.png"), i18n("&Show side by side"), this, &TabManagerWidget::showSideBySide)->setObjectName("sideBySide");
} }
menu->addSeparator(); menu->addSeparator();
if (isTabSelected()) { if (isTabSelected()) {
menu->addAction(QIcon(":/tabmanager/data/tab-detach.png"), tr("&Detach checked tabs"), this, &TabManagerWidget::processActions)->setObjectName("detachSelection"); menu->addAction(QIcon(":/tabmanager/data/tab-detach.png"), i18n("&Detach checked tabs"), this, &TabManagerWidget::processActions)->setObjectName("detachSelection");
menu->addAction(QIcon(":/tabmanager/data/tab-bookmark.png"), tr("Book&mark checked tabs"), this, &TabManagerWidget::processActions)->setObjectName("bookmarkSelection"); menu->addAction(QIcon(":/tabmanager/data/tab-bookmark.png"), i18n("Book&mark checked tabs"), this, &TabManagerWidget::processActions)->setObjectName("bookmarkSelection");
menu->addAction(QIcon(":/tabmanager/data/tab-close.png"), tr("&Close checked tabs"), this, &TabManagerWidget::processActions)->setObjectName("closeSelection"); menu->addAction(QIcon(":/tabmanager/data/tab-close.png"), i18n("&Close checked tabs"), this, &TabManagerWidget::processActions)->setObjectName("closeSelection");
menu->addAction(tr("&Unload checked tabs"), this, &TabManagerWidget::processActions)->setObjectName("unloadSelection"); menu->addAction(i18n("&Unload checked tabs"), this, &TabManagerWidget::processActions)->setObjectName("unloadSelection");
} }
menu->exec(ui->treeWidget->viewport()->mapToGlobal(pos)); menu->exec(ui->treeWidget->viewport()->mapToGlobal(pos));
@ -583,8 +584,8 @@ bool TabManagerWidget::bookmarkSelectedTabs(const QHash<BrowserWindow*, WebTab*>
layout->addWidget(folderButton); layout->addWidget(folderButton);
layout->addWidget(box); layout->addWidget(box);
label->setText(tr("Choose folder for bookmarks:")); label->setText(i18n("Choose folder for bookmarks:"));
dialog->setWindowTitle(tr("Bookmark Selected Tabs")); dialog->setWindowTitle(i18n("Bookmark Selected Tabs"));
QSize size = dialog->size(); QSize size = dialog->size();
size.setWidth(350); size.setWidth(350);
@ -702,8 +703,8 @@ QTreeWidgetItem* TabManagerWidget::groupByWindow()
BrowserWindow* mainWin = windows.at(win); BrowserWindow* mainWin = windows.at(win);
TabItem* winItem = new TabItem(ui->treeWidget, true, false); TabItem* winItem = new TabItem(ui->treeWidget, true, false);
winItem->setBrowserWindow(mainWin); winItem->setBrowserWindow(mainWin);
winItem->setText(0, tr("Window %1").arg(QString::number(win + 1))); winItem->setText(0, i18n("Window %1", win + 1));
winItem->setToolTip(0, tr("Double click to switch")); winItem->setToolTip(0, i18n("Double click to switch"));
winItem->setIsActiveOrCaption(win == currentWindowIdx); winItem->setIsActiveOrCaption(win == currentWindowIdx);
QList<WebTab*> tabs = mainWin->tabWidget()->allTabs(); QList<WebTab*> tabs = mainWin->tabWidget()->allTabs();

View File

@ -29,9 +29,10 @@
#include <QDesktopWidget> #include <QDesktopWidget>
#include <QAction> #include <QAction>
#include <QStyle> #include <QStyle>
#include <QDebug> #include <QDebug>
#include <KLocalizedString>
class TabManagerButton : public AbstractButtonInterface class TabManagerButton : public AbstractButtonInterface
{ {
public: public:
@ -47,7 +48,7 @@ public:
QString name() const override QString name() const override
{ {
return tr("Tab Manager button"); return i18n("Tab Manager button");
} }
}; };
@ -65,12 +66,12 @@ TabManagerWidgetController::~TabManagerWidgetController()
QString TabManagerWidgetController::title() const QString TabManagerWidgetController::title() const
{ {
return tr("Tab Manager"); return i18n("Tab Manager");
} }
QAction* TabManagerWidgetController::createMenuAction() QAction* TabManagerWidgetController::createMenuAction()
{ {
QAction* act = new QAction(tr("Tab Manager"), this); QAction* act = new QAction(i18n("Tab Manager"), this);
act->setCheckable(true); act->setCheckable(true);
act->setIcon(QIcon(":tabmanager/data/tabmanager.png")); act->setIcon(QIcon(":tabmanager/data/tabmanager.png"));
act->setShortcut(QKeySequence("Ctrl+Shift+M")); act->setShortcut(QKeySequence("Ctrl+Shift+M"));
@ -96,8 +97,8 @@ AbstractButtonInterface* TabManagerWidgetController::createStatusBarIcon(Browser
TabManagerButton* icon = new TabManagerButton(this); TabManagerButton* icon = new TabManagerButton(this);
icon->setIcon(QPixmap(":tabmanager/data/tabmanager.png")); icon->setIcon(QPixmap(":tabmanager/data/tabmanager.png"));
icon->setTitle(tr("Tab Manager")); icon->setTitle(i18n("Tab Manager"));
icon->setToolTip(tr("Show Tab Manager")); icon->setToolTip(i18n("Show Tab Manager"));
connect(icon, &AbstractButtonInterface::clicked, this, [=](AbstractButtonInterface::ClickController *c) { connect(icon, &AbstractButtonInterface::clicked, this, [=](AbstractButtonInterface::ClickController *c) {
if (!defaultTabManager()) { if (!defaultTabManager()) {
return; return;

View File

@ -23,6 +23,8 @@
#include <QMessageBox> #include <QMessageBox>
#include <QUrl> #include <QUrl>
#include <KLocalizedString>
TLDExtractor* TLDExtractor::s_instance = 0; TLDExtractor* TLDExtractor::s_instance = 0;
TLDExtractor::TLDExtractor(QObject* parent) TLDExtractor::TLDExtractor(QObject* parent)
@ -257,10 +259,10 @@ void TLDExtractor::loadData()
if (!parsedDataFileExist) { if (!parsedDataFileExist) {
const QString tldDataFileDownloadLink = QLatin1String("http://mxr.mozilla.org/mozilla-central/source/netwerk/dns/effective_tld_names.dat?raw=1"); const QString tldDataFileDownloadLink = QLatin1String("http://mxr.mozilla.org/mozilla-central/source/netwerk/dns/effective_tld_names.dat?raw=1");
QMessageBox::information(0, tr("File not found!"), QMessageBox::information(0, i18n("File not found!"),
tr("File \'effective_tld_names.dat\' was not found!\n" i18n("File \'effective_tld_names.dat\' was not found!\n"
"You can download it from \'<a href=\"%1\"><b>here</b></a>\' to one of the following paths:\n%2") "You can download it from \'<a href=\"%1\"><b>here</b></a>\' to one of the following paths:\n%2",
.arg(tldDataFileDownloadLink).arg(m_dataSearchPaths.join("\n"))); tldDataFileDownloadLink, m_dataSearchPaths.join("\n")));
return; return;
} }
@ -360,10 +362,10 @@ bool TLDExtractor::test()
if (!testDataFileExist) { if (!testDataFileExist) {
const QString testFileDownloadLink = QLatin1String("http://mxr.mozilla.org/mozilla-central/source/netwerk/test/unit/data/test_psl.txt?raw=1"); const QString testFileDownloadLink = QLatin1String("http://mxr.mozilla.org/mozilla-central/source/netwerk/test/unit/data/test_psl.txt?raw=1");
QMessageBox::information(0, tr("File not found!"), QMessageBox::information(0, i18n("File not found!"),
tr("File \'test_psl.txt\' was not found!\n" i18n("File \'test_psl.txt\' was not found!\n"
"You can download it from \'<a href=\"%1\"><b>here</b></a>\' to one of the following paths:\n%2") "You can download it from \'<a href=\"%1\"><b>here</b></a>\' to one of the following paths:\n%2",
.arg(testFileDownloadLink).arg(m_dataSearchPaths.join("\n"))); testFileDownloadLink, m_dataSearchPaths.join("\n")));
return false; return false;
} }

View File

@ -1,10 +1,10 @@
add_definitions(-DTRANSLATION_DOMAIN="falkon_testplugin")
set( TestPlugin_SRCS set( TestPlugin_SRCS
testplugin.cpp testplugin.cpp
testplugin_sidebar.cpp testplugin_sidebar.cpp
) )
ecm_create_qm_loader( TestPlugin_SRCS falkon_testplugin_qt )
add_library(TestPlugin MODULE ${TestPlugin_SRCS} ${RSCS}) add_library(TestPlugin MODULE ${TestPlugin_SRCS} ${RSCS})
install(TARGETS TestPlugin DESTINATION ${FALKON_INSTALL_PLUGINDIR}) install(TARGETS TestPlugin DESTINATION ${FALKON_INSTALL_PLUGINDIR})
target_link_libraries(TestPlugin FalkonPrivate) target_link_libraries(TestPlugin FalkonPrivate)

View File

@ -1,2 +1,2 @@
#! /bin/sh #! /bin/sh
$EXTRACT_TR_STRINGS `find . -name '*.cpp' -o -name '*.h' -o -name '*.ui'` -o $podir/falkon_testplugin_qt.pot $XGETTEXT `find . -name '*.cpp' -o -name '*.h'` -o $podir/falkon_testplugin.pot

View File

@ -28,6 +28,8 @@
#include <QMenu> #include <QMenu>
#include <QPushButton> #include <QPushButton>
#include <KLocalizedString>
TestPlugin::TestPlugin() TestPlugin::TestPlugin()
: QObject() : QObject()
, m_view(0) , m_view(0)
@ -95,7 +97,7 @@ void TestPlugin::showSettings(QWidget* parent)
if (!m_settings) { if (!m_settings) {
m_settings = new QDialog(parent); m_settings = new QDialog(parent);
QPushButton* b = new QPushButton("Example Plugin v0.0.1"); QPushButton* b = new QPushButton("Example Plugin v0.0.1");
QPushButton* closeButton = new QPushButton(tr("Close")); QPushButton* closeButton = new QPushButton(i18n("Close"));
QLabel* label = new QLabel(); QLabel* label = new QLabel();
label->setPixmap(QPixmap(":icons/other/about.svg")); label->setPixmap(QPixmap(":icons/other/about.svg"));
@ -106,7 +108,7 @@ void TestPlugin::showSettings(QWidget* parent)
m_settings.data()->setLayout(l); m_settings.data()->setLayout(l);
m_settings.data()->setAttribute(Qt::WA_DeleteOnClose); m_settings.data()->setAttribute(Qt::WA_DeleteOnClose);
m_settings.data()->setWindowTitle(tr("Example Plugin Settings")); m_settings.data()->setWindowTitle(i18n("Example Plugin Settings"));
m_settings.data()->setWindowIcon(QIcon(":icons/falkon.svg")); m_settings.data()->setWindowIcon(QIcon(":icons/falkon.svg"));
connect(closeButton, SIGNAL(clicked()), m_settings.data(), SLOT(close())); connect(closeButton, SIGNAL(clicked()), m_settings.data(), SLOT(close()));
} }
@ -136,7 +138,7 @@ void TestPlugin::populateWebViewMenu(QMenu* menu, WebView* view, const WebHitTes
title += " on input"; title += " on input";
} }
menu->addAction(tr("My first plugin action") + title, this, SLOT(actionSlot())); menu->addAction(i18n("My first plugin action") + title, this, SLOT(actionSlot()));
} }
bool TestPlugin::mousePress(Qz::ObjectName type, QObject* obj, QMouseEvent* event) bool TestPlugin::mousePress(Qz::ObjectName type, QObject* obj, QMouseEvent* event)
@ -151,5 +153,5 @@ bool TestPlugin::mousePress(Qz::ObjectName type, QObject* obj, QMouseEvent* even
void TestPlugin::actionSlot() void TestPlugin::actionSlot()
{ {
QMessageBox::information(m_view, tr("Hello"), tr("First plugin action works :-)")); QMessageBox::information(m_view, i18n("Hello"), i18n("First plugin action works :-)"));
} }

View File

@ -22,6 +22,8 @@
#include <QPushButton> #include <QPushButton>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <KLocalizedString>
TestPlugin_Sidebar::TestPlugin_Sidebar(QObject* parent) TestPlugin_Sidebar::TestPlugin_Sidebar(QObject* parent)
: SideBarInterface(parent) : SideBarInterface(parent)
{ {
@ -29,7 +31,7 @@ TestPlugin_Sidebar::TestPlugin_Sidebar(QObject* parent)
QString TestPlugin_Sidebar::title() const QString TestPlugin_Sidebar::title() const
{ {
return tr("Testing Sidebar"); return i18n("Testing Sidebar");
} }
QAction* TestPlugin_Sidebar::createMenuAction() QAction* TestPlugin_Sidebar::createMenuAction()
@ -37,7 +39,7 @@ QAction* TestPlugin_Sidebar::createMenuAction()
// The action must be parented to some object from plugin, otherwise // The action must be parented to some object from plugin, otherwise
// there may be a crash when unloading the plugin. // there may be a crash when unloading the plugin.
QAction* act = new QAction(tr("Testing Sidebar"), this); QAction* act = new QAction(i18n("Testing Sidebar"), this);
act->setCheckable(true); act->setCheckable(true);
return act; return act;

View File

@ -1,3 +1,5 @@
add_definitions(-DTRANSLATION_DOMAIN="falkon_verticaltabs")
set( VerticalTabs_SRCS set( VerticalTabs_SRCS
verticaltabsplugin.cpp verticaltabsplugin.cpp
verticaltabscontroller.cpp verticaltabscontroller.cpp
@ -12,12 +14,10 @@ set( VerticalTabs_SRCS
verticaltabsschemehandler.cpp verticaltabsschemehandler.cpp
) )
ecm_create_qm_loader( VerticalTabs_SRCS falkon_verticaltabs_qt )
set( VerticalTabs_UIS set( VerticalTabs_UIS
verticaltabssettings.ui verticaltabssettings.ui
) )
qt5_wrap_ui(UIS ${VerticalTabs_UIS}) ki18n_wrap_ui(UIS ${VerticalTabs_UIS})
set( VerticalTabs_RSCS set( VerticalTabs_RSCS
verticaltabs.qrc verticaltabs.qrc

View File

@ -1,2 +1,2 @@
#! /bin/sh #! /bin/sh
$EXTRACT_TR_STRINGS `find . -name '*.cpp' -o -name '*.h' -o -name '*.ui'` -o $podir/falkon_verticaltabs_qt.pot $XGETTEXT `find . -name '*.cpp' -o -name '*.h'` -o $podir/falkon_verticaltabs.pot

View File

@ -27,6 +27,8 @@
#include <QToolTip> #include <QToolTip>
#include <QHoverEvent> #include <QHoverEvent>
#include <KLocalizedString>
TabListView::TabListView(BrowserWindow *window, QWidget *parent) TabListView::TabListView(BrowserWindow *window, QWidget *parent)
: QListView(parent) : QListView(parent)
, m_window(window) , m_window(window)
@ -193,7 +195,7 @@ bool TabListView::viewportEvent(QEvent *event)
DelegateButton button = buttonAt(he->pos(), index); DelegateButton button = buttonAt(he->pos(), index);
if (button == AudioButton) { if (button == AudioButton) {
const bool muted = index.data(TabModel::AudioMutedRole).toBool(); const bool muted = index.data(TabModel::AudioMutedRole).toBool();
QToolTip::showText(he->globalPos(), muted ? tr("Unmute Tab") : tr("Mute Tab"), this, visualRect(index)); QToolTip::showText(he->globalPos(), muted ? i18n("Unmute Tab") : i18n("Mute Tab"), this, visualRect(index));
he->accept(); he->accept();
return true; return true;
} else if (button == NoButton) { } else if (button == NoButton) {

View File

@ -28,6 +28,8 @@
#include <QToolTip> #include <QToolTip>
#include <QHoverEvent> #include <QHoverEvent>
#include <KLocalizedString>
TabTreeView::TabTreeView(BrowserWindow *window, QWidget *parent) TabTreeView::TabTreeView(BrowserWindow *window, QWidget *parent)
: QTreeView(parent) : QTreeView(parent)
, m_window(window) , m_window(window)
@ -303,11 +305,11 @@ bool TabTreeView::viewportEvent(QEvent *event)
DelegateButton button = buttonAt(he->pos(), index); DelegateButton button = buttonAt(he->pos(), index);
if (button == AudioButton) { if (button == AudioButton) {
const bool muted = index.data(TabModel::AudioMutedRole).toBool(); const bool muted = index.data(TabModel::AudioMutedRole).toBool();
QToolTip::showText(he->globalPos(), muted ? tr("Unmute Tab") : tr("Mute Tab"), this, visualRect(index)); QToolTip::showText(he->globalPos(), muted ? i18n("Unmute Tab") : i18n("Mute Tab"), this, visualRect(index));
he->accept(); he->accept();
return true; return true;
} else if (button == CloseButton) { } else if (button == CloseButton) {
QToolTip::showText(he->globalPos(), tr("Close Tab"), this, visualRect(index)); QToolTip::showText(he->globalPos(), i18n("Close Tab"), this, visualRect(index));
he->accept(); he->accept();
return true; return true;
} else if (button == NoButton) { } else if (button == NoButton) {
@ -374,21 +376,21 @@ void TabTreeView::addMenuActions(QMenu *menu, const QModelIndex &index)
} }
menu->addSeparator(); menu->addSeparator();
QMenu *m = menu->addMenu(tr("Tab Tree")); QMenu *m = menu->addMenu(i18n("Tab Tree"));
if (index.isValid() && model()->rowCount(index) > 0) { if (index.isValid() && model()->rowCount(index) > 0) {
QPersistentModelIndex pindex = index; QPersistentModelIndex pindex = index;
m->addAction(tr("Close Tree"), this, [=]() { m->addAction(i18n("Close Tree"), this, [=]() {
closeTree(pindex); closeTree(pindex);
}); });
m->addAction(tr("Unload Tree"), this, [=]() { m->addAction(i18n("Unload Tree"), this, [=]() {
unloadTree(pindex); unloadTree(pindex);
}); });
} }
m->addSeparator(); m->addSeparator();
m->addAction(tr("Expand All"), this, &TabTreeView::expandAll); m->addAction(i18n("Expand All"), this, &TabTreeView::expandAll);
m->addAction(tr("Collapse All"), this, &TabTreeView::collapseAll); m->addAction(i18n("Collapse All"), this, &TabTreeView::collapseAll);
} }
void TabTreeView::reverseTraverse(const QModelIndex &root, const std::function<void(const QModelIndex&)> &callback) const void TabTreeView::reverseTraverse(const QModelIndex &root, const std::function<void(const QModelIndex&)> &callback) const

View File

@ -24,6 +24,8 @@
#include <QAction> #include <QAction>
#include <QKeyEvent> #include <QKeyEvent>
#include <KLocalizedString>
VerticalTabsController::VerticalTabsController(VerticalTabsPlugin *plugin) VerticalTabsController::VerticalTabsController(VerticalTabsPlugin *plugin)
: SideBarInterface(plugin) : SideBarInterface(plugin)
, m_plugin(plugin) , m_plugin(plugin)
@ -32,7 +34,7 @@ VerticalTabsController::VerticalTabsController(VerticalTabsPlugin *plugin)
QString VerticalTabsController::title() const QString VerticalTabsController::title() const
{ {
return tr("Vertical Tabs"); return i18n("Vertical Tabs");
} }
QAction *VerticalTabsController::createMenuAction() QAction *VerticalTabsController::createMenuAction()

View File

@ -23,6 +23,8 @@
#include <QUrlQuery> #include <QUrlQuery>
#include <QWebEngineUrlRequestJob> #include <QWebEngineUrlRequestJob>
#include <KLocalizedString>
VerticalTabsSchemeHandler::VerticalTabsSchemeHandler(QObject *parent) VerticalTabsSchemeHandler::VerticalTabsSchemeHandler(QObject *parent)
: ExtensionSchemeHandler(parent) : ExtensionSchemeHandler(parent)
{ {
@ -44,7 +46,7 @@ QByteArray VerticalTabsSchemeHandler::indexPage() const
{ {
QString page = QzTools::readAllFileContents(QSL(":verticaltabs/data/index.html")); QString page = QzTools::readAllFileContents(QSL(":verticaltabs/data/index.html"));
page.replace(QSL("%NAME%"), tr("Vertical Tabs")); page.replace(QSL("%NAME%"), i18n("Vertical Tabs"));
return page.toUtf8(); return page.toUtf8();
} }
@ -54,7 +56,7 @@ QByteArray VerticalTabsSchemeHandler::groupPage() const
QString page = QzTools::readAllFileContents(QSL(":verticaltabs/data/group.html")); QString page = QzTools::readAllFileContents(QSL(":verticaltabs/data/group.html"));
page.replace(QSL("%FAVICON%"), QzTools::pixmapToDataUrl(QIcon(QSL(":verticaltabs/data/group.svg")).pixmap(16)).toString()); page.replace(QSL("%FAVICON%"), QzTools::pixmapToDataUrl(QIcon(QSL(":verticaltabs/data/group.svg")).pixmap(16)).toString());
page.replace(QSL("%NEW-GROUP%"), tr("New Group")); page.replace(QSL("%NEW-GROUP%"), i18n("New Group"));
return page.toUtf8(); return page.toUtf8();
} }

View File

@ -22,6 +22,8 @@
#include <QDir> #include <QDir>
#include <QFileDialog> #include <QFileDialog>
#include <KLocalizedString>
VerticalTabsSettings::VerticalTabsSettings(VerticalTabsPlugin *plugin, QWidget *parent) VerticalTabsSettings::VerticalTabsSettings(VerticalTabsPlugin *plugin, QWidget *parent)
: QDialog(parent) : QDialog(parent)
, ui(new Ui::VerticalTabsSettings) , ui(new Ui::VerticalTabsSettings)
@ -58,7 +60,7 @@ void VerticalTabsSettings::themeValueChanged(int index)
{ {
const int customIndex = ui->theme->count() - 1; const int customIndex = ui->theme->count() - 1;
if (index == customIndex) { if (index == customIndex) {
const QString path = QFileDialog::getOpenFileName(this, tr("Theme file"), QDir::homePath(), {QSL("*.css")}); const QString path = QFileDialog::getOpenFileName(this, i18n("Theme file"), QDir::homePath(), {QSL("*.css")});
if (path.isEmpty()) { if (path.isEmpty()) {
loadThemes(); loadThemes();
} else { } else {
@ -83,7 +85,7 @@ void VerticalTabsSettings::loadThemes()
} }
} }
ui->theme->setToolTip(m_plugin->theme()); ui->theme->setToolTip(m_plugin->theme());
ui->theme->addItem(tr("Custom..."), found ? QString() : m_plugin->theme()); ui->theme->addItem(i18n("Custom..."), found ? QString() : m_plugin->theme());
if (!found) { if (!found) {
ui->theme->setCurrentIndex(ui->theme->count() - 1); ui->theme->setCurrentIndex(ui->theme->count() - 1);
} }

View File

@ -32,6 +32,8 @@
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QWheelEvent> #include <QWheelEvent>
#include <KLocalizedString>
VerticalTabsWidget::VerticalTabsWidget(BrowserWindow *window) VerticalTabsWidget::VerticalTabsWidget(BrowserWindow *window)
: QWidget() : QWidget()
, m_window(window) , m_window(window)
@ -55,7 +57,7 @@ VerticalTabsWidget::VerticalTabsWidget(BrowserWindow *window)
buttonAddTab->setObjectName(QSL("verticaltabs-button-addtab")); buttonAddTab->setObjectName(QSL("verticaltabs-button-addtab"));
buttonAddTab->setAutoRaise(true); buttonAddTab->setAutoRaise(true);
buttonAddTab->setFocusPolicy(Qt::NoFocus); buttonAddTab->setFocusPolicy(Qt::NoFocus);
buttonAddTab->setToolTip(tr("New Tab")); buttonAddTab->setToolTip(i18n("New Tab"));
buttonAddTab->setIcon(QIcon::fromTheme(QSL("list-add"))); buttonAddTab->setIcon(QIcon::fromTheme(QSL("list-add")));
buttonAddTab->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); buttonAddTab->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
connect(buttonAddTab, &QAbstractButton::clicked, m_window, &BrowserWindow::addTab); connect(buttonAddTab, &QAbstractButton::clicked, m_window, &BrowserWindow::addTab);
@ -197,7 +199,7 @@ void VerticalTabsWidget::updateGroupMenu()
} }
m_groupMenu->addSeparator(); m_groupMenu->addSeparator();
m_groupMenu->addAction(tr("Add New Group..."), this, [this]() { m_groupMenu->addAction(i18n("Add New Group..."), this, [this]() {
m_window->tabWidget()->addView(QUrl(QSL("extension://verticaltabs/group")), Qz::NT_SelectedTab); m_window->tabWidget()->addView(QUrl(QSL("extension://verticaltabs/group")), Qz::NT_SelectedTab);
}); });
} }