From kde-commits Mon May 19 11:13:34 2008 From: =?utf-8?q?Dennis=20Nienh=C3=BCser?= Date: Mon, 19 May 2008 11:13:34 +0000 To: kde-commits Subject: KDE/kdenetwork/kopete/kopete/config/chatwindow Message-Id: <1211195614.468472.25901.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=121119562520454 SVN commit 809740 by nienhueser: Merge branch 'simplify_emoticon_configuration' M +9 -86 chatwindowconfig.cpp M +1 -5 chatwindowconfig.h M +14 -123 chatwindowconfig_emoticons.ui --- trunk/KDE/kdenetwork/kopete/kopete/config/chatwindow/chatwindowconfig.cpp #809739:809740 @@ -50,6 +50,7 @@ #include #include #include +#include // KNewStuff #include @@ -207,14 +208,10 @@ addConfig( Kopete::AppearanceSettings::self(), emoticonsWidget ); connect(m_emoticonsUi.icon_theme_list, SIGNAL(itemSelectionChanged()), - this, SLOT(slotSelectedEmoticonsThemeChanged())); - connect(m_emoticonsUi.btnInstallTheme, SIGNAL(clicked()), - this, SLOT(slotInstallEmoticonTheme())); + this, SLOT(emitChanged())); - connect(m_emoticonsUi.btnGetThemes, SIGNAL(clicked()), - this, SLOT(slotGetEmoticonThemes())); - connect(m_emoticonsUi.btnRemoveTheme, SIGNAL(clicked()), - this, SLOT(slotRemoveEmoticonTheme())); + connect(m_emoticonsUi.btnManageThemes, SIGNAL(clicked()), + this, SLOT(slotManageEmoticonThemes())); //--------- colors tab -------------------------- QWidget *colorsWidget = new QWidget(m_tab); @@ -626,16 +623,6 @@ emitChanged(); } -void ChatWindowConfig::slotUpdateEmoticonsButton(bool _b) -{ - QListWidgetItem *item = m_emoticonsUi.icon_theme_list->currentItem(); - if (!item) - return; - QString themeName = item->text(); - QFileInfo fileInf(KGlobal::dirs()->findResource("emoticons", themeName+'/')); - m_emoticonsUi.btnRemoveTheme->setEnabled( _b && fileInf.isWritable()); - m_emoticonsUi.btnGetThemes->setEnabled( false ); -} void ChatWindowConfig::updateEmoticonList() { @@ -674,81 +661,17 @@ m_emoticonsUi.icon_theme_list->setCurrentItem( 0 ); } -void ChatWindowConfig::slotSelectedEmoticonsThemeChanged() -{ - QListWidgetItem *item = m_emoticonsUi.icon_theme_list->currentItem(); - if (!item) - return; - QString themeName = item->text(); - QFileInfo fileInf(KGlobal::dirs()->findResource("emoticons", themeName+'/')); - m_emoticonsUi.btnRemoveTheme->setEnabled( fileInf.isWritable() ); - emitChanged(); -} - -void ChatWindowConfig::slotInstallEmoticonTheme() +void ChatWindowConfig::slotManageEmoticonThemes() { - KUrl themeURL = KUrlRequesterDialog::getUrl(QString::null, this, //krazy:exclude=nullstrassign for old broken gcc - i18n("Drag or Type Emoticon Theme URL")); - if ( themeURL.isEmpty() ) - return; - - //TODO: support remote theme files! - if ( !themeURL.isLocalFile() ) - { - KMessageBox::queuedMessageBox( this, KMessageBox::Error, i18n("Sorry, emoticon themes must be installed from local files."), - i18n("Could Not Install Emoticon Theme") ); - return; - } - - Kopete::Emoticons::self()->installTheme( themeURL.path() ); + KCMultiDialog *kcm = new KCMultiDialog( this ); + kcm->setCaption( i18n( "Configure Emoticon Themes" ) ); + kcm->addModule( "emoticons" ); + kcm->exec(); updateEmoticonList(); } -void ChatWindowConfig::slotRemoveEmoticonTheme() -{ - QListWidgetItem *selected = m_emoticonsUi.icon_theme_list->currentItem(); - if(!selected) - return; - QString themeName = selected->text(); - - QString question=i18nc("@info", "Are you sure you want to remove the " - "%1 emoticon theme?
" - "
" - "This will delete all files installed by this theme.", - themeName); - - int res = KMessageBox::warningContinueCancel(this, question, i18n("Confirmation"),KStandardGuiItem::del()); - if (res!=KMessageBox::Continue) - return; - - KUrl themeUrl(KGlobal::dirs()->findResource("emoticons", themeName+'/')); - KIO::NetAccess::del(themeUrl, this); - - updateEmoticonList(); -} - -void ChatWindowConfig::slotGetEmoticonThemes() -{ -#ifdef __GNUC__ -#warning "Port KNS changes!" -#endif -#if 0 - KConfigGroup config(KGlobal::config(), "KNewStuff"); - config.writeEntry( "ProvidersUrl", - "http://download.kde.org/khotnewstuff/emoticons-providers.xml" ); - config.writeEntry( "StandardResource", "emoticons" ); - config.writeEntry( "Uncompress", "application/x-gzip" ); - config.sync(); - - KNS::DownloadDialog::open( "emoticons", i18n( "Get New Emoticons") ); - - updateEmoticonList(); -#endif -} - - void ChatWindowConfig::emitChanged() { emit changed( true ); --- trunk/KDE/kdenetwork/kopete/kopete/config/chatwindow/chatwindowconfig.h #809739:809740 @@ -61,11 +61,7 @@ void slotLoadChatStyles(); void slotUpdateChatPreview(); //----- Emoticons TAB --------------------- - void slotSelectedEmoticonsThemeChanged(); - void slotInstallEmoticonTheme(); - void slotRemoveEmoticonTheme(); - void slotGetEmoticonThemes(); - void slotUpdateEmoticonsButton(bool); + void slotManageEmoticonThemes(); private: //----- Style TAB --------------------- --- trunk/KDE/kdenetwork/kopete/kopete/config/chatwindow/chatwindowconfig_emoticons.ui #809739:809740 @@ -5,12 +5,12 @@ 0 0 - 481 - 353 + 535 + 333 - + @@ -22,98 +22,37 @@ If this is checked, the text representation of emoticons in messages will be replaced by an image - U&se emoticons + U&se the following emoticon theme: true - - - - - 0 - 0 - - - - Qt::NoFocus - - - Select emoticon theme: - - - - + true - - - - false - + + 0 0 - - Download emoticon theme from the Internet - - &Get New Themes... + &Manage emoticons... - - - - - 0 - 0 - - - - &Install Theme File... - - - - - - - - 0 - 0 - - - - Remove &Theme - - - - - - - Qt::Horizontal - - - QSizePolicy::Preferred - - - - 31 - 20 - - - - + kcfg_useEmoticons + icon_theme_list + btnManageThemes qPixmapFromMimeSource @@ -122,7 +61,7 @@ kcfg_useEmoticons toggled(bool) - textLabel1 + icon_theme_list setEnabled(bool) @@ -130,58 +69,10 @@ 20 - 20 - 20 + 267 + 160 - - kcfg_useEmoticons - toggled(bool) - btnGetThemes - setEnabled(bool) - - - 20 - 20 - - - 20 - 20 - - - - - kcfg_useEmoticons - toggled(bool) - btnInstallTheme - setEnabled(bool) - - - 20 - 20 - - - 20 - 20 - - - - - kcfg_useEmoticons - toggled(bool) - btnRemoveTheme - setEnabled(bool) - - - 20 - 20 - - - 20 - 20 - - -