]>
cloud.milkyroute.net Git - dolphin.git/blob - src/urlbutton.cpp
1 /***************************************************************************
2 * Copyright (C) 2006 by Peter Penz (peter.penz@gmx.at) *
3 * Copyright (C) 2006 by Aaron J. Seigo (<aseigo@kde.org>) *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
21 #include "urlnavigatorbutton.h"
25 #include <qfontmetrics.h>
28 #include <kiconloader.h>
31 #include "urlnavigator.h"
32 #include "dolphinmainwindow.h"
35 UrlButton::UrlButton(UrlNavigator
* parent
) :
38 m_urlNavigator(parent
)
40 setFocusPolicy(Qt::NoFocus
);
41 setSizePolicy(QSizePolicy::Maximum
, QSizePolicy::Fixed
);
42 setMinimumHeight(parent
->minimumHeight());
44 connect(this, SIGNAL(clicked()), parent
, SLOT(requestActivation()));
47 UrlButton::~UrlButton()
51 void UrlButton::setDisplayHintEnabled(DisplayHint hint
,
55 m_displayHint
= m_displayHint
| hint
;
58 m_displayHint
= m_displayHint
& ~hint
;
63 bool UrlButton::isDisplayHintEnabled(DisplayHint hint
) const
65 return (m_displayHint
& hint
) > 0;
68 void UrlButton::enterEvent(QEvent
* event
)
70 QPushButton::enterEvent(event
);
71 setDisplayHintEnabled(EnteredHint
, true);
75 void UrlButton::leaveEvent(QEvent
* event
)
77 QPushButton::leaveEvent(event
);
78 setDisplayHintEnabled(EnteredHint
, false);
82 QColor
UrlButton::mixColors(const QColor
& c1
,
83 const QColor
& c2
) const
85 const int red
= (c1
.red() + c2
.red()) / 2;
86 const int green
= (c1
.green() + c2
.green()) / 2;
87 const int blue
= (c1
.blue() + c2
.blue()) / 2;
88 return QColor(red
, green
, blue
);
91 #include "urlbutton.moc"