summaryrefslogtreecommitdiffstats
path: root/kcm_gtk/kcmgtk.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <[email protected]>2013-12-22 18:14:55 -0600
committerTimothy Pearson <[email protected]>2013-12-22 18:14:55 -0600
commita90aa09722d47f5f4009b089d8d874354899bdb8 (patch)
tree42b89b909552fb57ae2bb5ff39a5d715bdadee26 /kcm_gtk/kcmgtk.cpp
parent6e6dbb068e03a8bb818a76ba774d6f94ade7389f (diff)
downloadgtk-qt-engine-a90aa09722d47f5f4009b089d8d874354899bdb8.tar.gz
gtk-qt-engine-a90aa09722d47f5f4009b089d8d874354899bdb8.zip
Fix Firefox scrollbars
Diffstat (limited to 'kcm_gtk/kcmgtk.cpp')
-rw-r--r--kcm_gtk/kcmgtk.cpp186
1 files changed, 0 insertions, 186 deletions
diff --git a/kcm_gtk/kcmgtk.cpp b/kcm_gtk/kcmgtk.cpp
index 28faded..ccd18c1 100644
--- a/kcm_gtk/kcmgtk.cpp
+++ b/kcm_gtk/kcmgtk.cpp
@@ -188,7 +188,6 @@ KcmGtk::KcmGtk(TQWidget *parent, const char *name, const TQStringList&)
widget->styleIcon->setPixmap(iconLoader.loadIcon("style", TDEIcon::Desktop));
widget->styleIcon3->setPixmap(iconLoader.loadIcon("style", TDEIcon::Desktop));
widget->fontIcon->setPixmap(iconLoader.loadIcon("fonts", TDEIcon::Desktop));
- widget->firefoxIcon->setPixmap(iconLoader.loadIcon("firefox", TDEIcon::Desktop));
widget->keyboardIcon->setPixmap(iconLoader.loadIcon("keyboard", TDEIcon::Desktop));
getInstalledThemes();
@@ -206,7 +205,6 @@ KcmGtk::KcmGtk(TQWidget *parent, const char *name, const TQStringList&)
connect(widget->styleBox3, TQT_SIGNAL(activated(int)), TQT_SLOT(styleChanged()));
connect(widget->emacsBox, TQT_SIGNAL(toggled(bool)), TQT_SLOT(itemChanged()));
connect(widget->fontChange, TQT_SIGNAL(clicked()), TQT_SLOT(fontChangeClicked()));
- connect(widget->firefoxFix, TQT_SIGNAL(clicked()), TQT_SLOT(firefoxFixClicked()));
connect(widget->emacsDetails, TQT_SIGNAL(clicked()), TQT_SLOT(emacsDetailsClicked()));
connect(widget->warning3, TQT_SIGNAL(clicked()), TQT_SLOT(searchPathsClicked()));
connect(widget->warning6, TQT_SIGNAL(clicked()), TQT_SLOT(searchPathsClicked()));
@@ -557,190 +555,6 @@ TQString KcmGtk::quickHelp() const
return i18n("");
}
-
-void KcmGtk::firefoxFixClicked()
-{
- profiles.clear();
- getProfiles(TQDir::homeDirPath() + "/.mozilla/firefox/", 0);
- getProfiles(TQDir::homeDirPath() + "/.thunderbird/", 1);
-
- TQString profilePath;
- if (profiles.count() == 0)
- {
- KMessageBox::error(this, i18n("No Mozilla profiles found"), i18n("Could not load Mozilla profiles"));
- return;
- }
- else if (profiles.count() == 1)
- {
- fixProfile(profiles.begin().data());
- }
- else
- {
- KDialogBase* dialog = new KDialogBase(this, "", true, i18n("Mozilla profile"), KDialogBase::Ok | KDialogBase::Cancel);
- MozillaProfileWidget* w = new MozillaProfileWidget(dialog);
- w->profilesList->header()->hide();
- w->profilesList->hideColumn(1);
-
- TQPixmap icon = TDEGlobal::iconLoader()->loadIcon("kuser", TDEIcon::Small);
-
- for ( TQMapIterator<TQString,TQString> it = profiles.begin(); it != profiles.end(); ++it )
- {
- TDEListViewItem* i = new TDEListViewItem(w->profilesList);
- i->setPixmap(0, icon);
- i->setText(0, it.key());
- i->setText(1, it.data());
- }
-
- dialog->setMainWidget(w);
- if (dialog->exec() == TQDialog::Rejected)
- {
- delete dialog;
- return;
- }
-
- TQListViewItemIterator it2(w->profilesList, TQListViewItemIterator::Selected);
- while (it2.current())
- {
- TDEListViewItem* i = (TDEListViewItem*) it2.current();
- ++it2;
-
- fixProfile(i->text(1));
- }
- delete dialog;
- }
-
- KMessageBox::information(this, i18n("Your Mozilla profile was updated sucessfully. You must close and restart all Firefox and Thunderbird windows for the changes to take effect"), i18n("Mozilla profile"));
-}
-
-void KcmGtk::getProfiles(const TQString& basePath, int type)
-{
- TQString fileName = basePath + "/profiles.ini";
- if (TQFile::exists(fileName))
- {
- TDEConfig config(fileName, true, false);
- TQStringList groups = config.groupList();
-
- for ( TQStringList::Iterator it = groups.begin(); it != groups.end(); ++it )
- {
- if (!(*it).lower().startsWith("profile"))
- continue;
-
- config.setGroup(*it);
- TQString name = (type ? i18n("Thunderbird") : i18n("Firefox")) + " - " + config.readEntry("Name");
- TQString path = config.readEntry("Path");
- if (!path.startsWith("/"))
- path = basePath + path;
- profiles.insert(name, path);
- }
- }
-}
-
-void KcmGtk::fixProfile(const TQString& path)
-{
- if (!TQFile::exists(path + "/chrome"))
- {
- TQDir dir(path);
- dir.mkdir("chrome");
- }
-
- TQString data = scrollBarCSS();
- writeFirefoxCSS(path + "/chrome/userChrome.css", data);
- writeFirefoxCSS(path + "/chrome/userContent.css", data);
-}
-
-TQString KcmGtk::scrollBarCSS()
-{
- // The following code determines how many buttons are on a scrollbar
- // It works by looking at each pixel of the scrollbar's area not taken up by the groove,
- // and asking the style which subcontrol is at that location.
- TQScrollBar sbar(NULL);
- sbar.setOrientation(Qt::Horizontal);
- sbar.setValue(1);
- sbar.resize(200,25);
-
- TQRect rect = tqApp->style().querySubControlMetrics(TQStyle::CC_ScrollBar, &sbar, TQStyle::SC_ScrollBarGroove);
-
- bool back1 = false;
- bool forward1 = false;
- bool back2 = false;
- bool forward2 = false;
-
- TQStyle::SubControl sc = TQStyle::SC_None;
- for (TQPoint pos(0,7) ; pos.x()<rect.x() ; pos.setX(pos.x()+1))
- {
- TQStyle::SubControl sc2 = tqApp->style().querySubControl(TQStyle::CC_ScrollBar, &sbar, pos);
- if (sc != sc2)
- {
- if (sc2 == TQStyle::SC_ScrollBarAddLine) forward1 = true;
- if (sc2 == TQStyle::SC_ScrollBarSubLine) back1 = true;
- sc = sc2;
- }
- }
- sc = TQStyle::SC_None;
- for (TQPoint pos(rect.x()+rect.width(),7) ; pos.x()<200 ; pos.setX(pos.x()+1))
- {
- TQStyle::SubControl sc2 = tqApp->style().querySubControl(TQStyle::CC_ScrollBar, &sbar, pos);
- if (sc != sc2)
- {
- if (sc2 == TQStyle::SC_ScrollBarAddLine) forward2 = true;
- if (sc2 == TQStyle::SC_ScrollBarSubLine) back2 = true;
- sc = sc2;
- }
- }
-
- TQString upTop = (back1 ? "-moz-box" : "none");
- TQString downTop = (forward1 ? "-moz-box" : "none");
- TQString upBottom = (back2 ? "-moz-box" : "none");
- TQString downBottom = (forward2 ? "-moz-box" : "none");
-
- TQString data;
- data += "/* The following four lines were added by TDE */\n";
- data += "scrollbarbutton[sbattr=\"scrollbar-up-top\"] { display: " + upTop + " !important; }\n";
- data += "scrollbarbutton[sbattr=\"scrollbar-down-top\"] { display: " + downTop + " !important; }\n";
- data += "scrollbarbutton[sbattr=\"scrollbar-up-bottom\"] { display: " + upBottom + " !important; }\n";
- data += "scrollbarbutton[sbattr=\"scrollbar-down-bottom\"] { display: " + downBottom + " !important; }\n";
-
- return data;
-}
-
-void KcmGtk::writeFirefoxCSS(const TQString& path, const TQString& data)
-{
- TQString fileData;
- TQFile file(path);
- if (file.open(IO_ReadOnly))
- {
- TQTextStream stream(&file);
- for (;;)
- {
- TQString line = stream.readLine();
- if (line.isNull())
- break;
-
- if ((line == "# The following four lines were added by TDE") ||
- (line == "/* The following four lines were added by TDE */"))
- {
- for (int i=0 ; i<4 ; i++)
- stream.readLine();
- continue;
- }
-
- fileData += line + "\n";
- }
- file.close();
- }
-
- if (!file.open(IO_WriteOnly | IO_Truncate))
- {
- KMessageBox::error(this, i18n("Could not write to %1").arg(path), i18n("Mozilla profile"));
- return;
- }
- TQTextStream stream(&file);
- stream << fileData << data;
- file.close();
-
- return;
-}
-
void KcmGtk::emacsDetailsClicked()
{
if (emacsDetailsDialog == NULL)