[Amarok] Revert "MySQL database configuration support. Than

Seb Ruiz ruiz at kde.org
Mon Aug 31 23:47:42 CEST 2009


Can we re-apply this patch and simply not include the page in the
config dialogs? This would allow translators to still see and
translate the strings.

2009/9/1 Leo Franchi <lfranchi at kde.org>:
> commit 8abba88c0218d4acc3bc9640685410bda5c1254e
> Author:     Leo Franchi <lfranchi at kde.org>
> AuthorDate: Mon Aug 31 11:34:44 2009 -0400
> Commit:     Leo Franchi <lfranchi at kde.org>
> CommitDate: Mon Aug 31 11:34:44 2009 -0400
>
>    Revert "MySQL database configuration support. Thanks to John Atkinson for the patch!"
>
>    Will re-apply after tagging and try to fix, but for now the crashes and kcfg issues are not release-worthy
>
>    This reverts commit 698fd3c2b47f876b5ef053d0028d594ca8e34df9.
>
> diff --git a/ChangeLog b/ChangeLog
> index 3367f14..da3b3d5 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -64,7 +64,8 @@ VERSION 2.2-beta1
>       The video can be appended to the playlist, and rendered within the applet.
>     * Photo applet to show images from Flickr, with customizable animations.
>     * Customizable user interface using dock widgets.
> -    * Support for external MySQL database.
> +    * Support for external MySQL database. See
> +      http://amarok.kde.org/wiki/MySQL_Server.
>     * GHNS integration for downloading and installing Context applets.
>     * Support for Context applets to be written in QtScript.
>     * Custom Dynamic Playlists using Last.fm.
> diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
> index cab1d28..323fe0d 100644
> --- a/src/CMakeLists.txt
> +++ b/src/CMakeLists.txt
> @@ -187,7 +187,6 @@ set(libconfigdialog_SRCS
>     configdialog/dialogs/OsdConfig.cpp
>     configdialog/dialogs/PlaybackConfig.cpp
>     configdialog/dialogs/ServiceConfig.cpp
> -    configdialog/dialogs/DatabaseConfig.cpp
>  )
>
>  kde4_add_ui_files(libconfigdialog_SRCS
> @@ -195,7 +194,6 @@ kde4_add_ui_files(libconfigdialog_SRCS
>     configdialog/dialogs/GeneralConfig.ui
>     configdialog/dialogs/OsdConfig.ui
>     configdialog/dialogs/PlaybackConfig.ui
> -    configdialog/dialogs/DatabaseConfig.ui
>  )
>
>  set(libbrowserframework_SRCS
> diff --git a/src/configdialog/ConfigDialog.cpp b/src/configdialog/ConfigDialog.cpp
> index 58bcb48..e4a2072 100644
> --- a/src/configdialog/ConfigDialog.cpp
> +++ b/src/configdialog/ConfigDialog.cpp
> @@ -27,7 +27,6 @@
>  #include "OsdConfig.h"
>  #include "PlaybackConfig.h"
>  #include "ServiceConfig.h"
> -#include "DatabaseConfig.h"
>
>  #include <KLocale>
>
> @@ -48,7 +47,6 @@ Amarok2ConfigDialog::Amarok2ConfigDialog( QWidget *parent, const char* name, KCo
>     ConfigDialogBase* services    = new ServiceConfig( this );
>     ConfigDialogBase* playback    = new PlaybackConfig( this );
>     ConfigDialogBase* osd         = new OsdConfig( this );
> -    ConfigDialogBase* database    = new DatabaseConfig( this );
>
>     connect( general, SIGNAL( lockLayout( bool ) ), The::mainWindow(), SLOT ( setLayoutLocked( bool ) ) );
>
> @@ -59,7 +57,6 @@ Amarok2ConfigDialog::Amarok2ConfigDialog( QWidget *parent, const char* name, KCo
>     addPage( services,    i18n( "Internet Services" ), "services-amarok", i18n( "Configure Services" ) );
>     addPage( playback,    i18n( "Playback" ), "preferences-media-playback-amarok", i18n( "Configure Playback" ) );
>     addPage( osd,         i18n( "On Screen Display" ), "preferences-indicator-amarok", i18n( "Configure On-Screen-Display" ) );
> -    addPage( database,    i18n( "Database" ), "server-database", i18n( "Configure Database" ) );
>  //    addPage( mediadevice, i18n( "Media Devices" ), "preferences-multimedia-player-amarok", i18n( "Configure Portable Player Support" ) );
>
>     setButtons( Help | Ok | Apply | Cancel );
> diff --git a/src/configdialog/dialogs/DatabaseConfig.cpp b/src/configdialog/dialogs/DatabaseConfig.cpp
> deleted file mode 100644
> index 8f4bba7..0000000
> --- a/src/configdialog/dialogs/DatabaseConfig.cpp
> +++ /dev/null
> @@ -1,158 +0,0 @@
> -/****************************************************************************************
> - * Copyright (c) 2009 John Atkinson <john at fauxnetic.co.uk>                              *
> - *                                                                                      *
> - * This program is free software; you can redistribute it and/or modify it under        *
> - * the terms of the GNU General Public License as published by the Free Software        *
> - * Foundation; either version 2 of the License, or (at your option) any later           *
> - * version.                                                                             *
> - *                                                                                      *
> - * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
> - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
> - * PARTICULAR PURPOSE. See the GNU General Public License for more details.              *
> - *                                                                                      *
> - * You should have received a copy of the GNU General Public License along with         *
> - * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
> - ****************************************************************************************/
> -
> -#include "DatabaseConfig.h"
> -
> -#include "Amarok.h"
> -#include "Debug.h"
> -
> -#include <KCMultiDialog>
> -
> -
> -DatabaseConfig::DatabaseConfig( QWidget* parent )
> -    : ConfigDialogBase( parent )
> -{
> -    setupUi( this );
> -
> -    // Fix some weird tab orderness
> -    setTabOrder( kcfg_Server,   kcfg_Port );     // server to port
> -    setTabOrder( kcfg_Port,     kcfg_Username ); // port to username
> -    setTabOrder( kcfg_Username, kcfg_Password ); // username to password
> -    setTabOrder( kcfg_Password, kcfg_DBName );   // password to database
> -
> -    readConfiguration();
> -
> -    connect( kcfg_UseInternalDB, SIGNAL( stateChanged(int) ), SLOT( toggleExternalConfigAvailable(int) ) );
> -
> -    connect( kcfg_DBName,   SIGNAL( textChanged(const QString &) ), SLOT( updateSQLQuery() ) );
> -    connect( kcfg_Username, SIGNAL( textChanged(const QString &) ), SLOT( updateSQLQuery() ) );
> -    connect( kcfg_Server,   SIGNAL( textChanged(const QString &) ), SLOT( updateSQLQuery() ) );
> -
> -}
> -
> -DatabaseConfig::~DatabaseConfig()
> -{}
> -
> -
> -///////////////////////////////////////////////////////////////
> -// REIMPLEMENTED METHODS from ConfigDialogBase
> -///////////////////////////////////////////////////////////////
> -
> -bool
> -DatabaseConfig::hasChanged()
> -{
> -    return false;
> -}
> -
> -bool
> -DatabaseConfig::isDefault()
> -{
> -    return false;
> -}
> -
> -void
> -DatabaseConfig::updateSettings()
> -{
> -    writeConfiguration();
> -}
> -
> -
> -///////////////////////////////////////////////////////////////
> -// PRIVATE METHODS
> -///////////////////////////////////////////////////////////////
> -
> -void
> -DatabaseConfig::readConfiguration()
> -{
> -    KConfigGroup config = Amarok::config( "MySQL" );
> -
> -    kcfg_UseInternalDB->setChecked( !config.readEntry( "UseServer", false ) );
> -
> -    kcfg_Server->setText( config.readEntry( "Host", "localhost" ).toUtf8() );
> -    kcfg_Port->setValue( config.readEntry( "Port", "3306" ).toInt() );
> -    kcfg_DBName->setText( config.readEntry( "Database", "amarokdb" ).toUtf8() );
> -
> -    kcfg_Username->setText( config.readEntry( "User", "amarokuser" ).toUtf8() );
> -    kcfg_Password->setText( config.readEntry( "Password", "" ).toUtf8() );
> -
> -
> -    toggleExternalConfigAvailable( kcfg_UseInternalDB->checkState() );
> -    updateSQLQuery();
> -}
> -
> -void
> -DatabaseConfig::writeConfiguration()
> -{
> -    KConfigGroup config = Amarok::config( "MySQL" );
> -
> -    const bool useExternal = kcfg_UseInternalDB->checkState() != Qt::Checked;
> -
> -    config.writeEntry( "UseServer", useExternal );
> -
> -    if( useExternal )
> -    {
> -        config.writeEntry( "Host",     kcfg_Server->text() );
> -        config.writeEntry( "Port",     kcfg_Port->value() );
> -        config.writeEntry( "Database", kcfg_DBName->text() );
> -        config.writeEntry( "User",     kcfg_Username->text() );
> -        config.writeEntry( "Password", kcfg_Password->text() );
> -    }
> -}
> -
> -
> -void
> -DatabaseConfig::toggleExternalConfigAvailable( const int checkBoxState ) //SLOT
> -{
> -    const bool enableExternalConfig = checkBoxState != Qt::Checked;
> -
> -    label_DatabaseEngine->setEnabled( enableExternalConfig );
> -    kcfg_DatabaseEngine->setEnabled( enableExternalConfig );
> -    group_Connection->setVisible( enableExternalConfig );
> -
> -}
> -
> -void
> -DatabaseConfig::updateSQLQuery() //SLOT
> -{
> -    QString query;
> -
> -    if( isSQLInfoPresent() )
> -    {
> -        // Query template:
> -        // GRANT ALL ON amarokdb.* TO 'amarokuser'@'localhost' IDENTIFIED BY 'mypassword'; FLUSH PRIVILEGES;
> -
> -        // Don't print the actual password!
> -        const QString examplePassword = i18nc( "A default password for insertion into an example SQL command (so as not to print the real one). To be manually replaced by the user.", "password" );
> -        query = QString( "GRANT ALL ON %1.* TO '%2'@'%3' IDENTIFIED BY '%4';\nFLUSH PRIVILEGES;" )
> -                   .arg( kcfg_DBName->text() )
> -                   .arg( kcfg_Username->text() )
> -                   .arg( kcfg_Server->text() )
> -                   .arg( examplePassword );
> -    }
> -    text_SQL->setPlainText( query );
> -}
> -
> -
> -inline bool
> -DatabaseConfig::isSQLInfoPresent() const
> -{
> -    return !kcfg_DBName->text().isEmpty() && !kcfg_Username->text().isEmpty() && !kcfg_Server->text().isEmpty();
> -}
> -
> -
> -#include "DatabaseConfig.moc"
> -
> -
> diff --git a/src/configdialog/dialogs/DatabaseConfig.h b/src/configdialog/dialogs/DatabaseConfig.h
> deleted file mode 100644
> index f19481a..0000000
> --- a/src/configdialog/dialogs/DatabaseConfig.h
> +++ /dev/null
> @@ -1,51 +0,0 @@
> -/****************************************************************************************
> - * Copyright (c) 2009 John Atkinson <john at fauxnetic.co.uk>                              *
> - *                                                                                      *
> - * This program is free software; you can redistribute it and/or modify it under        *
> - * the terms of the GNU General Public License as published by the Free Software        *
> - * Foundation; either version 2 of the License, or (at your option) any later           *
> - * version.                                                                             *
> - *                                                                                      *
> - * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
> - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
> - * PARTICULAR PURPOSE. See the GNU General Public License for more details.              *
> - *                                                                                      *
> - * You should have received a copy of the GNU General Public License along with         *
> - * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
> - ****************************************************************************************/
> -
> -#ifndef DATABASECONFIG_H
> -#define DATABASECONFIG_H
> -
> -#include "ui_DatabaseConfig.h"
> -#include "ConfigDialogBase.h"
> -
> -
> -class DatabaseConfig : public ConfigDialogBase, public Ui_DatabaseConfig
> -{
> -    Q_OBJECT
> -
> -    public:
> -        DatabaseConfig( QWidget* parent );
> -        virtual ~DatabaseConfig();
> -
> -        virtual bool hasChanged();
> -        virtual bool isDefault();
> -        virtual void updateSettings();
> -
> -    protected:
> -        void readConfiguration();
> -        void writeConfiguration();
> -
> -    private slots:
> -        void toggleExternalConfigAvailable( const int checkBoxState );
> -        void updateSQLQuery();
> -
> -    private:
> -        inline bool isSQLInfoPresent() const;
> -};
> -
> -
> -#endif
> -
> -
> diff --git a/src/configdialog/dialogs/DatabaseConfig.ui b/src/configdialog/dialogs/DatabaseConfig.ui
> deleted file mode 100644
> index 02e2ea7..0000000
> --- a/src/configdialog/dialogs/DatabaseConfig.ui
> +++ /dev/null
> @@ -1,294 +0,0 @@
> -<?xml version="1.0" encoding="UTF-8"?>
> -<ui version="4.0">
> - <class>DatabaseConfig</class>
> - <widget class="QWidget" name="DatabaseConfig">
> -  <property name="geometry">
> -   <rect>
> -    <x>0</x>
> -    <y>0</y>
> -    <width>440</width>
> -    <height>426</height>
> -   </rect>
> -  </property>
> -  <layout class="QVBoxLayout" name="verticalLayout_2">
> -   <item>
> -    <widget class="QCheckBox" name="kcfg_UseInternalDB">
> -     <property name="text">
> -      <string>Use &amp;internal database (default)</string>
> -     </property>
> -    </widget>
> -   </item>
> -   <item>
> -    <layout class="QGridLayout" name="gridLayout_4">
> -     <item row="0" column="1">
> -      <widget class="QComboBox" name="kcfg_DatabaseEngine">
> -       <property name="sizePolicy">
> -        <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
> -         <horstretch>0</horstretch>
> -         <verstretch>0</verstretch>
> -        </sizepolicy>
> -       </property>
> -       <item>
> -        <property name="text">
> -         <string>MySQL</string>
> -        </property>
> -       </item>
> -      </widget>
> -     </item>
> -     <item row="0" column="0">
> -      <widget class="QLabel" name="label_DatabaseEngine">
> -       <property name="enabled">
> -        <bool>true</bool>
> -       </property>
> -       <property name="text">
> -        <string>&amp;External database engine:</string>
> -       </property>
> -       <property name="buddy">
> -        <cstring>kcfg_DatabaseEngine</cstring>
> -       </property>
> -      </widget>
> -     </item>
> -    </layout>
> -   </item>
> -   <item>
> -    <widget class="QGroupBox" name="group_Connection">
> -     <property name="title">
> -      <string>Connection Settings</string>
> -     </property>
> -     <layout class="QVBoxLayout" name="verticalLayout_3">
> -      <item>
> -       <layout class="QGridLayout" name="gridLayout_3">
> -        <item row="0" column="0">
> -         <widget class="QLabel" name="label_Server">
> -          <property name="text">
> -           <string>&amp;Server:</string>
> -          </property>
> -          <property name="textFormat">
> -           <enum>Qt::AutoText</enum>
> -          </property>
> -          <property name="alignment">
> -           <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
> -          </property>
> -          <property name="buddy">
> -           <cstring>kcfg_Server</cstring>
> -          </property>
> -         </widget>
> -        </item>
> -        <item row="0" column="1" colspan="3">
> -         <widget class="QLineEdit" name="kcfg_Server">
> -          <property name="text">
> -           <string notr="true"/>
> -          </property>
> -         </widget>
> -        </item>
> -        <item row="0" column="4">
> -         <widget class="QLabel" name="label_Port">
> -          <property name="sizePolicy">
> -           <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
> -            <horstretch>0</horstretch>
> -            <verstretch>0</verstretch>
> -           </sizepolicy>
> -          </property>
> -          <property name="text">
> -           <string>P&amp;ort:</string>
> -          </property>
> -          <property name="textFormat">
> -           <enum>Qt::AutoText</enum>
> -          </property>
> -          <property name="alignment">
> -           <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
> -          </property>
> -          <property name="margin">
> -           <number>2</number>
> -          </property>
> -          <property name="buddy">
> -           <cstring>kcfg_Port</cstring>
> -          </property>
> -         </widget>
> -        </item>
> -        <item row="0" column="5">
> -         <widget class="QSpinBox" name="kcfg_Port">
> -          <property name="maximum">
> -           <number>65535</number>
> -          </property>
> -         </widget>
> -        </item>
> -        <item row="1" column="0">
> -         <widget class="QLabel" name="label_Username">
> -          <property name="text">
> -           <string>&amp;Username:</string>
> -          </property>
> -          <property name="textFormat">
> -           <enum>Qt::AutoText</enum>
> -          </property>
> -          <property name="alignment">
> -           <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
> -          </property>
> -          <property name="buddy">
> -           <cstring>kcfg_Username</cstring>
> -          </property>
> -         </widget>
> -        </item>
> -        <item row="2" column="1" colspan="5">
> -         <widget class="QLineEdit" name="kcfg_Password">
> -          <property name="inputMask">
> -           <string notr="true"/>
> -          </property>
> -          <property name="text">
> -           <string notr="true"/>
> -          </property>
> -          <property name="echoMode">
> -           <enum>QLineEdit::Password</enum>
> -          </property>
> -         </widget>
> -        </item>
> -        <item row="2" column="0">
> -         <widget class="QLabel" name="label_Password">
> -          <property name="text">
> -           <string>&amp;Password:</string>
> -          </property>
> -          <property name="textFormat">
> -           <enum>Qt::AutoText</enum>
> -          </property>
> -          <property name="alignment">
> -           <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
> -          </property>
> -          <property name="buddy">
> -           <cstring>kcfg_Password</cstring>
> -          </property>
> -         </widget>
> -        </item>
> -        <item row="1" column="1" colspan="5">
> -         <widget class="QLineEdit" name="kcfg_Username">
> -          <property name="text">
> -           <string notr="true"/>
> -          </property>
> -         </widget>
> -        </item>
> -        <item row="3" column="0">
> -         <widget class="QLabel" name="label_DBName">
> -          <property name="text">
> -           <string>&amp;Database:</string>
> -          </property>
> -          <property name="textFormat">
> -           <enum>Qt::AutoText</enum>
> -          </property>
> -          <property name="alignment">
> -           <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
> -          </property>
> -          <property name="buddy">
> -           <cstring>kcfg_DBName</cstring>
> -          </property>
> -         </widget>
> -        </item>
> -        <item row="3" column="1" colspan="5">
> -         <widget class="QLineEdit" name="kcfg_DBName">
> -          <property name="text">
> -           <string notr="true"/>
> -          </property>
> -         </widget>
> -        </item>
> -       </layout>
> -      </item>
> -      <item>
> -       <widget class="QFrame" name="frame_info">
> -        <property name="frameShape">
> -         <enum>QFrame::StyledPanel</enum>
> -        </property>
> -        <property name="frameShadow">
> -         <enum>QFrame::Raised</enum>
> -        </property>
> -        <layout class="QVBoxLayout" name="verticalLayout">
> -         <item>
> -          <widget class="QLabel" name="label_Info">
> -           <property name="font">
> -            <font>
> -             <pointsize>9</pointsize>
> -            </font>
> -           </property>
> -           <property name="text">
> -            <string>Amarok expects the above database and user account to already exist. This user also requires full access to the database.</string>
> -           </property>
> -           <property name="alignment">
> -            <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
> -           </property>
> -           <property name="wordWrap">
> -            <bool>true</bool>
> -           </property>
> -          </widget>
> -         </item>
> -         <item>
> -          <widget class="QLabel" name="label_SQL">
> -           <property name="font">
> -            <font>
> -             <pointsize>9</pointsize>
> -            </font>
> -           </property>
> -           <property name="text">
> -            <string>Access rights can be assigned with the following S&amp;QL commands (after replacing the password with the correct one):</string>
> -           </property>
> -           <property name="wordWrap">
> -            <bool>true</bool>
> -           </property>
> -           <property name="buddy">
> -            <cstring>text_SQL</cstring>
> -           </property>
> -          </widget>
> -         </item>
> -         <item>
> -          <widget class="QPlainTextEdit" name="text_SQL">
> -           <property name="sizePolicy">
> -            <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
> -             <horstretch>0</horstretch>
> -             <verstretch>0</verstretch>
> -            </sizepolicy>
> -           </property>
> -           <property name="maximumSize">
> -            <size>
> -             <width>16777215</width>
> -             <height>50</height>
> -            </size>
> -           </property>
> -           <property name="font">
> -            <font>
> -             <pointsize>9</pointsize>
> -            </font>
> -           </property>
> -           <property name="cursor" stdset="0">
> -            <cursorShape>ArrowCursor</cursorShape>
> -           </property>
> -           <property name="acceptDrops">
> -            <bool>false</bool>
> -           </property>
> -           <property name="readOnly">
> -            <bool>true</bool>
> -           </property>
> -           <property name="plainText">
> -            <string notr="true"/>
> -           </property>
> -          </widget>
> -         </item>
> -        </layout>
> -       </widget>
> -      </item>
> -     </layout>
> -    </widget>
> -   </item>
> -   <item>
> -    <spacer name="verticalSpacer">
> -     <property name="orientation">
> -      <enum>Qt::Vertical</enum>
> -     </property>
> -     <property name="sizeHint" stdset="0">
> -      <size>
> -       <width>20</width>
> -       <height>40</height>
> -      </size>
> -     </property>
> -    </spacer>
> -   </item>
> -  </layout>
> - </widget>
> - <resources/>
> - <connections/>
> -</ui>
>
>
>



-- 
Seb Ruiz

http://www.sebruiz.net/
http://amarok.kde.org/


More information about the Amarok-devel mailing list