Skip to content

Commit

Permalink
Fixed 'Unknown protocol <<plasmapackage>>' in KF 5.12.
Browse files Browse the repository at this point in the history
  • Loading branch information
jsmitar committed Jul 14, 2015
1 parent b726744 commit 255fe5d
Show file tree
Hide file tree
Showing 20 changed files with 234 additions and 267 deletions.
38 changes: 0 additions & 38 deletions .gitignore

This file was deleted.

9 changes: 5 additions & 4 deletions Messages.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#! /usr/bin/env bash
extractrc `find ./engine -name \*.rc -o -name \*.ui -o -name \*.kcfg` >> rc.cpp
xgettext --force-po `find ./plasmoid ./engine -name \*.js -o -name \*.cpp` \
rc.cpp -o ./po/plasma_applet_audoban.playbar.pot
rm -f rc.cpp
lupdate-qt5 ./plasmoid -extensions qml,js -ts out.ts
lconvert-qt5 -locations relative -i out.ts -o ./po/plasma_applet_audoban.applet.playbar.pot -of pot
extractrc `find ./engine -name \*.ui -o -name \*.kcfg` > rc.cpp
xgettext -ki18n ./rc.cpp -o po/plasma_dataengine_playbar.pot
rm -f rc.cpp out.ts
11 changes: 6 additions & 5 deletions engine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ add_library( plasma_engine_playbar MODULE ${playbar_engine_SRCS} )
kcoreaddons_desktop_to_json( plasma_engine_playbar plasma-dataengine-playbar.desktop )

target_link_libraries( plasma_engine_playbar
KF5::ConfigCore
KF5::ConfigGui
KF5::ConfigWidgets
KF5::GlobalAccel
KF5::I18n
KF5::Plasma
KF5::PlasmaQuick
KF5::ConfigWidgets
KF5::ConfigGui
KF5::ConfigCore
KF5::WindowSystem
KF5::XmlGui
KF5::GlobalAccel
KF5::I18n
)

