summaryrefslogtreecommitdiffstats
path: root/kcm_gtk
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-12-22 18:14:55 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-12-22 18:14:55 -0600
commita90aa09722d47f5f4009b089d8d874354899bdb8 (patch)
tree42b89b909552fb57ae2bb5ff39a5d715bdadee26 /kcm_gtk
parent6e6dbb068e03a8bb818a76ba774d6f94ade7389f (diff)
downloadgtk-qt-engine-a90aa09722d47f5f4009b089d8d874354899bdb8.tar.gz
gtk-qt-engine-a90aa09722d47f5f4009b089d8d874354899bdb8.zip
Fix Firefox scrollbars
Diffstat (limited to 'kcm_gtk')
-rw-r--r--kcm_gtk/kcmgtk.cpp186
-rw-r--r--kcm_gtk/kcmgtk.h9
-rw-r--r--kcm_gtk/kcmgtkwidget.ui113
3 files changed, 2 insertions, 306 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)
diff --git a/kcm_gtk/kcmgtk.h b/kcm_gtk/kcmgtk.h
index 542a043..2c04919 100644
--- a/kcm_gtk/kcmgtk.h
+++ b/kcm_gtk/kcmgtk.h
@@ -74,7 +74,6 @@ public slots:
void styleChanged();
void fontChangeClicked();
void itemChanged();
- void firefoxFixClicked();
void emacsDetailsClicked();
void searchPathsClicked();
void searchPathsOk();
@@ -85,14 +84,10 @@ public slots:
private:
void updateFontPreview();
- void getProfiles(const TQString& basePath, int type);
- void fixProfile(const TQString& path);
- TQString scrollBarCSS();
- void writeFirefoxCSS(const TQString& path, const TQString& data);
void getInstalledThemes();
-
+
TQString env(TQString key);
-
+
KcmGtkWidget* widget;
TQMap<TQString,TQString> themes;
TQMap<TQString,TQString> gtk3Themes;
diff --git a/kcm_gtk/kcmgtkwidget.ui b/kcm_gtk/kcmgtkwidget.ui
index 512a610..705655b 100644
--- a/kcm_gtk/kcmgtkwidget.ui
+++ b/kcm_gtk/kcmgtkwidget.ui
@@ -653,118 +653,6 @@
</widget>
</hbox>
</widget>
- <widget class="TQGroupBox">
- <property name="name">
- <cstring>groupBox1</cstring>
- </property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>5</hsizetype>
- <vsizetype>4</vsizetype>
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="title">
- <string>Firefox and Thunderbird</string>
- </property>
- <hbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="TQLayoutWidget">
- <property name="name">
- <cstring>layout7_2_2</cstring>
- </property>
- <vbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="TQLabel">
- <property name="name">
- <cstring>firefoxIcon</cstring>
- </property>
- <property name="scaledContents">
- <bool>true</bool>
- </property>
- </widget>
- <spacer>
- <property name="name">
- <cstring>spacer3_2_2</cstring>
- </property>
- <property name="orientation">
- <enum>Vertical</enum>
- </property>
- <property name="sizeType">
- <enum>Expanding</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>20</width>
- <height>31</height>
- </size>
- </property>
- </spacer>
- </vbox>
- </widget>
- <widget class="TQLayoutWidget">
- <property name="name">
- <cstring>layout12</cstring>
- </property>
- <vbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="TQLabel">
- <property name="name">
- <cstring>textLabel1</cstring>
- </property>
- <property name="text">
- <string>Scrollbar buttons may sometimes be displayed incorrectly in Firefox and Thunderbird. This can be fixed by installing some files into your Mozilla profile.</string>
- </property>
- <property name="alignment">
- <set>WordBreak|AlignVCenter</set>
- </property>
- </widget>
- <widget class="TQLayoutWidget">
- <property name="name">
- <cstring>layout11</cstring>
- </property>
- <hbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="TQPushButton">
- <property name="name">
- <cstring>firefoxFix</cstring>
- </property>
- <property name="text">
- <string>I&amp;nstall scrollbar fix...</string>
- </property>
- </widget>
- <spacer>
- <property name="name">
- <cstring>spacer11</cstring>
- </property>
- <property name="orientation">
- <enum>Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>Expanding</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>101</width>
- <height>21</height>
- </size>
- </property>
- </spacer>
- </hbox>
- </widget>
- </vbox>
- </widget>
- </hbox>
- </widget>
<widget class="TQLabel">
<property name="name">
<cstring>textLabel1_2</cstring>
@@ -811,7 +699,6 @@
<tabstop>fontChange</tabstop>
<tabstop>emacsBox</tabstop>
<tabstop>emacsDetails</tabstop>
- <tabstop>firefoxFix</tabstop>
</tabstops>
<layoutdefaults spacing="6" margin="11"/>
<includehints>