Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff -U 3 -H -d -r -N -- "a/src/dolphinmainwindow.cpp" "b/src/dolphinmainwindow.cpp"
- --- "a/src/dolphinmainwindow.cpp" 2017-09-02 12:25:44.000000000 +0300
- +++ "b/src/dolphinmainwindow.cpp" 2017-09-24 22:01:39.355116440 +0300
- @@ -799,6 +799,348 @@
- }
- }
- +// 10 Extra buttons
- +void DolphinMainWindow::extraButton00()
- +{
- + const KFileItemList& list = m_activeViewContainer->view()->selectedItems();
- +
- + QString dir(QDir::homePath());
- +
- + KIO::StatJob* statJob = KIO::mostLocalUrl(m_activeViewContainer->url());
- + KJobWidgets::setWindow(statJob, this);
- + statJob->exec();
- + QUrl url = statJob->mostLocalUrl();
- +
- + if (url.isLocalFile()) {
- + dir = url.toLocalFile();
- + }
- +
- + QUrl dirUrl = dir;
- +
- + QString selectedUrls = "";
- + int i = 0;
- + foreach (const KFileItem& item, list) {
- + selectedUrls.append(list.at(i).url().toDisplayString(QUrl::PreferLocalFile));
- + selectedUrls.append(" ");
- + i++;
- + }
- +
- + QString command(QStringLiteral("myextrabuttons \""));
- + command.append('0');
- + command.append("\" \"");
- + command.append(dirUrl.toDisplayString(QUrl::PreferLocalFile));
- + command.append("\" \"");
- + command.append(selectedUrls);
- + command.append('\"');
- + KRun::runCommand(command, QStringLiteral("My Extra Buttons"), QStringLiteral("myextrabuttons"), this);
- +}
- +void DolphinMainWindow::extraButton01()
- +{
- + const KFileItemList& list = m_activeViewContainer->view()->selectedItems();
- +
- + QString dir(QDir::homePath());
- +
- + KIO::StatJob* statJob = KIO::mostLocalUrl(m_activeViewContainer->url());
- + KJobWidgets::setWindow(statJob, this);
- + statJob->exec();
- + QUrl url = statJob->mostLocalUrl();
- +
- + if (url.isLocalFile()) {
- + dir = url.toLocalFile();
- + }
- +
- + QUrl dirUrl = dir;
- +
- + QString selectedUrls = "";
- + int i = 0;
- + foreach (const KFileItem& item, list) {
- + selectedUrls.append(list.at(i).url().toDisplayString(QUrl::PreferLocalFile));
- + selectedUrls.append(" ");
- + i++;
- + }
- +
- + QString command(QStringLiteral("myextrabuttons \""));
- + command.append('1');
- + command.append("\" \"");
- + command.append(dirUrl.toDisplayString(QUrl::PreferLocalFile));
- + command.append("\" \"");
- + command.append(selectedUrls);
- + command.append('\"');
- + KRun::runCommand(command, QStringLiteral("My Extra Buttons"), QStringLiteral("myextrabuttons"), this);
- +}
- +void DolphinMainWindow::extraButton02()
- +{
- + const KFileItemList& list = m_activeViewContainer->view()->selectedItems();
- +
- + QString dir(QDir::homePath());
- +
- + KIO::StatJob* statJob = KIO::mostLocalUrl(m_activeViewContainer->url());
- + KJobWidgets::setWindow(statJob, this);
- + statJob->exec();
- + QUrl url = statJob->mostLocalUrl();
- +
- + if (url.isLocalFile()) {
- + dir = url.toLocalFile();
- + }
- +
- + QUrl dirUrl = dir;
- +
- + QString selectedUrls = "";
- + int i = 0;
- + foreach (const KFileItem& item, list) {
- + selectedUrls.append(list.at(i).url().toDisplayString(QUrl::PreferLocalFile));
- + selectedUrls.append(" ");
- + i++;
- + }
- +
- + QString command(QStringLiteral("myextrabuttons \""));
- + command.append('2');
- + command.append("\" \"");
- + command.append(dirUrl.toDisplayString(QUrl::PreferLocalFile));
- + command.append("\" \"");
- + command.append(selectedUrls);
- + command.append('\"');
- + KRun::runCommand(command, QStringLiteral("My Extra Buttons"), QStringLiteral("myextrabuttons"), this);
- +}
- +void DolphinMainWindow::extraButton03()
- +{
- + const KFileItemList& list = m_activeViewContainer->view()->selectedItems();
- +
- + QString dir(QDir::homePath());
- +
- + KIO::StatJob* statJob = KIO::mostLocalUrl(m_activeViewContainer->url());
- + KJobWidgets::setWindow(statJob, this);
- + statJob->exec();
- + QUrl url = statJob->mostLocalUrl();
- +
- + if (url.isLocalFile()) {
- + dir = url.toLocalFile();
- + }
- +
- + QUrl dirUrl = dir;
- +
- + QString selectedUrls = "";
- + int i = 0;
- + foreach (const KFileItem& item, list) {
- + selectedUrls.append(list.at(i).url().toDisplayString(QUrl::PreferLocalFile));
- + selectedUrls.append(" ");
- + i++;
- + }
- +
- + QString command(QStringLiteral("myextrabuttons \""));
- + command.append('3');
- + command.append("\" \"");
- + command.append(dirUrl.toDisplayString(QUrl::PreferLocalFile));
- + command.append("\" \"");
- + command.append(selectedUrls);
- + command.append('\"');
- + KRun::runCommand(command, QStringLiteral("My Extra Buttons"), QStringLiteral("myextrabuttons"), this);
- +}
- +void DolphinMainWindow::extraButton04()
- +{
- + const KFileItemList& list = m_activeViewContainer->view()->selectedItems();
- +
- + QString dir(QDir::homePath());
- +
- + KIO::StatJob* statJob = KIO::mostLocalUrl(m_activeViewContainer->url());
- + KJobWidgets::setWindow(statJob, this);
- + statJob->exec();
- + QUrl url = statJob->mostLocalUrl();
- +
- + if (url.isLocalFile()) {
- + dir = url.toLocalFile();
- + }
- +
- + QUrl dirUrl = dir;
- +
- + QString selectedUrls = "";
- + int i = 0;
- + foreach (const KFileItem& item, list) {
- + selectedUrls.append(list.at(i).url().toDisplayString(QUrl::PreferLocalFile));
- + selectedUrls.append(" ");
- + i++;
- + }
- +
- + QString command(QStringLiteral("myextrabuttons \""));
- + command.append('4');
- + command.append("\" \"");
- + command.append(dirUrl.toDisplayString(QUrl::PreferLocalFile));
- + command.append("\" \"");
- + command.append(selectedUrls);
- + command.append('\"');
- + KRun::runCommand(command, QStringLiteral("My Extra Buttons"), QStringLiteral("myextrabuttons"), this);
- +}
- +void DolphinMainWindow::extraButton05()
- +{
- + const KFileItemList& list = m_activeViewContainer->view()->selectedItems();
- +
- + QString dir(QDir::homePath());
- +
- + KIO::StatJob* statJob = KIO::mostLocalUrl(m_activeViewContainer->url());
- + KJobWidgets::setWindow(statJob, this);
- + statJob->exec();
- + QUrl url = statJob->mostLocalUrl();
- +
- + if (url.isLocalFile()) {
- + dir = url.toLocalFile();
- + }
- +
- + QUrl dirUrl = dir;
- +
- + QString selectedUrls = "";
- + int i = 0;
- + foreach (const KFileItem& item, list) {
- + selectedUrls.append(list.at(i).url().toDisplayString(QUrl::PreferLocalFile));
- + selectedUrls.append(" ");
- + i++;
- + }
- +
- + QString command(QStringLiteral("myextrabuttons \""));
- + command.append('5');
- + command.append("\" \"");
- + command.append(dirUrl.toDisplayString(QUrl::PreferLocalFile));
- + command.append("\" \"");
- + command.append(selectedUrls);
- + command.append('\"');
- + KRun::runCommand(command, QStringLiteral("My Extra Buttons"), QStringLiteral("myextrabuttons"), this);
- +}
- +void DolphinMainWindow::extraButton06()
- +{
- + const KFileItemList& list = m_activeViewContainer->view()->selectedItems();
- +
- + QString dir(QDir::homePath());
- +
- + KIO::StatJob* statJob = KIO::mostLocalUrl(m_activeViewContainer->url());
- + KJobWidgets::setWindow(statJob, this);
- + statJob->exec();
- + QUrl url = statJob->mostLocalUrl();
- +
- + if (url.isLocalFile()) {
- + dir = url.toLocalFile();
- + }
- +
- + QUrl dirUrl = dir;
- +
- + QString selectedUrls = "";
- + int i = 0;
- + foreach (const KFileItem& item, list) {
- + selectedUrls.append(list.at(i).url().toDisplayString(QUrl::PreferLocalFile));
- + selectedUrls.append(" ");
- + i++;
- + }
- +
- + QString command(QStringLiteral("myextrabuttons \""));
- + command.append('6');
- + command.append("\" \"");
- + command.append(dirUrl.toDisplayString(QUrl::PreferLocalFile));
- + command.append("\" \"");
- + command.append(selectedUrls);
- + command.append('\"');
- + KRun::runCommand(command, QStringLiteral("My Extra Buttons"), QStringLiteral("myextrabuttons"), this);
- +}
- +void DolphinMainWindow::extraButton07()
- +{
- + const KFileItemList& list = m_activeViewContainer->view()->selectedItems();
- +
- + QString dir(QDir::homePath());
- +
- + KIO::StatJob* statJob = KIO::mostLocalUrl(m_activeViewContainer->url());
- + KJobWidgets::setWindow(statJob, this);
- + statJob->exec();
- + QUrl url = statJob->mostLocalUrl();
- +
- + if (url.isLocalFile()) {
- + dir = url.toLocalFile();
- + }
- +
- + QUrl dirUrl = dir;
- +
- + QString selectedUrls = "";
- + int i = 0;
- + foreach (const KFileItem& item, list) {
- + selectedUrls.append(list.at(i).url().toDisplayString(QUrl::PreferLocalFile));
- + selectedUrls.append(" ");
- + i++;
- + }
- +
- + QString command(QStringLiteral("myextrabuttons \""));
- + command.append('7');
- + command.append("\" \"");
- + command.append(dirUrl.toDisplayString(QUrl::PreferLocalFile));
- + command.append("\" \"");
- + command.append(selectedUrls);
- + command.append('\"');
- + KRun::runCommand(command, QStringLiteral("My Extra Buttons"), QStringLiteral("myextrabuttons"), this);
- +}
- +void DolphinMainWindow::extraButton08()
- +{
- + const KFileItemList& list = m_activeViewContainer->view()->selectedItems();
- +
- + QString dir(QDir::homePath());
- +
- + KIO::StatJob* statJob = KIO::mostLocalUrl(m_activeViewContainer->url());
- + KJobWidgets::setWindow(statJob, this);
- + statJob->exec();
- + QUrl url = statJob->mostLocalUrl();
- +
- + if (url.isLocalFile()) {
- + dir = url.toLocalFile();
- + }
- +
- + QUrl dirUrl = dir;
- +
- + QString selectedUrls = "";
- + int i = 0;
- + foreach (const KFileItem& item, list) {
- + selectedUrls.append(list.at(i).url().toDisplayString(QUrl::PreferLocalFile));
- + selectedUrls.append(" ");
- + i++;
- + }
- +
- + QString command(QStringLiteral("myextrabuttons \""));
- + command.append('8');
- + command.append("\" \"");
- + command.append(dirUrl.toDisplayString(QUrl::PreferLocalFile));
- + command.append("\" \"");
- + command.append(selectedUrls);
- + command.append('\"');
- + KRun::runCommand(command, QStringLiteral("My Extra Buttons"), QStringLiteral("myextrabuttons"), this);
- +}
- +void DolphinMainWindow::extraButton09()
- +{
- + const KFileItemList& list = m_activeViewContainer->view()->selectedItems();
- +
- + QString dir(QDir::homePath());
- +
- + KIO::StatJob* statJob = KIO::mostLocalUrl(m_activeViewContainer->url());
- + KJobWidgets::setWindow(statJob, this);
- + statJob->exec();
- + QUrl url = statJob->mostLocalUrl();
- +
- + if (url.isLocalFile()) {
- + dir = url.toLocalFile();
- + }
- +
- + QUrl dirUrl = dir;
- +
- + QString selectedUrls = "";
- + int i = 0;
- + foreach (const KFileItem& item, list) {
- + selectedUrls.append(list.at(i).url().toDisplayString(QUrl::PreferLocalFile));
- + selectedUrls.append(" ");
- + i++;
- + }
- +
- + QString command(QStringLiteral("myextrabuttons \""));
- + command.append('9');
- + command.append("\" \"");
- + command.append(dirUrl.toDisplayString(QUrl::PreferLocalFile));
- + command.append("\" \"");
- + command.append(selectedUrls);
- + command.append('\"');
- + KRun::runCommand(command, QStringLiteral("My Extra Buttons"), QStringLiteral("myextrabuttons"), this);
- +}
- +
- void DolphinMainWindow::updateControlMenu()
- {
- QMenu* menu = qobject_cast<QMenu*>(sender());
- @@ -1132,6 +1474,57 @@
- connect(openTerminal, &QAction::triggered, this, &DolphinMainWindow::openTerminal);
- }
- + // setup '10 Extra Buttons'
- + QAction* extraButton00 = actionCollection()->addAction(QStringLiteral("extra_button00"));
- + extraButton00->setText(i18nc("@action:inmenu Tools", "Button00"));
- + extraButton00->setIcon(QIcon::fromTheme(QStringLiteral("emblem-question")));
- + connect(extraButton00, &QAction::triggered, this, &DolphinMainWindow::extraButton00);
- +
- + QAction* extraButton01 = actionCollection()->addAction(QStringLiteral("extra_button01"));
- + extraButton01->setText(i18nc("@action:inmenu Tools", "Button01"));
- + extraButton01->setIcon(QIcon::fromTheme(QStringLiteral("emblem-question")));
- + connect(extraButton01, &QAction::triggered, this, &DolphinMainWindow::extraButton01);
- +
- + QAction* extraButton02 = actionCollection()->addAction(QStringLiteral("extra_button02"));
- + extraButton02->setText(i18nc("@action:inmenu Tools", "Button02"));
- + extraButton02->setIcon(QIcon::fromTheme(QStringLiteral("emblem-question")));
- + connect(extraButton02, &QAction::triggered, this, &DolphinMainWindow::extraButton02);
- +
- + QAction* extraButton03 = actionCollection()->addAction(QStringLiteral("extra_button03"));
- + extraButton03->setText(i18nc("@action:inmenu Tools", "Button03"));
- + extraButton03->setIcon(QIcon::fromTheme(QStringLiteral("emblem-question")));
- + connect(extraButton03, &QAction::triggered, this, &DolphinMainWindow::extraButton03);
- +
- + QAction* extraButton04 = actionCollection()->addAction(QStringLiteral("extra_button04"));
- + extraButton04->setText(i18nc("@action:inmenu Tools", "Button04"));
- + extraButton04->setIcon(QIcon::fromTheme(QStringLiteral("emblem-question")));
- + connect(extraButton04, &QAction::triggered, this, &DolphinMainWindow::extraButton04);
- +
- + QAction* extraButton05 = actionCollection()->addAction(QStringLiteral("extra_button05"));
- + extraButton05->setText(i18nc("@action:inmenu Tools", "Button05"));
- + extraButton05->setIcon(QIcon::fromTheme(QStringLiteral("emblem-question")));
- + connect(extraButton05, &QAction::triggered, this, &DolphinMainWindow::extraButton05);
- +
- + QAction* extraButton06 = actionCollection()->addAction(QStringLiteral("extra_button06"));
- + extraButton06->setText(i18nc("@action:inmenu Tools", "Button06"));
- + extraButton06->setIcon(QIcon::fromTheme(QStringLiteral("emblem-question")));
- + connect(extraButton06, &QAction::triggered, this, &DolphinMainWindow::extraButton06);
- +
- + QAction* extraButton07 = actionCollection()->addAction(QStringLiteral("extra_button07"));
- + extraButton07->setText(i18nc("@action:inmenu Tools", "Button07"));
- + extraButton07->setIcon(QIcon::fromTheme(QStringLiteral("emblem-question")));
- + connect(extraButton07, &QAction::triggered, this, &DolphinMainWindow::extraButton07);
- +
- + QAction* extraButton08 = actionCollection()->addAction(QStringLiteral("extra_button08"));
- + extraButton08->setText(i18nc("@action:inmenu Tools", "Button08"));
- + extraButton08->setIcon(QIcon::fromTheme(QStringLiteral("emblem-question")));
- + connect(extraButton08, &QAction::triggered, this, &DolphinMainWindow::extraButton08);
- +
- + QAction* extraButton09 = actionCollection()->addAction(QStringLiteral("extra_button09"));
- + extraButton09->setText(i18nc("@action:inmenu Tools", "Button09"));
- + extraButton09->setIcon(QIcon::fromTheme(QStringLiteral("emblem-question")));
- + connect(extraButton09, &QAction::triggered, this, &DolphinMainWindow::extraButton09);
- +
- // setup 'Settings' menu
- KToggleAction* showMenuBar = KStandardAction::showMenubar(0, 0, actionCollection());
- connect(showMenuBar, &KToggleAction::triggered, // Fixes #286822
- diff -U 3 -H -d -r -N -- "a/src/dolphinmainwindow.h" "b/src/dolphinmainwindow.h"
- --- "a/src/dolphinmainwindow.h" 2017-09-02 12:25:44.000000000 +0300
- +++ "b/src/dolphinmainwindow.h" 2017-09-24 22:02:32.698450013 +0300
- @@ -425,6 +425,18 @@
- */
- void slotDirectoryLoadingCompleted();
- + /** 10 Extra buttons */
- + void extraButton00();
- + void extraButton01();
- + void extraButton02();
- + void extraButton03();
- + void extraButton04();
- + void extraButton05();
- + void extraButton06();
- + void extraButton07();
- + void extraButton08();
- + void extraButton09();
- +
- private:
- void setupActions();
- void setupDockWidgets();
Advertisement
Add Comment
Please, Sign In to add comment