summaryrefslogtreecommitdiffstats
path: root/konq-plugins/sidebar/metabar/src/metabarwidget.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:22:56 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:22:56 +0000
commit7346aee26bf190a7e70333c40fab4caca847cd27 (patch)
tree4b019b434f88dcc3eeaafe1d3f26240b4c4718e8 /konq-plugins/sidebar/metabar/src/metabarwidget.cpp
parent23a3d3aa5b44cbdf305495919866d9dbf4f6da54 (diff)
downloadtdeaddons-7346aee26bf190a7e70333c40fab4caca847cd27.tar.gz
tdeaddons-7346aee26bf190a7e70333c40fab4caca847cd27.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeaddons@1157634 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'konq-plugins/sidebar/metabar/src/metabarwidget.cpp')
-rw-r--r--konq-plugins/sidebar/metabar/src/metabarwidget.cpp128
1 files changed, 64 insertions, 64 deletions
diff --git a/konq-plugins/sidebar/metabar/src/metabarwidget.cpp b/konq-plugins/sidebar/metabar/src/metabarwidget.cpp
index 07b010a..bf074e8 100644
--- a/konq-plugins/sidebar/metabar/src/metabarwidget.cpp
+++ b/konq-plugins/sidebar/metabar/src/metabarwidget.cpp
@@ -26,14 +26,14 @@
#include "remoteplugin.h"
#include "httpplugin.h"
-#include <qwidget.h>
-#include <qlayout.h>
-#include <qdir.h>
-#include <qfile.h>
-#include <qtextstream.h>
-#include <qvaluelist.h>
-#include <qurl.h>
-#include <qbuffer.h>
+#include <tqwidget.h>
+#include <tqlayout.h>
+#include <tqdir.h>
+#include <tqfile.h>
+#include <tqtextstream.h>
+#include <tqvaluelist.h>
+#include <tqurl.h>
+#include <tqbuffer.h>
#include <khtmlview.h>
#include <kapplication.h>
@@ -73,7 +73,7 @@
#define EVENT_TYPE DOM::DOMString("click")
#define ACTIVATION 1
-MetabarWidget::MetabarWidget(QWidget *parent, const char *name) : QWidget(parent, name)
+MetabarWidget::MetabarWidget(TQWidget *parent, const char *name) : TQWidget(parent, name)
{
skip = false;
loadComplete = false;
@@ -84,9 +84,9 @@ MetabarWidget::MetabarWidget(QWidget *parent, const char *name) : QWidget(parent
config = new KConfig("metabarrc");
dir_watch = new KDirWatch();
- connect(dir_watch, SIGNAL(dirty(const QString&)), this, SLOT(slotUpdateCurrentInfo(const QString&)));
- connect(dir_watch, SIGNAL(created(const QString&)), this, SLOT(slotUpdateCurrentInfo(const QString&)));
- connect(dir_watch, SIGNAL(deleted(const QString&)), this, SLOT(slotDeleteCurrentInfo(const QString&)));
+ connect(dir_watch, TQT_SIGNAL(dirty(const TQString&)), this, TQT_SLOT(slotUpdateCurrentInfo(const TQString&)));
+ connect(dir_watch, TQT_SIGNAL(created(const TQString&)), this, TQT_SLOT(slotUpdateCurrentInfo(const TQString&)));
+ connect(dir_watch, TQT_SIGNAL(deleted(const TQString&)), this, TQT_SLOT(slotDeleteCurrentInfo(const TQString&)));
html = new KHTMLPart(this, "metabarhtmlpart");
html->setJScriptEnabled(true);
@@ -94,12 +94,12 @@ MetabarWidget::MetabarWidget(QWidget *parent, const char *name) : QWidget(parent
html->setCaretVisible(false);
html->setDNDEnabled(false);
html->setJavaEnabled(false);
- html->view()->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+ html->view()->setSizePolicy(TQSizePolicy::Expanding, TQSizePolicy::Expanding);
html->view()->hide();
- connect(html->browserExtension(), SIGNAL(openURLRequest( const KURL &, const KParts::URLArgs & )), this, SLOT(handleURLRequest(const KURL &, const KParts::URLArgs &)));
- connect(html, SIGNAL(completed()), this, SLOT(loadCompleted()));
- connect(html, SIGNAL(popupMenu(const QString &, const QPoint &)), this, SLOT(slotShowPopup(const QString&, const QPoint &)));
+ connect(html->browserExtension(), TQT_SIGNAL(openURLRequest( const KURL &, const KParts::URLArgs & )), this, TQT_SLOT(handleURLRequest(const KURL &, const KParts::URLArgs &)));
+ connect(html, TQT_SIGNAL(completed()), this, TQT_SLOT(loadCompleted()));
+ connect(html, TQT_SIGNAL(popupMenu(const TQString &, const TQPoint &)), this, TQT_SLOT(slotShowPopup(const TQString&, const TQPoint &)));
functions = new MetabarFunctions(html, this);
@@ -114,14 +114,14 @@ MetabarWidget::MetabarWidget(QWidget *parent, const char *name) : QWidget(parent
plugins.insert("http", httpPlugin);
plugins.insert("https", httpPlugin);
- QVBoxLayout *layout = new QVBoxLayout(this);
+ TQVBoxLayout *layout = new TQVBoxLayout(this);
layout->addWidget(html->view());
popup = new KPopupMenu(0);
- KAction *configAction = new KAction(i18n("Configure %1...").arg("Metabar"), "configure", KShortcut(), this, SLOT(slotShowConfig()), html->actionCollection(), "configure");
+ KAction *configAction = new KAction(i18n("Configure %1...").arg("Metabar"), "configure", KShortcut(), this, TQT_SLOT(slotShowConfig()), html->actionCollection(), "configure");
configAction->plug(popup);
- KAction *reloadAction = new KAction(i18n("Reload Theme"), "reload", KShortcut(), this, SLOT(setTheme()), html->actionCollection(), "reload");
+ KAction *reloadAction = new KAction(i18n("Reload Theme"), "reload", KShortcut(), this, TQT_SLOT(setTheme()), html->actionCollection(), "reload");
reloadAction->plug(popup);
setTheme();
@@ -197,7 +197,7 @@ void MetabarWidget::setFileItems(const KFileItemList &items, bool check)
currentPlugin->deactivate();
}
- QString protocol = currentItems->getFirst()->url().protocol();
+ TQString protocol = currentItems->getFirst()->url().protocol();
currentPlugin = plugins[protocol];
if(!currentPlugin){
@@ -208,14 +208,14 @@ void MetabarWidget::setFileItems(const KFileItemList &items, bool check)
currentPlugin->setFileItems(*currentItems);
}
-QString MetabarWidget::getCurrentURL()
+TQString MetabarWidget::getCurrentURL()
{
DCOPRef ref(kapp->dcopClient()->appId(), this->topLevelWidget()->name());
DCOPReply reply = ref.call("currentURL()");
if (reply.isValid()) {
- QString url;
- reply.get(url, "QString");
+ TQString url;
+ reply.get(url, "TQString");
if(!url.isNull() && !url.isEmpty()){
return url;
@@ -224,21 +224,21 @@ QString MetabarWidget::getCurrentURL()
return 0;
}
-void MetabarWidget::openURL(const QString &url)
+void MetabarWidget::openURL(const TQString &url)
{
DCOPRef ref(kapp->dcopClient()->appId(), this->topLevelWidget()->name());
DCOPReply reply = ref.call("openURL", url);
}
-void MetabarWidget::openTab(const QString &url)
+void MetabarWidget::openTab(const TQString &url)
{
DCOPRef ref(kapp->dcopClient()->appId(), this->topLevelWidget()->name());
DCOPReply reply = ref.call("newTab", url);
}
-void MetabarWidget::callAction(const QString &action)
+void MetabarWidget::callAction(const TQString &action)
{
- DCOPRef ref(kapp->dcopClient()->appId(), QString(this->topLevelWidget()->name()).append("/action/").append(action).utf8());
+ DCOPRef ref(kapp->dcopClient()->appId(), TQString(this->topLevelWidget()->name()).append("/action/").append(action).utf8());
if(ref.call("enabled()")){
ref.call("activate()");
}
@@ -247,7 +247,7 @@ void MetabarWidget::callAction(const QString &action)
void MetabarWidget::loadLinks()
{
config->setGroup("General");
- QStringList links = config->readListEntry("Links");
+ TQStringList links = config->readListEntry("Links");
if(links.count() == 0){
functions->hide("links");
@@ -261,7 +261,7 @@ void MetabarWidget::loadLinks()
if(!node.isNull()){
DOM::DOMString innerHTML;
- for(QStringList::Iterator it = links.begin(); it != links.end(); ++it){
+ for(TQStringList::Iterator it = links.begin(); it != links.end(); ++it){
config->setGroup("Link_" + (*it));
addEntry(innerHTML, config->readEntry("Name"), config->readEntry("URL"), config->readEntry("Icon", "folder"));
}
@@ -282,14 +282,14 @@ void MetabarWidget::loadCompleted()
DOM::HTMLElement node = static_cast<DOM::HTMLElement>(i18n_a_list.item(i));
if(!node.isNull()){
if(node.hasAttribute("i18n")){
- QString text = node.innerText().string();
+ TQString text = node.innerText().string();
node.setInnerText(DOM::DOMString(i18n(text.utf8().data())));
}
if(node.hasAttribute("image")){
- QString icon = node.getAttribute("image").string();
- QString url = getIconPath(icon);
- QString style = QString("background-image: url(%1);").arg(url);
+ TQString icon = node.getAttribute("image").string();
+ TQString url = getIconPath(icon);
+ TQString style = TQString("background-image: url(%1);").arg(url);
node.setAttribute("style", style);
}
@@ -301,22 +301,22 @@ void MetabarWidget::loadCompleted()
DOM::HTMLElement node = static_cast<DOM::HTMLElement>(i18n_ul_list.item(i));
if(!node.isNull()){
if(node.hasAttribute("i18n")){
- QString text = node.innerText().string();
+ TQString text = node.innerText().string();
node.setInnerText(DOM::DOMString(i18n(text.utf8().data())));
}
}
}
config->setGroup("General");
- QString file = locate("data", QString("metabar/themes/%1/default.css").arg(config->readEntry("Theme", "default")));
+ TQString file = locate("data", TQString("metabar/themes/%1/default.css").arg(config->readEntry("Theme", "default")));
if(file.isNull()){
- file = locate("data", QString("metabar/themes/default/default.css"));
+ file = locate("data", TQString("metabar/themes/default/default.css"));
}
- QFile cssfile(file);
+ TQFile cssfile(file);
if(cssfile.open(IO_ReadOnly)){
- QTextStream stream( &cssfile );
- QString tmp = stream.read();
+ TQTextStream stream( &cssfile );
+ TQString tmp = stream.read();
cssfile.close();
tmp.replace("./", KURL::fromPathOrURL(file).directory(false));
@@ -324,14 +324,14 @@ void MetabarWidget::loadCompleted()
}
loadComplete = true;
- html->view()->setFrameShape(config->readBoolEntry("ShowFrame", true) ? QFrame::StyledPanel : QFrame::NoFrame);
+ html->view()->setFrameShape(config->readBoolEntry("ShowFrame", true) ? TQFrame::StyledPanel : TQFrame::NoFrame);
html->view()->show();
if(currentItems && !currentItems->isEmpty()){
setFileItems(*currentItems, false);
}
else{
- QString url = getCurrentURL();
+ TQString url = getCurrentURL();
KFileItem *item = new KFileItem(KFileItem::Unknown, KFileItem::Unknown, KURL(url), true);
KFileItemList list;
list.append(item);
@@ -347,14 +347,14 @@ void MetabarWidget::handleURLRequest(const KURL &url, const KParts::URLArgs &arg
return;
}
- QString protocol = url.protocol();
+ TQString protocol = url.protocol();
if(currentPlugin->handleRequest(url)){
return;
}
if(protocol == "desktop"){
- QString path = url.path();
+ TQString path = url.path();
if(KDesktopFile::isDesktopFile(path)){
KRun::run(new KDesktopFile(path, true), KURL::List());
@@ -362,15 +362,15 @@ void MetabarWidget::handleURLRequest(const KURL &url, const KParts::URLArgs &arg
}
else if(protocol == "kcmshell"){
- QString module = url.path().remove('/');
+ TQString module = url.path().remove('/');
KRun::runCommand("kcmshell " + module);
}
else if(protocol == "action"){
- QString action = url.url().right(url.url().length() - 9);
+ TQString action = url.url().right(url.url().length() - 9);
if(action.startsWith("metabar/")){
- QString newact = action.right(action.length() - 8);
+ TQString newact = action.right(action.length() - 8);
if(newact == "share"){
slotShowSharingDialog();
@@ -393,15 +393,15 @@ void MetabarWidget::handleURLRequest(const KURL &url, const KParts::URLArgs &arg
skip = true; //needed to prevent some weired reload
DOM::DOMString innerHTML;
- innerHTML += QString("<ul style=\"width: %1px; height: %1px\">").arg(image.width(), image.height());
+ innerHTML += TQString("<ul style=\"width: %1px; height: %1px\">").arg(image.width(), image.height());
innerHTML += "<object class=\"preview\" type=\"";
innerHTML += item->mimetype();
innerHTML += "\" data=\"";
innerHTML += item->url().url();
innerHTML += "\" width=\"";
- innerHTML += QString().setNum(image.width());
+ innerHTML += TQString().setNum(image.width());
innerHTML += "\" height=\"";
- innerHTML += QString().setNum(image.height());
+ innerHTML += TQString().setNum(image.height());
innerHTML += "\" /></ul>";
node.setInnerHTML(innerHTML);
}
@@ -409,7 +409,7 @@ void MetabarWidget::handleURLRequest(const KURL &url, const KParts::URLArgs &arg
}
else if(protocol == "more"){
- QString name = url.host();
+ TQString name = url.host();
DOM::HTMLDocument doc = html->htmlDocument();
DOM::NodeList list = doc.getElementsByName(name);
@@ -431,7 +431,7 @@ void MetabarWidget::handleURLRequest(const KURL &url, const KParts::URLArgs &arg
}
if(element.id().string().startsWith("hidden")){
- QString style = QString("background-image: url(%1);").arg(getIconPath(showMore ? "1downarrow" : "1uparrow"));
+ TQString style = TQString("background-image: url(%1);").arg(getIconPath(showMore ? "1downarrow" : "1uparrow"));
element.setInnerText( showMore ? i18n("More") : i18n("Less") );
element.setAttribute("style", style);
}
@@ -466,16 +466,16 @@ void MetabarWidget::handleURLRequest(const KURL &url, const KParts::URLArgs &arg
}
}
-QString MetabarWidget::getIconPath(const QString &name)
+TQString MetabarWidget::getIconPath(const TQString &name)
{
- QPixmap icon = SmallIcon(name);
+ TQPixmap icon = SmallIcon(name);
- QByteArray data;
- QBuffer buffer(data);
+ TQByteArray data;
+ TQBuffer buffer(data);
buffer.open(IO_WriteOnly);
icon.save(&buffer, "PNG");
- return QString::fromLatin1("data:image/png;base64,%1").arg(KCodecs::base64Encode(data));
+ return TQString::fromLatin1("data:image/png;base64,%1").arg(KCodecs::base64Encode(data));
}
void MetabarWidget::slotShowSharingDialog()
@@ -489,7 +489,7 @@ void MetabarWidget::slotShowSharingDialog()
void MetabarWidget::slotShowConfig()
{
ConfigDialog *config_dialog = new ConfigDialog(this);
- if(config_dialog->exec() == QDialog::Accepted){
+ if(config_dialog->exec() == TQDialog::Accepted){
config->reparseConfiguration();
setFileItems(*currentItems, false);
@@ -497,18 +497,18 @@ void MetabarWidget::slotShowConfig()
setTheme();
- html->view()->setFrameShape(config->readBoolEntry("ShowFrame", true) ? QFrame::StyledPanel : QFrame::NoFrame);
+ html->view()->setFrameShape(config->readBoolEntry("ShowFrame", true) ? TQFrame::StyledPanel : TQFrame::NoFrame);
}
delete config_dialog;
}
-void MetabarWidget::slotShowPopup(const QString &url, const QPoint &point)
+void MetabarWidget::slotShowPopup(const TQString &url, const TQPoint &point)
{
popup->exec(point);
}
-void MetabarWidget::slotUpdateCurrentInfo(const QString &path)
+void MetabarWidget::slotUpdateCurrentInfo(const TQString &path)
{
if(currentItems){
KFileItem *item = new KFileItem(KFileItem::Unknown, KFileItem::Unknown, KURL(path), true);
@@ -522,10 +522,10 @@ void MetabarWidget::slotUpdateCurrentInfo(const QString &path)
}
}
-void MetabarWidget::slotDeleteCurrentInfo(const QString&)
+void MetabarWidget::slotDeleteCurrentInfo(const TQString&)
{
if(currentItems && currentItems->count() == 1){
- QString url = getCurrentURL();
+ TQString url = getCurrentURL();
KURL currentURL;
if(currentItems){
@@ -548,7 +548,7 @@ void MetabarWidget::slotDeleteCurrentInfo(const QString&)
}
}
-void MetabarWidget::addEntry(DOM::DOMString &html, const QString name, const QString url, const QString icon, const QString id, const QString nameatt, bool hidden)
+void MetabarWidget::addEntry(DOM::DOMString &html, const TQString name, const TQString url, const TQString icon, const TQString id, const TQString nameatt, bool hidden)
{
html += "<ul";
@@ -584,7 +584,7 @@ void MetabarWidget::setTheme()
loadComplete = false;
config->setGroup("General");
- QString file = locate("data", QString("metabar/themes/%1/layout.html").arg(config->readEntry("Theme", "default")));
+ TQString file = locate("data", TQString("metabar/themes/%1/layout.html").arg(config->readEntry("Theme", "default")));
html->openURL(KURL(file));
}