Wittyshare  0.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
WsSearchObject.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-Today Guy Deleeuw
3  *
4  * See the LICENSE file for terms of use.
5 */
6 
7 #include <Wt/WApplication>
8 #include <Wt/WLogger>
9 #include <Wt/WHBoxLayout>
10 #include <Wt/WTheme>
11 
12 #include "WsLogo.h"
13 #include "WsSiteMap.h"
14 
15 #include "WsSearchObject.h"
16 
18 #include <Include/WsGlobalConfig.h>
19 
20 using namespace Wt;
21 
22 WsSearchObject::WsSearchObject(WContainerWidget* parent)
23  : gdWSearch(parent)
24 {
25  m_searchPath = WsLayoutProperties::instance()->get("global", "search_path", "/Search");
26  if ( WString::tr("byObjectStyleSheet").narrow() == "true" )
27  wApp->useStyleSheet(wApp->theme()->resourcesUrl() + "wittyshare/Css/WsSearchObject.css");
28  addStyleClass("WsSearchObject");
29  setText("Search");
30  searchValidated().connect(SLOT(this, WsSearchObject::doSearch));
31  searchFocussed().connect(SLOT(this, WsSearchObject::doFocussed));
32  searchBlurred().connect(SLOT(this, WsSearchObject::doBlurred));
33 }
34 
36 { }
37 
38 void WsSearchObject::doSearch(WString sSearch)
39 {
40  std::string mySearch(sSearch.toUTF8());
41  if ( mySearch == "Search" ) return;
42  if ( mySearch.size() < 1 ) return;
43  wApp->setInternalPath(m_searchPath + "/" + mySearch, true);
44 }
45 
46 void WsSearchObject::doFocussed(Wt::WString sSearch)
47 {
48  // std::string mySearch(sSearch.toUTF8());
49  // if ( mySearch != "Search" ) return;
50  if ( sSearch != "Search" ) return;
51  setText("");
52 }
53 
54 void WsSearchObject::doBlurred(Wt::WString sSearch)
55 {
56  setText("Search");
57 }
WsSearchObject(Wt::WContainerWidget *parent=0)
void doSearch(Wt::WString sSearch)
void doFocussed(Wt::WString sSearch)
std::string get(const std::string &section, const std::string &id, const std::string &def)
static WsLayoutProperties * instance()
Get the singleton instance.
std::string m_searchPath
void doBlurred(Wt::WString sSearch)