summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2008-12-14 16:54:45 +0100
committerAndrea Diamantini <adjam7@gmail.com>2008-12-14 16:54:45 +0100
commit439e23791714ff99876b8cca3afd6225445e75fc (patch)
tree80895c6703dc7748be73f9bd811cbc92fce5c5c6 /src
parentFixing searchbar dimension && position (diff)
downloadrekonq-439e23791714ff99876b8cca3afd6225445e75fc.tar.xz
Last changes..
Diffstat (limited to 'src')
-rw-r--r--src/browsermainwindow.cpp33
-rw-r--r--src/browsermainwindow.h3
-rw-r--r--src/urlbar.cpp98
-rw-r--r--src/urlbar.h17
4 files changed, 80 insertions, 71 deletions
diff --git a/src/browsermainwindow.cpp b/src/browsermainwindow.cpp
index ac05a249..e9f685cd 100644
--- a/src/browsermainwindow.cpp
+++ b/src/browsermainwindow.cpp
@@ -1,6 +1,6 @@
/* ============================================================
 *
- * This file is a part of the reKonq project
+ * This file is a part of the rekonq project
 *
* Copyright (C) 2007-2008 Trolltech ASA. All rights reserved
* Copyright (C) 2008 by Andrea Diamantini <adjam7 at gmail dot com>
@@ -103,7 +103,6 @@ BrowserMainWindow::BrowserMainWindow(QWidget *parent, Qt::WindowFlags flags)
}
-
BrowserMainWindow::~BrowserMainWindow()
{
m_autoSaver->changeOccurred();
@@ -112,7 +111,6 @@ BrowserMainWindow::~BrowserMainWindow()
}
-
void BrowserMainWindow::loadDefaultState()
{
KConfig config("rekonqrc");
@@ -122,16 +120,6 @@ void BrowserMainWindow::loadDefaultState()
}
-
-QSize BrowserMainWindow::sizeHint() const
-{
- QRect desktopRect = QApplication::desktop()->screenGeometry();
- QSize size = desktopRect.size() * 0.9;
- return size;
-}
-
-
-
void BrowserMainWindow::save()
{
BrowserApplication::instance()->saveSession();
@@ -143,11 +131,9 @@ void BrowserMainWindow::save()
}
-
static const qint32 BrowserMainWindowMagic = 0xba;
-
QByteArray BrowserMainWindow::saveState(bool withTabs) const
{
int version = 2;
@@ -208,7 +194,6 @@ bool BrowserMainWindow::restoreState(const QByteArray &state)
}
-
void BrowserMainWindow::setupMenu()
{
// ------------------------------------------------------------- FILE --------------------------------------------------------------------------------------------------
@@ -367,7 +352,11 @@ void BrowserMainWindow::setupMenu()
void BrowserMainWindow::setupToolBar()
{
- m_navigationBar = new KToolBar( i18n("Navigation") , this, Qt::TopToolBarArea, true, false, false);
+ m_navigationBar = new KToolBar( i18n("Navigation") , this, Qt::TopToolBarArea, false, false, false);
+
+ // UI settings
+ m_navigationBar->setContextMenuPolicy( Qt::NoContextMenu );
+ m_navigationBar->setIconDimensions(22);
m_historyBack = new KAction( KIcon("go-previous"), i18n("Back"), this);
m_historyBackMenu = new KMenu(this);
@@ -390,14 +379,12 @@ void BrowserMainWindow::setupToolBar()
m_navigationBar->addWidget( m_tabWidget->lineEditStack() );
- m_searchBar = new SearchBar(m_navigationBar);
- m_navigationBar->addWidget(m_searchBar);
+ m_searchBar = new SearchBar( this );
connect(m_searchBar, SIGNAL(search(const KUrl&)), this, SLOT(loadUrl(const KUrl&)));
+ m_navigationBar->addWidget(m_searchBar);
- // UI settings
- m_navigationBar->setIconDimensions(16);
- m_navigationBar->setContextMenuPolicy( Qt::NoContextMenu );
- KToolBar::setToolBarsLocked( true );
+// KToolBar::setToolBarsEditable( false );
+// KToolBar::setToolBarsLocked( true );
}
diff --git a/src/browsermainwindow.h b/src/browsermainwindow.h
index 9cb9fe18..d50abcc4 100644
--- a/src/browsermainwindow.h
+++ b/src/browsermainwindow.h
@@ -1,6 +1,6 @@
/* ============================================================
 *
- * This file is a part of the reKonq project
+ * This file is a part of the rekonq project
 *
* Copyright (C) 2007-2008 Trolltech ASA. All rights reserved
* Copyright (C) 2008 by Andrea Diamantini <adjam7 at gmail dot com>
@@ -54,7 +54,6 @@ public:
BrowserMainWindow(QWidget *parent = 0, Qt::WindowFlags flags = 0);
~BrowserMainWindow();
- QSize sizeHint() const;
static KUrl guessUrlFromString(const QString &url);
TabWidget *tabWidget() const;
WebView *currentTab() const;
diff --git a/src/urlbar.cpp b/src/urlbar.cpp
index 894c702f..85e59693 100644
--- a/src/urlbar.cpp
+++ b/src/urlbar.cpp
@@ -1,6 +1,6 @@
/* ============================================================
 *
- * This file is a part of the reKonq project
+ * This file is a part of the rekonq project
 *
* Copyright (C) 2008 by Andrea Diamantini <adjam7 at gmail dot com>
 *
@@ -25,18 +25,25 @@
#include "browsermainwindow.h"
-UrlBar::UrlBar(KHistoryComboBox *parent)
- : KHistoryComboBox(true, parent)
+UrlBar::UrlBar(QWidget *parent)
+ : QWidget(parent)
+ , m_historyComboBox( new KHistoryComboBox( true, parent ) )
, m_webView(0)
- , m_lineEdit(0)
+ , m_lineEdit(new QLineEdit)
{
- m_lineEdit = new QLineEdit;
- setLineEdit( m_lineEdit );
+ m_historyComboBox->setLineEdit( m_lineEdit );
+
+ QSizePolicy policy = sizePolicy();
+ setSizePolicy(QSizePolicy::Preferred, policy.verticalPolicy());
+
+ QVBoxLayout *layout = new QVBoxLayout;
+ layout->addWidget( m_historyComboBox );
+ setLayout(layout);
m_defaultBaseColor = palette().color( QPalette::Base );
// add every item to history
- connect( this, SIGNAL( activated( const QString& ) ), this, SLOT( addToHistory( const QString& ) ) );
+ connect( m_historyComboBox, SIGNAL( activated( const QString& ) ), m_historyComboBox, SLOT( addToHistory( const QString& ) ) );
webViewIconChanged();
}
@@ -84,8 +91,8 @@ void UrlBar::webViewIconChanged()
QIcon urlIcon = QIcon(pixmap);
// FIXME simple hack to show Icon in the urlbar, as calling changeUrl() doesn't affect it
- removeItem( 0 );
- insertUrl( 0 , urlIcon , url );
+ m_historyComboBox->removeItem( 0 );
+ m_historyComboBox->insertUrl( 0 , urlIcon , url );
}
@@ -101,32 +108,47 @@ QLinearGradient UrlBar::generateGradient(const QColor &color) const
}
-void UrlBar::paintEvent( QPaintEvent *event )
-{
- QPalette p = palette();
- if (m_webView && m_webView->url().scheme() == QLatin1String("https"))
- {
- QColor lightYellow(248, 248, 210);
- p.setBrush(QPalette::Base, generateGradient(lightYellow));
- }
- else
- {
- p.setBrush(QPalette::Base, m_defaultBaseColor);
- }
- setPalette(p);
- KHistoryComboBox::paintEvent(event);
-
- QPainter painter( this );
- QRect backgroundRect = m_lineEdit->frameGeometry(); // contentsRect();
- if ( m_webView && !hasFocus() )
- {
- int progress = m_webView->progress();
- QColor loadingColor = QColor(116, 192, 250);
- painter.setBrush( generateGradient(loadingColor) );
- painter.setPen(Qt::transparent);
- int mid = backgroundRect.width() / 100 * progress;
- QRect progressRect(backgroundRect.x(), backgroundRect.y(), mid, backgroundRect.height());
- painter.drawRect(progressRect);
- }
-}
-
+// void UrlBar::paintEvent( QPaintEvent *event )
+// {
+// QPalette p = palette();
+// if (m_webView && m_webView->url().scheme() == QLatin1String("https"))
+// {
+// QColor lightYellow(248, 248, 210);
+// p.setBrush(QPalette::Base, generateGradient(lightYellow));
+// }
+// else
+// {
+// p.setBrush(QPalette::Base, m_defaultBaseColor);
+// }
+// setPalette(p);
+// KHistoryComboBox::paintEvent(event);
+//
+// QPainter painter( this );
+// QRect backgroundRect = m_lineEdit->frameGeometry(); // contentsRect(); // FIXME perhaps better working with contentsRect
+// if ( m_webView && !hasFocus() ) // and modifying colours..
+// {
+// int progress = m_webView->progress();
+// QColor loadingColor = QColor(116, 192, 250);
+// painter.setBrush( generateGradient(loadingColor) );
+// painter.setPen(Qt::transparent);
+// int mid = backgroundRect.width() / 100 * progress;
+// QRect progressRect(backgroundRect.x(), backgroundRect.y(), mid, backgroundRect.height());
+// painter.drawRect(progressRect);
+// }
+// }
+
+
+// void UrlBar::resizeEvent( QResizeEvent *event )
+// {
+// QRect rect = m_historyComboBox->frameGeometry();
+//
+// int newWidth = BrowserApplication::instance()->mainWindow()->size().width() * 3 / 5 ; // FIXME ( OR not?)
+//
+// m_historyComboBox->setGeometry( rect.x(),
+// rect.y(),
+// newWidth,
+// m_historyComboBox->height()
+// );
+//
+// QWidget::resizeEvent( event );
+// }
diff --git a/src/urlbar.h b/src/urlbar.h
index a670fca6..3180920a 100644
--- a/src/urlbar.h
+++ b/src/urlbar.h
@@ -1,6 +1,6 @@
/* ============================================================
 *
- * This file is a part of the reKonq project
+ * This file is a part of the rekonq project
 *
* Copyright (C) 2008 by Andrea Diamantini <adjam7 at gmail dot com>
 *
@@ -30,12 +30,12 @@
#include <QtGui>
-class UrlBar : public KHistoryComboBox
+class UrlBar : public QWidget
{
Q_OBJECT
public:
- UrlBar(KHistoryComboBox *parent = 0);
+ UrlBar(QWidget *parent = 0);
~UrlBar();
QLineEdit *lineEdit();
@@ -46,15 +46,16 @@ private slots:
void webViewIconChanged();
protected:
- void paintEvent( QPaintEvent * );
+// void paintEvent( QPaintEvent * );
+// void resizeEvent( QResizeEvent * );
private:
QLinearGradient generateGradient(const QColor &color) const;
- WebView *m_webView;
-
- QLineEdit *m_lineEdit;
- QColor m_defaultBaseColor;
+ KHistoryComboBox* m_historyComboBox;
+ WebView* m_webView;
+ QLineEdit* m_lineEdit;
+ QColor m_defaultBaseColor;
};
#endif