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
|
/* ============================================================
*
* This file is a part of digiKam project
* http://www.digikam.org
*
* Date : 2007-27-08
* Description : an tool bar action object to display logo
*
* Copyright (C) 2007-2008 by Gilles Caulier <caulier dot gilles at gmail dot com>
*
* 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, 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.
*
* ============================================================ */
// TQt includes.
#include <tqtooltip.h>
#include <tqpixmap.h>
// KDE includes.
#include <kurllabel.h>
#include <tdetoolbar.h>
#include <kiconloader.h>
#include <tdeapplication.h>
#include <kstandarddirs.h>
#include <tdelocale.h>
// Local includes.
#include "daboutdata.h"
#include "dlogoaction.h"
namespace Digikam
{
DLogoAction::DLogoAction(TQObject* parent, const char* name)
: TDEAction(parent, name)
{
setText("digikam.org");
setIcon("digikam");
}
int DLogoAction::plug(TQWidget *widget, int index)
{
if (kapp && !kapp->authorizeTDEAction(name()))
return -1;
if ( widget->inherits( "TDEToolBar" ) )
{
TDEToolBar *bar = (TDEToolBar *)widget;
int id = getToolButtonID();
KURLLabel *pixmapLogo = new KURLLabel(Digikam::webProjectUrl(), TQString(), bar);
pixmapLogo->setMargin(0);
pixmapLogo->setScaledContents(false);
pixmapLogo->setSizePolicy(TQSizePolicy(TQSizePolicy::Minimum, TQSizePolicy::Minimum));
TQToolTip::add(pixmapLogo, i18n("Visit digiKam project website"));
TDEGlobal::dirs()->addResourceType("banner-digikam", TDEGlobal::dirs()->kde_default("data") + "digikam/data");
TQString directory = TDEGlobal::dirs()->findResourceDir("banner-digikam", "banner-digikam.png");
pixmapLogo->setPixmap(TQPixmap( directory + "banner-digikam.png" ));
pixmapLogo->setFocusPolicy(TQWidget::NoFocus);
bar->insertWidget(id, pixmapLogo->width(), pixmapLogo);
bar->alignItemRight(id);
addContainer(bar, id);
connect(bar, TQ_SIGNAL(destroyed()),
this, TQ_SLOT(slotDestroyed()));
connect(pixmapLogo, TQ_SIGNAL(leftClickedURL(const TQString&)),
this, TQ_SLOT(slotProcessURL(const TQString&)));
return containerCount() - 1;
}
int containerId = TDEAction::plug( widget, index );
return containerId;
}
void DLogoAction::slotProcessURL(const TQString& url)
{
TDEApplication::kApplication()->invokeBrowser(url);
}
} // namespace Digikam
|