install(TARGETS plasma_engine_playbar
Expand All @@ -37,3 +37,4 @@ install(FILES audoban.dataengine.playbar.operations

install(FILES playbar.kcfg DESTINATION ${KCFG_INSTALL_DIR})


34 changes: 17 additions & 17 deletions engine/configdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,22 @@
#include "generalwidget.h"
#include "playbarsettings.h"

ConfigDialog::ConfigDialog( KActionCollection * collection , QWidget * parent )
: KConfigDialog( parent, QLatin1String( "PlayBar Settings" ), PlayBarSettings::self() ),
m_generalPage( new GeneralWidget( this ) )
ConfigDialog::ConfigDialog (KActionCollection *collection , QWidget *parent)
: KConfigDialog (parent, QLatin1String ("PlayBar Settings"), PlayBarSettings::self()),
m_generalPage (new GeneralWidget (this))
{
setWindowTitle( i18n( "Configure PlayBar" ) );
m_shortcutsPage = new KShortcutsEditor( collection, this, KShortcutsEditor::GlobalAction );
setStandardButtons( QDialogButtonBox::Apply | QDialogButtonBox::Ok | QDialogButtonBox::Cancel );
setWindowTitle (i18n ("Configure PlayBar"));
m_shortcutsPage = new KShortcutsEditor (collection, this, KShortcutsEditor::GlobalAction);
setStandardButtons (QDialogButtonBox::Apply | QDialogButtonBox::Ok | QDialogButtonBox::Cancel);

addPage( m_generalPage, i18nc( "General config", "General" ), "applications-multimedia", i18nc( "General Config", "General" ) );
addPage( m_shortcutsPage, i18nc( "Shortcuts config", "Shortcuts" ), "configure-shortcuts", i18n( "Shortcuts Configuration" ) );
addPage (m_generalPage, i18nc ("General config", "General"), "applications-multimedia", i18nc ("General Config", "General"));
addPage (m_shortcutsPage, i18nc ("Shortcuts config", "Shortcuts"), "configure-shortcuts", i18n ("Shortcuts Configuration"));

connect( this, SIGNAL( accepted() ), this, SLOT( updateSettings() ) );
QPushButton * apply = this->button( QDialogButtonBox::Apply );
connect( apply, SIGNAL( clicked() ), this, SLOT( updateSettings() ) );
connect (this, SIGNAL (accepted()), this, SLOT (updateSettings()));
QPushButton *apply = this->button (QDialogButtonBox::Apply);
connect (apply, SIGNAL (clicked()), this, SLOT (updateSettings()));

connect( this, SIGNAL( finished( int ) ), this, SLOT( deleteLater() ) );
connect (this, SIGNAL (finished (int)), this, SLOT (deleteLater()));
}

ConfigDialog::~ConfigDialog()
Expand All @@ -54,12 +54,12 @@ void ConfigDialog::updateSettings()
// User clicks Ok or Apply button in configuration dialog

m_shortcutsPage->save();
PlayBarSettings * config = PlayBarSettings::self();
PlayBarSettings *config = PlayBarSettings::self();

config->setShowStop( m_generalPage->showStop() );
config->setControlsOnBar( m_generalPage->controlsOnBar() );
config->setButtonsAppearance( m_generalPage->buttonsAppearance() );
config->setBackgroundHint( m_generalPage->backgroundHint() );
config->setShowStop (m_generalPage->showStop());
config->setControlsOnBar (m_generalPage->controlsOnBar());
config->setButtonsAppearance (m_generalPage->buttonsAppearance());
config->setBackgroundHint (m_generalPage->backgroundHint());
config->save();
qDebug() << "PlayBarEngine: config saved";
}
Expand Down
22 changes: 11 additions & 11 deletions engine/generalwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,29 @@

#include "generalwidget.h"

GeneralWidget::GeneralWidget( QWidget * parent )
: QWidget( parent )
GeneralWidget::GeneralWidget (QWidget *parent)
: QWidget (parent)
{
m_ui.setupUi( this );
m_ui.setupUi (this);

connect( m_ui.flat, SIGNAL( toggled( bool ) ), this, SLOT( setButtonsAppearance( bool ) ) );
connect (m_ui.flat, SIGNAL (toggled (bool)), this, SLOT (setButtonsAppearance (bool)));

connect( m_ui.normal, SIGNAL( toggled( bool ) ), this, SLOT( setBackgroundHint() ) );
connect( m_ui.translucent, SIGNAL( toggled( bool ) ), this, SLOT( setBackgroundHint() ) );
connect( m_ui.nobackground, SIGNAL( toggled( bool ) ), this, SLOT( setBackgroundHint() ) );
connect (m_ui.normal, SIGNAL (toggled (bool)), this, SLOT (setBackgroundHint()));
connect (m_ui.translucent, SIGNAL (toggled (bool)), this, SLOT (setBackgroundHint()));
connect (m_ui.nobackground, SIGNAL (toggled (bool)), this, SLOT (setBackgroundHint()));
}

void GeneralWidget::setButtonsAppearance( bool checked )
void GeneralWidget::setButtonsAppearance (bool checked)
{
if( checked ) m_buttonsAppearance = 0;
if (checked) m_buttonsAppearance = 0;
else m_buttonsAppearance = 1;
}

void GeneralWidget::setBackgroundHint()
{
if( m_ui.normal->isChecked() )
if (m_ui.normal->isChecked())
m_backgroundHint = 1; // standard
else if( m_ui.translucent->isChecked() )
else if (m_ui.translucent->isChecked())
m_backgroundHint = 2; // translucent
else
m_backgroundHint = 0; // no background
Expand Down
116 changes: 61 additions & 55 deletions engine/playbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,51 +29,52 @@
#include <Plasma/Service>
#include <Plasma/ServiceJob>


#include "playbarsettings.h"

using namespace Plasma;

PlayBar::PlayBar( KSharedConfigPtr &config , QObject * parent )
: QObject( parent ),
m_configDialog( nullptr ),
m_config( config ),
m_data( new Plasma::DataEngine::Data() )
PlayBar::PlayBar (KSharedConfigPtr &config , QObject *parent)
: QObject (parent),
m_configDialog (nullptr),
m_config (config),
m_data (new Plasma::DataEngine::Data())
{
m_dc = new DataEngineConsumer();
m_collection = new KActionCollection( this, QLatin1String( "PlayBar" ) );
m_collection->setComponentDisplayName( QLatin1String( "PlayBar" ) );
m_collection = new KActionCollection (this, QLatin1String ("PlayBar"));
m_collection->setComponentDisplayName (QLatin1String ("PlayBar"));

m_playpause = m_collection->addAction( QLatin1String( "play-pause" ), this, SLOT( slotPlayPause() ) );
m_playpause->setIcon( QIcon::fromTheme( QLatin1String( "media-playback-start" ) ) );
m_playpause->setText( i18n( "Play/Pause" ) );
KGlobalAccel::setGlobalShortcut( m_playpause, Qt::Key_MediaPlay );
m_playpause = m_collection->addAction (QLatin1String ("play-pause"), this, SLOT (slotPlayPause()));
m_playpause->setIcon (QIcon::fromTheme (QLatin1String ("media-playback-start")));
m_playpause->setText (i18n ("Play/Pause"));
KGlobalAccel::setGlobalShortcut (m_playpause, Qt::Key_MediaPlay);

m_stop = m_collection->addAction( QLatin1String( "stop" ), this, SLOT( slotStop() ) );
m_stop->setIcon( QIcon::fromTheme( QLatin1String( "media-playback-stop" ) ) );
m_stop->setText( i18n( "Stop" ) );
KGlobalAccel::setGlobalShortcut( m_stop, Qt::Key_MediaStop );
m_stop = m_collection->addAction (QLatin1String ("stop"), this, SLOT (slotStop()));
m_stop->setIcon (QIcon::fromTheme (QLatin1String ("media-playback-stop")));
m_stop->setText (i18n ("Stop"));
KGlobalAccel::setGlobalShortcut (m_stop, Qt::Key_MediaStop);

m_next = m_collection->addAction( QLatin1String( "next" ), this, SLOT( slotNext() ) );
m_next->setIcon( QIcon::fromTheme( QLatin1String( "media-skip-forward" ) ) );
m_next->setText( i18n( "Next track" ) );
KGlobalAccel::setGlobalShortcut( m_next, Qt::Key_MediaNext );
m_next = m_collection->addAction (QLatin1String ("next"), this, SLOT (slotNext()));
m_next->setIcon (QIcon::fromTheme (QLatin1String ("media-skip-forward")));
m_next->setText (i18n ("Next track"));
KGlobalAccel::setGlobalShortcut (m_next, Qt::Key_MediaNext);

m_previous = m_collection->addAction( QLatin1String( "previous" ), this, SLOT( slotPrevious() ) );
m_previous->setIcon( QIcon::fromTheme( QLatin1String( "media-skip-backward" ) ) );
m_previous->setText( i18n( "Previous track" ) );
KGlobalAccel::setGlobalShortcut( m_previous, Qt::Key_MediaPrevious );
m_previous = m_collection->addAction (QLatin1String ("previous"), this, SLOT (slotPrevious()));
m_previous->setIcon (QIcon::fromTheme (QLatin1String ("media-skip-backward")));
m_previous->setText (i18n ("Previous track"));
KGlobalAccel::setGlobalShortcut (m_previous, Qt::Key_MediaPrevious);

m_volumeUp = m_collection->addAction( QLatin1String( "volume-up" ), this, SLOT( slotVolumeUp() ) );
m_volumeUp->setText( i18n( "Volume up" ) );
KGlobalAccel::setGlobalShortcut( m_volumeUp, QKeySequence() );
m_volumeUp = m_collection->addAction (QLatin1String ("volume-up"), this, SLOT (slotVolumeUp()));
m_volumeUp->setText (i18n ("Volume up"));
KGlobalAccel::setGlobalShortcut (m_volumeUp, QKeySequence());

m_volumeDown = m_collection->addAction( QLatin1String( "volume-down" ), this, SLOT( slotVolumeDown() ) );
m_volumeDown->setText( i18n( "Volume down" ) );
KGlobalAccel::setGlobalShortcut( m_volumeDown, QKeySequence() );
m_volumeDown = m_collection->addAction (QLatin1String ("volume-down"), this, SLOT (slotVolumeDown()));
m_volumeDown->setText (i18n ("Volume down"));
KGlobalAccel::setGlobalShortcut (m_volumeDown, QKeySequence());

m_openMediaPlayer = m_collection->addAction( QLatin1String( "toggle-mediaplayer" ), this, SLOT( slotToggleWinMediaPlayer() ) );
m_openMediaPlayer->setText( i18n( "Toggle window media player" ) );
KGlobalAccel::setGlobalShortcut( m_openMediaPlayer, QKeySequence() );
m_openMediaPlayer = m_collection->addAction (QLatin1String ("toggle-mediaplayer"), this, SLOT (slotToggleWinMediaPlayer()));
m_openMediaPlayer->setText (i18n ("Toggle window media player"));
KGlobalAccel::setGlobalShortcut (m_openMediaPlayer, QKeySequence());

//connect( m_configDialog, SIGNAL( settingsChanged( QString ) ), this, SLOT( loadSettings() ) );
}
Expand All @@ -82,22 +83,22 @@ PlayBar::~PlayBar() {}

void PlayBar::slotPlayPause()
{
startOpOverMpris2( "PlayPause" );
startOpOverMpris2 ("PlayPause");
}

void PlayBar::slotStop()
{
startOpOverMpris2( "Stop" );
startOpOverMpris2 ("Stop");
}

void PlayBar::slotNext()
{
startOpOverMpris2( "Next" );
startOpOverMpris2 ("Next");
}

void PlayBar::slotPrevious()
{
startOpOverMpris2( "Previous" );
startOpOverMpris2 ("Previous");
}

void PlayBar::slotVolumeUp()
Expand All @@ -111,17 +112,19 @@ void PlayBar::slotVolumeDown()

void PlayBar::slotToggleWinMediaPlayer()
{
startOpOverMpris2( "Raise" );
startOpOverMpris2 ("Raise");
}

void PlayBar::showSettings()
{
if( KConfigDialog::showDialog( ConfigDialog::CONFIG_NAME ) )
if (KConfigDialog::showDialog (ConfigDialog::CONFIG_NAME))
return;

//Read preferences from config file.
PlayBarSettings::self()->load();
m_configDialog = new ConfigDialog( m_collection );
connect( this, SIGNAL( destroyed( QObject * ) ), m_configDialog, SLOT( deleteLater() ) );
Q_ASSERT (m_collection);
m_configDialog = new ConfigDialog (m_collection);
connect (this, SIGNAL (destroyed (QObject *)), m_configDialog, SLOT (deleteLater()));
m_configDialog->show();
}

Expand All @@ -130,25 +133,28 @@ const DataEngine::Data &PlayBar::data()
auto config = PlayBarSettings::self();
// Read preferences from the KConfig object.
config->read();
for( auto item : config->items() ) {

for (auto item : config->items()) {
QString name = item->name();
if( name == QLatin1String( "ShowStop" ) )
m_data->insert( name, config->showStop() );
else if( name == QLatin1String( "ControlsOnBar" ) )
m_data->insert( name, config->controlsOnBar() );
else if( name == QLatin1String( "ButtonsAppearance" ) )
m_data->insert( name , config->buttonsAppearance() );
else if( name == QLatin1String( "BackgroundHint" ) )
m_data->insert( name, config->backgroundHint() );

if (name == QLatin1String ("ShowStop"))
m_data->insert (name, config->showStop());
else if (name == QLatin1String ("ControlsOnBar"))
m_data->insert (name, config->controlsOnBar());
else if (name == QLatin1String ("ButtonsAppearance"))
m_data->insert (name , config->buttonsAppearance());
else if (name == QLatin1String ("BackgroundHint"))
m_data->insert (name, config->backgroundHint());
}

return *m_data;
}

void PlayBar::startOpOverMpris2( const QString &name ) const
void PlayBar::startOpOverMpris2 (const QString &name) const
{
DataEngine * mpris2 = m_dc->dataEngine( MPRIS2 );
Service * serv = mpris2->serviceForSource( mpris2_source );
const QVariantMap &op = serv->operationDescription( name );
ServiceJob * job = serv->startOperationCall( op );
connect( job, SIGNAL( finished( KJob * ) ), serv, SLOT( deleteLater() ) );
DataEngine *mpris2 = m_dc->dataEngine (MPRIS2);
Service *serv = mpris2->serviceForSource (mpris2_source);
const QVariantMap &op = serv->operationDescription (name);
ServiceJob *job = serv->startOperationCall (op);
connect (job, SIGNAL (finished (KJob *)), serv, SLOT (deleteLater()));
}
Loading

0 comments on commit 255fe5d

Please sign in to comment.