Commit 094ed868 authored by Michael Pyne's avatar Michael Pyne

Avoid deprecated KGlobal::config.

parent 925bc93a
......@@ -116,7 +116,7 @@ void CollectionList::completedLoadingCachedItems()
{
// The CollectionList is created with sorting disabled for speed. Re-enable
// it here, and perform the sort.
KConfigGroup config(KGlobal::config(), "Playlists");
KConfigGroup config(KSharedConfig::openConfig(), "Playlists");
Qt::SortOrder order = Qt::DescendingOrder;
if(config.readEntry("CollectionListSortAscending", true))
......@@ -355,7 +355,7 @@ CollectionList::CollectionList(PlaylistCollection *collection) :
CollectionList::~CollectionList()
{
KConfigGroup config(KGlobal::config(), "Playlists");
KConfigGroup config(KSharedConfig::openConfig(), "Playlists");
config.writeEntry("CollectionListSortColumn", header()->sortIndicatorSection());
config.writeEntry("CollectionListSortAscending", header()->sortIndicatorOrder() == Qt::AscendingOrder);
......
......@@ -38,7 +38,7 @@ DeleteWidget::DeleteWidget(QWidget *parent)
setObjectName( QLatin1String("delete_dialog_widget" ));
KConfigGroup messageGroup(KGlobal::config()->group("FileRemover"));
KConfigGroup messageGroup(KSharedConfig::openConfig(), "FileRemover");
bool deleteInstead = messageGroup.readEntry("deleteInsteadOfTrash", false);
slotShouldDelete(deleteInstead);
......@@ -119,7 +119,7 @@ void DeleteDialog::setFiles(const QStringList &files)
void DeleteDialog::accept()
{
KConfigGroup messageGroup(KGlobal::config()->group("FileRemover"));
KConfigGroup messageGroup(KSharedConfig::openConfig(), "FileRemover");
// Save user's preference
......
......@@ -122,7 +122,7 @@ public:
ConfigCategoryReader::ConfigCategoryReader() : CategoryReaderInterface(),
m_currentItem(0)
{
KConfigGroup config(KGlobal::config(), "FileRenamer");
KConfigGroup config(KSharedConfig::openConfig(), "FileRenamer");
QList<int> categoryOrder = config.readEntry("CategoryOrder", QList<int>());
int categoryCount[NumTypes] = { 0 }; // Keep track of each category encountered.
......@@ -278,7 +278,7 @@ FileRenamerWidget::FileRenamerWidget(QWidget *parent) :
void FileRenamerWidget::loadConfig()
{
QList<int> checkedSeparators;
KConfigGroup config(KGlobal::config(), "FileRenamer");
KConfigGroup config(KSharedConfig::openConfig(), "FileRenamer");
for(int i = 0; i < m_rows.count(); ++i)
m_rows[i].options = TagRenamerOptions(m_rows[i].category);
......@@ -301,7 +301,7 @@ void FileRenamerWidget::loadConfig()
void FileRenamerWidget::saveConfig()
{
KConfigGroup config(KGlobal::config(), "FileRenamer");
KConfigGroup config(KSharedConfig::openConfig(), "FileRenamer");
QList<int> checkedSeparators;
QList<int> categoryOrder;
......@@ -501,7 +501,7 @@ void FileRenamerWidget::addFolderSeparatorCheckbox()
void FileRenamerWidget::createTagRows()
{
KConfigGroup config(KGlobal::config(), "FileRenamer");
KConfigGroup config(KSharedConfig::openConfig(), "FileRenamer");
QList<int> categoryOrder = config.readEntry("CategoryOrder", QList<int>());
if(categoryOrder.isEmpty())
......
......@@ -99,10 +99,10 @@ JuK::JuK(const QStringList &filesToOpen, QWidget *parent) :
setupActions();
setupLayout();
bool firstRun = !KGlobal::config()->hasGroup("MainWindow");
bool firstRun = !KSharedConfig::openConfig()->hasGroup("MainWindow");
if(firstRun) {
KConfigGroup mainWindowConfig(KGlobal::config(), "MainWindow");
KConfigGroup mainWindowConfig(KSharedConfig::openConfig(), "MainWindow");
KConfigGroup playToolBarConfig(&mainWindowConfig, "Toolbar playToolBar");
playToolBarConfig.writeEntry("ToolButtonStyle", "IconOnly");
}
......@@ -410,7 +410,7 @@ void JuK::keyPressEvent(QKeyEvent *e)
void JuK::readSettings()
{
KConfigGroup config(KGlobal::config(), "Settings");
KConfigGroup config(KSharedConfig::openConfig(), "Settings");
m_showSplash = config.readEntry("ShowSplashScreen", true);
m_startDocked = config.readEntry("StartDocked", false);
}
......@@ -419,7 +419,7 @@ void JuK::readConfig()
{
// player settings
KConfigGroup playerConfig(KGlobal::config(), "Player");
KConfigGroup playerConfig(KSharedConfig::openConfig(), "Player");
if(m_player)
{
......@@ -449,7 +449,7 @@ void JuK::readConfig()
// general settings
KConfigGroup settingsConfig(KGlobal::config(), "Settings");
KConfigGroup settingsConfig(KSharedConfig::openConfig(), "Settings");
bool dockInSystemTray = settingsConfig.readEntry("DockInSystemTray", true);
m_toggleSystemTrayAction->setChecked(dockInSystemTray);
......@@ -467,7 +467,7 @@ void JuK::saveConfig()
{
// player settings
KConfigGroup playerConfig(KGlobal::config(), "Player");
KConfigGroup playerConfig(KSharedConfig::openConfig(), "Player");
if (m_player)
{
......@@ -492,14 +492,14 @@ void JuK::saveConfig()
// general settings
KConfigGroup settingsConfig(KGlobal::config(), "Settings");
KConfigGroup settingsConfig(KSharedConfig::openConfig(), "Settings");
settingsConfig.writeEntry("ShowSplashScreen", m_toggleSplashAction->isChecked());
settingsConfig.writeEntry("StartDocked", m_startDocked);
settingsConfig.writeEntry("DockInSystemTray", m_toggleSystemTrayAction->isChecked());
settingsConfig.writeEntry("DockOnClose", m_toggleDockOnCloseAction->isChecked());
settingsConfig.writeEntry("TrackPopup", m_togglePopupsAction->isChecked());
KGlobal::config()->sync();
KSharedConfig::openConfig()->sync();
}
bool JuK::queryClose()
......
......@@ -98,7 +98,7 @@ KeyDialog::KeyDialog(KActionCollection *actionCollection, QWidget *parent)
// Read key group from configuration
KConfigGroup config(KGlobal::config(), "Shortcuts");
KConfigGroup config(KSharedConfig::openConfig(), "Shortcuts");
int selectedButton = config.readEntry("GlobalKeys", int(StandardKeys));
// Create widgets for key chooser
......@@ -148,10 +148,10 @@ int KeyDialog::configure()
int retcode = exec();
if(retcode == Accepted) {
KConfigGroup config(KGlobal::config(), "Shortcuts");
KConfigGroup config(KSharedConfig::openConfig(), "Shortcuts");
config.writeEntry("GlobalKeys", m_group->checkedId());
KGlobal::config()->sync();
KSharedConfig::openConfig()->sync();
m_pKeyChooser->save();
}
......@@ -203,7 +203,7 @@ void KeyDialog::setupActionShortcut(const QString &actionName)
KShortcut shortcut = KShortcut();
// Find out what type is selected so we know what keys to setup.
KConfigGroup config(KGlobal::config(), "Shortcuts");
KConfigGroup config(KSharedConfig::openConfig(), "Shortcuts");
int selectedKeys = config.readEntry("GlobalKeys", int(StandardKeys));
for(uint i = 0; i < keyInfoCount; i++) {
......
......@@ -46,7 +46,7 @@ LyricsWidget::LyricsWidget(QWidget* parent): QTextBrowser(parent),
ActionCollection::actions()->addAction("showLyrics", show);
connect(show, SIGNAL(toggled(bool)), this, SLOT(setVisible(bool)));
KConfigGroup config(KGlobal::config(), "LyricsWidget");
KConfigGroup config(KSharedConfig::openConfig(), "LyricsWidget");
bool shown = config.readEntry("Show", true);
show->setChecked(shown);
setVisible(shown);
......@@ -60,7 +60,7 @@ LyricsWidget::~LyricsWidget()
void LyricsWidget::saveConfig()
{
KConfigGroup config(KGlobal::config(), "LyricsWidget");
KConfigGroup config(KSharedConfig::openConfig(), "LyricsWidget");
config.writeEntry("Show", ActionCollection::action<KToggleAction>("showLyrics")->isChecked());
}
......
......@@ -104,7 +104,7 @@ int main(int argc, char *argv[])
if(a.isSessionRestored() && KMainWindow::canBeRestored(1))
juk->restore(1, false /* don't show */);
KConfigGroup config(KGlobal::config(), "Settings");
KConfigGroup config(KSharedConfig::openConfig(), "Settings");
if(!config.readEntry("StartDocked", false)) {
juk->show();
}
......
......@@ -265,7 +265,7 @@ void Playlist::SharedSettings::apply(Playlist *l) const
Playlist::SharedSettings::SharedSettings()
{
KConfigGroup config(KGlobal::config(), "PlaylistShared");
KConfigGroup config(KSharedConfig::openConfig(), "PlaylistShared");
bool resizeColumnsManually = config.readEntry("ResizeColumnsManually", false);
action("resizeColumnsManually")->setChecked(resizeColumnsManually);
......@@ -306,7 +306,7 @@ Playlist::SharedSettings::SharedSettings()
void Playlist::SharedSettings::writeConfig()
{
KConfigGroup config(KGlobal::config(), "PlaylistShared");
KConfigGroup config(KSharedConfig::openConfig(), "PlaylistShared");
config.writeEntry("ColumnOrder", m_columnOrder);
QList<int> l;
......@@ -318,7 +318,7 @@ void Playlist::SharedSettings::writeConfig()
config.writeEntry("ResizeColumnsManually", manualResize());
KGlobal::config()->sync();
KSharedConfig::openConfig()->sync();
}
////////////////////////////////////////////////////////////////////////////////
......
......@@ -308,15 +308,15 @@ void PlaylistBox::removePlaylist(Playlist *playlist)
void PlaylistBox::readConfig()
{
KConfigGroup config(KGlobal::config(), "PlaylistBox");
KConfigGroup config(KSharedConfig::openConfig(), "PlaylistBox");
m_viewModeIndex = config.readEntry("ViewMode", 0);
}
void PlaylistBox::saveConfig()
{
KConfigGroup config(KGlobal::config(), "PlaylistBox");
KConfigGroup config(KSharedConfig::openConfig(), "PlaylistBox");
config.writeEntry("ViewMode", action<KSelectAction>("viewModeMenu")->currentItem());
KGlobal::config()->sync();
KSharedConfig::openConfig()->sync();
}
void PlaylistBox::remove()
......@@ -747,7 +747,7 @@ void PlaylistBox::setupItem(Item *item)
void PlaylistBox::setupUpcomingPlaylist()
{
KConfigGroup config(KGlobal::config(), "Playlists");
KConfigGroup config(KSharedConfig::openConfig(), "Playlists");
bool enable = config.readEntry("showUpcoming", false);
setUpcomingPlaylistEnabled(enable);
......
......@@ -875,7 +875,7 @@ void PlaylistCollection::newItems(const KFileItemList &list) const
void PlaylistCollection::readConfig()
{
KConfigGroup config(KGlobal::config(), "Playlists");
KConfigGroup config(KSharedConfig::openConfig(), "Playlists");
m_importPlaylists = config.readEntry("ImportPlaylists", true);
m_folderList = config.readEntry("DirectoryList", QStringList());
......@@ -889,7 +889,7 @@ void PlaylistCollection::readConfig()
void PlaylistCollection::saveConfig()
{
KConfigGroup config(KGlobal::config(), "Playlists");
KConfigGroup config(KSharedConfig::openConfig(), "Playlists");
config.writeEntry("ImportPlaylists", m_importPlaylists);
config.writeEntry("showUpcoming", action("showUpcoming")->isChecked());
config.writePathEntry("DirectoryList", m_folderList);
......
......@@ -268,7 +268,7 @@ void PlaylistSplitter::setupLayout()
void PlaylistSplitter::readConfig()
{
KConfigGroup config(KGlobal::config(), "Splitter");
KConfigGroup config(KSharedConfig::openConfig(), "Splitter");
QList<int> splitterSizes = config.readEntry("PlaylistSplitterSizes",QList<int>());
if(splitterSizes.isEmpty()) {
......@@ -295,7 +295,7 @@ void PlaylistSplitter::readConfig()
void PlaylistSplitter::saveConfig()
{
KConfigGroup config(KGlobal::config(), "Splitter");
KConfigGroup config(KSharedConfig::openConfig(), "Splitter");
config.writeEntry("PlaylistSplitterSizes", sizes());
config.writeEntry("ShowSearch", ActionCollection::action<KToggleAction>("showSearch")->isChecked());
config.writeEntry("EditorSplitterSizes", m_editorSplitter->sizes());
......
......@@ -82,7 +82,7 @@ ScrobbleConfigDlg::ScrobbleConfigDlg(QWidget* parent, Qt::WindowFlags f)
// Warning message, KWallet is safer than KConfig.
KMessageBox::information(this, i18n("KWallet is unavailable, your Last.fm credentials will be stored without encryption."), i18n("KWallet is unavailable"));
KConfigGroup config(KGlobal::config(), "Scrobbling");
KConfigGroup config(KSharedConfig::openConfig(), "Scrobbling");
m_usernameEdit->setText(config.readEntry("Username", ""));
m_passwordEdit->setText(config.readEntry("Password", ""));
}
......@@ -126,7 +126,7 @@ void ScrobbleConfigDlg::save()
} else {
KConfigGroup config(KGlobal::config(), "Scrobbling");
KConfigGroup config(KSharedConfig::openConfig(), "Scrobbling");
config.writeEntry("Username", m_usernameEdit->text());
config.writeEntry("Password", m_passwordEdit->text());
}
......
......@@ -48,7 +48,7 @@ Scrobbler::Scrobbler(QObject* parent)
} else {
KConfigGroup config(KGlobal::config(), "Scrobbling");
KConfigGroup config(KSharedConfig::openConfig(), "Scrobbling");
sessionKey.append(config.readEntry("SessionKey", ""));
}
......@@ -67,7 +67,7 @@ bool Scrobbler::isScrobblingEnabled()
if (KWallet::Wallet::folderDoesNotExist(KWallet::Wallet::LocalWallet(), "JuK")) {
KConfigGroup config(KGlobal::config(), "Scrobbling");
KConfigGroup config(KSharedConfig::openConfig(), "Scrobbling");
username = config.readEntry("Username", "");
password = config.readEntry("Password", "");
......@@ -187,7 +187,7 @@ void Scrobbler::getAuthToken()
} else {
KConfigGroup config(KGlobal::config(), "Scrobbling");
KConfigGroup config(KSharedConfig::openConfig(), "Scrobbling");
username = config.readEntry("Username", "");
password = config.readEntry("Password", "");
}
......@@ -229,7 +229,7 @@ void Scrobbler::handleAuthenticationReply()
} else {
KConfigGroup config(KGlobal::config(), "Scrobbling");
KConfigGroup config(KSharedConfig::openConfig(), "Scrobbling");
config.writeEntry("SessionKey", sessionKey);
}
......@@ -248,7 +248,7 @@ void Scrobbler::nowPlaying(const FileHandle& file)
} else {
KConfigGroup config(KGlobal::config(), "Scrobbling");
KConfigGroup config(KSharedConfig::openConfig(), "Scrobbling");
sessionKey = config.readEntry("SessionKey", "");
}
......@@ -284,7 +284,7 @@ void Scrobbler::scrobble()
} else {
KConfigGroup config(KGlobal::config(), "Scrobbling");
KConfigGroup config(KSharedConfig::openConfig(), "Scrobbling");
sessionKey = config.readEntry("SessionKey", "");
}
......
......@@ -437,7 +437,7 @@ void TagEditor::readConfig()
{
// combo box completion modes
KConfigGroup config(KGlobal::config(), "TagEditor");
KConfigGroup config(KSharedConfig::openConfig(), "TagEditor");
if(artistNameBox && albumNameBox) {
readCompletionMode(config, artistNameBox, "ArtistNameBoxMode");
readCompletionMode(config, albumNameBox, "AlbumNameBoxMode");
......@@ -473,7 +473,7 @@ void TagEditor::saveConfig()
{
// combo box completion modes
KConfigGroup config(KGlobal::config(), "TagEditor");
KConfigGroup config(KSharedConfig::openConfig(), "TagEditor");
if(artistNameBox && albumNameBox) {
config.writeEntry("ArtistNameBoxMode", (int)artistNameBox->completionMode());
......
......@@ -103,7 +103,7 @@ QString FileNameScheme::composeRegExp(const QString &s) const
{
QHash<QChar, QString> substitutions;
KConfigGroup config(KGlobal::config(), "TagGuesser");
KConfigGroup config(KSharedConfig::openConfig(), "TagGuesser");
substitutions[ 't' ] = config.readEntry("Title regexp", "([\\w\\s'&_,\\.]+)");
substitutions[ 'a' ] = config.readEntry("Artist regexp", "([\\w\\s'&_,\\.]+)");
......@@ -123,7 +123,7 @@ QStringList TagGuesser::schemeStrings()
{
QStringList schemes;
KConfigGroup config(KGlobal::config(), "TagGuesser");
KConfigGroup config(KSharedConfig::openConfig(), "TagGuesser");
schemes = config.readEntry("Filename schemes", QStringList());
if ( schemes.isEmpty() ) {
......@@ -160,7 +160,7 @@ QStringList TagGuesser::schemeStrings()
void TagGuesser::setSchemeStrings(const QStringList &schemes)
{
KSharedConfig::Ptr cfg = KGlobal::config();
KSharedConfig::Ptr cfg = KSharedConfig::openConfig();
KConfigGroup group(cfg, "TagGuesser");
group.writeEntry("Filename schemes", schemes);
cfg->sync();
......
......@@ -66,7 +66,7 @@ TagRenamerOptions::TagRenamerOptions(const CategoryID &category)
// Make sure we don't use translated strings for the config file keys.
QString typeKey = tagTypeText(category.category, false);
KConfigGroup config(KGlobal::config(), "FileRenamer");
KConfigGroup config(KSharedConfig::openConfig(), "FileRenamer");
if(categoryNum > 0)
typeKey.append(QString::number(categoryNum));
......@@ -141,7 +141,7 @@ void TagRenamerOptions::saveConfig(unsigned categoryNum) const
if(categoryNum > 0)
typeKey.append(QString::number(categoryNum));
KConfigGroup config(KGlobal::config(), "FileRenamer");
KConfigGroup config(KSharedConfig::openConfig(), "FileRenamer");
config.writeEntry(QString("%1Suffix").arg(typeKey), suffix());
config.writeEntry(QString("%1Prefix").arg(typeKey), prefix());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment