1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
/***************************************************************************
* Copyright (C) 2005 by Florian Roth *
* florian@synatic.net *
* *
* 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, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#include "metabarwidget.h"
#include "httpplugin.h"
#include <kbookmark.h>
#include <kstandarddirs.h>
#include <tdeapplication.h>
#include <kicontheme.h>
#include <tdehtmlview.h>
#include <kurl.h>
#include <tdelocale.h>
#include <dcopref.h>
#include <dcopclient.h>
#include <tqregexp.h>
#include <tqfile.h>
#include <dom_node.h>
#include <html_inline.h>
HTTPPlugin::HTTPPlugin(TDEHTMLPart* html, MetabarFunctions *functions, const char *name) : ProtocolPlugin (html, functions, name)
{
}
HTTPPlugin::~HTTPPlugin()
{
//delete bookmarkManager;
}
void HTTPPlugin::deactivate()
{
m_functions->hide("actions");
m_functions->hide("info");
}
void HTTPPlugin::killJobs()
{
}
void HTTPPlugin::loadInformation(DOM::HTMLElement node)
{
/*DOM::DOMString innerHTML;
innerHTML += "<form action=\"find:///\" method=\"GET\">";
innerHTML += "<ul>";
innerHTML += i18n("Keyword");
innerHTML += " <input onFocus=\"this.value = ''\" type=\"text\" name=\"find\" id=\"find_text\" value=\"";
innerHTML += i18n("Web search");
innerHTML += "\"></ul>";
innerHTML += "<ul><input type=\"submit\" id=\"find_button\" value=\"";
innerHTML += i18n("Find");
innerHTML += "\"></ul>";
innerHTML += "</form>";
node.setInnerHTML(innerHTML);
m_functions->show("info");*/
m_functions->hide("info");
}
void HTTPPlugin::loadActions(DOM::HTMLElement node)
{
m_functions->hide("actions");
}
void HTTPPlugin::loadApplications(DOM::HTMLElement node)
{
m_functions->hide("open");
}
void HTTPPlugin::loadPreview(DOM::HTMLElement node)
{
m_functions->hide("preview");
}
void HTTPPlugin::loadBookmarks(DOM::HTMLElement node)
{
m_functions->hide("bookmarks");
}
bool HTTPPlugin::handleRequest(const KURL &url)
{
if(url.protocol() == "find"){
TQString keyword = url.queryItem("find");
TQString type = url.queryItem("type");
if(!keyword.isNull() && !keyword.isEmpty()){
KURL url("http://www.google.com/search");
url.addQueryItem("q", keyword);
DCOPRef ref(kapp->dcopClient()->appId(), m_html->view()->topLevelWidget()->name());
DCOPReply reply = ref.call("openURL", url.url());
}
return true;
}
return false;
}
#include "httpplugin.moc"
|