1
mirror of https://invent.kde.org/network/falkon.git synced 2024-09-21 17:52:10 +02:00

Fixed height of Flash info widget if src is too long. WebSearchBar now

search dropped text
This commit is contained in:
nowrep 2011-08-27 17:52:44 +02:00
parent 5853d72947
commit 9698146075
7 changed files with 24 additions and 99 deletions

View File

@ -5,6 +5,12 @@ SqueezeLabelV2::SqueezeLabelV2(QWidget *parent)
{
}
SqueezeLabelV2::SqueezeLabelV2(const QString &string)
: QLabel()
{
setText(string);
}
void SqueezeLabelV2::setText(const QString &txt)
{
m_originalText = txt;

View File

@ -41,6 +41,8 @@ class SqueezeLabelV2 : public QLabel
public:
SqueezeLabelV2(QWidget *parent = 0);
SqueezeLabelV2(const QString &string);
QString originalText();
void setText(const QString &txt);

View File

@ -112,3 +112,15 @@ void WebSearchBar::focusInEvent(QFocusEvent* e)
}
QLineEdit::focusInEvent(e);
}
void WebSearchBar::dropEvent(QDropEvent* event)
{
if (event->mimeData()->hasText()) {
QString dropText = event->mimeData()->text();
setText(dropText);
search();
QLineEdit::focusOutEvent(new QFocusEvent(QFocusEvent::FocusOut));
return;
}
QLineEdit::dropEvent(event);
}

View File

@ -45,6 +45,7 @@ private:
void setupSearchTypes();
void focusInEvent(QFocusEvent* e);
void focusOutEvent(QFocusEvent* e);
void dropEvent(QDropEvent* event);
QupZilla* p_QupZilla;
};

View File

@ -44,6 +44,7 @@
#include "pluginproxy.h"
#include "adblockmanager.h"
#include "adblocksubscription.h"
#include "squeezelabelv2.h"
ClickToFlash::ClickToFlash(const QUrl &pluginUrl, const QStringList &argumentNames, const QStringList &argumentValues, QWidget* parent)
: QWidget(parent)
@ -206,7 +207,7 @@ void ClickToFlash::showInfo()
int i = 0;
foreach (QString name, m_argumentNames) {
QString value = m_argumentValues.at(i);
lay->addRow(new QLabel(name), new QLabel(value));
lay->addRow(new SqueezeLabelV2(name), new SqueezeLabelV2(value));
i++;
}
@ -214,5 +215,6 @@ void ClickToFlash::showInfo()
if (i == 0)
lay->addRow(new QLabel(tr("No more informations available.")));
widg->setMaximumHeight(500);
widg->show();
}

View File

@ -1,56 +0,0 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2011 nowrep
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
* ============================================================ */
#include "notification.h"
Notification::Notification(QWidget* parent) :
QWidget(parent)
,m_animation(0)
{
setMinimumHeight(1);
setMaximumHeight(1);
setUpdatesEnabled(false);
}
void Notification::startAnimation()
{
m_animation = new QTimeLine(300, this);
m_animation->setFrameRange(0, sizeHint().height());
setMinimumHeight(1);
setMaximumHeight(1);
setUpdatesEnabled(true);
connect(m_animation, SIGNAL(frameChanged(int)),this, SLOT(frameChanged(int)));
QTimer::singleShot(1, m_animation, SLOT(start()));
}
void Notification::hide()
{
if (!m_animation) {
close();
return;
}
m_animation->setDirection(QTimeLine::Backward);
m_animation->stop();
m_animation->start();
connect(m_animation, SIGNAL(finished()), this, SLOT(close()));
}
void Notification::frameChanged(int frame)
{
setMinimumHeight(frame);
setMaximumHeight(frame);
}

View File

@ -1,42 +0,0 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2011 nowrep
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
* ============================================================ */
#ifndef NOTIFICATION_H
#define NOTIFICATION_H
#include <QWidget>
#include <QTimeLine>
#include <QTimer>
class Notification : public QWidget
{
Q_OBJECT
public:
explicit Notification(QWidget* parent = 0);
public slots:
void hide();
void startAnimation();
private slots:
void frameChanged(int frame);
private:
QTimeLine* m_animation;
};
#endif // NOTIFICATION_H