summaryrefslogtreecommitdiffstats
path: root/konq-plugins/sidebar/metabar/src/metabar.cpp
blob: bc7d978d4875351e87a7746a33041a824482fd99 (plain)
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
#include <kinstance.h>
#include <tqstring.h>
#include <kimageio.h>
#include <klocale.h>

#include "metabarwidget.h"
#include "metabar.h"
#include "metabar.moc"

Metabar::Metabar(KInstance *inst,TQObject *tqparent,TQWidget *widgetParent, TQString &desktopName, const char* name):
                   KonqSidebarPlugin(inst,tqparent,widgetParent,desktopName,name)
{
  KImageIO::registerFormats();
  KGlobal::locale()->insertCatalogue( "konqsidebar_metabar" );

  widget = new MetabarWidget(widgetParent, "metabarwidget");
}


Metabar::~Metabar()
{
}

void Metabar::handleURL(const KURL &url)
{
  const KFileItem *item = new KFileItem(KFileItem::Unknown, KFileItem::Unknown, url, true);
  KFileItemList list;
  list.append(item);
  
  widget->setFileItems(list);
}

void Metabar::handlePreview(const KFileItemList &items)
{
  widget->setFileItems(items);
}


extern "C" {
  bool add_konqsidebar_metabar(TQString* fn, TQString* param, TQMap<TQString,TQString> *map) {
    Q_UNUSED(param);

    map->insert("Type", "Link");
    map->insert("Icon", "metabar");
    map->insert("Name", "Metabar");
    map->insert("Open", "true");
    map->insert("X-KDE-KonqSidebarModule","konqsidebar_metabar");
    fn->setLatin1("metabar%1.desktop");
    return true;
  }
}

extern "C"
{
  void* create_konqsidebar_metabar(KInstance *instance,TQObject *par,TQWidget *widp,TQString &desktopname,const char *name)
    {
      return new Metabar(instance,par,widp,desktopname,name);
    }
}