summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2008-12-16 01:09:39 +0100
committerAndrea Diamantini <adjam7@gmail.com>2008-12-16 01:09:39 +0100
commitaf9623896acb241a965a7d0823e12fd099031a39 (patch)
tree1c8a455631070d29bc2526a0015cb45c8b7ab5fc /src
parentSome improvements in settings class.. (diff)
downloadrekonq-af9623896acb241a965a7d0823e12fd099031a39.tar.xz
Initial solution for UI resizing..
Now we can release rekonq 0.0.2 and thinking later about the problem..
Diffstat (limited to 'src')
-rw-r--r--src/browsermainwindow.cpp14
-rw-r--r--src/searchbar.cpp51
-rw-r--r--src/searchbar.h14
-rw-r--r--src/tabwidget.cpp3
-rw-r--r--src/urlbar.cpp37
-rw-r--r--src/urlbar.h3
6 files changed, 47 insertions, 75 deletions
diff --git a/src/browsermainwindow.cpp b/src/browsermainwindow.cpp
index 7b6bfc05..60115b09 100644
--- a/src/browsermainwindow.cpp
+++ b/src/browsermainwindow.cpp
@@ -354,10 +354,6 @@ void BrowserMainWindow::setupToolBar()
{
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);
m_historyBack->setMenu(m_historyBackMenu);
@@ -379,12 +375,16 @@ void BrowserMainWindow::setupToolBar()
m_navigationBar->addWidget( m_tabWidget->lineEditStack() );
- m_searchBar = new SearchBar( this );
+ m_searchBar = new SearchBar( m_navigationBar );
connect(m_searchBar, SIGNAL(search(const KUrl&)), this, SLOT(loadUrl(const KUrl&)));
m_navigationBar->addWidget(m_searchBar);
-// KToolBar::setToolBarsEditable( false );
-// KToolBar::setToolBarsLocked( true );
+ // UI settings
+ setContextMenuPolicy( Qt::PreventContextMenu );
+ m_navigationBar->setIconDimensions(22);
+
+ KToolBar::setToolBarsEditable( false );
+ KToolBar::setToolBarsLocked( true );
}
diff --git a/src/searchbar.cpp b/src/searchbar.cpp
index 29862e6d..0cf8e801 100644
--- a/src/searchbar.cpp
+++ b/src/searchbar.cpp
@@ -26,28 +26,24 @@
SearchBar::SearchBar(QWidget *parent) :
- QWidget(parent),
- m_lineEdit(new KLineEdit)
+ KLineEdit(parent)
{
- m_lineEdit->setClearButtonShown( true );
-
- m_lineEdit->setFocusProxy( this );
+ setMinimumWidth(180);
setFocusPolicy( Qt::WheelFocus );
setMouseTracking( true );
+ setAcceptDrops(true);
QSizePolicy policy = sizePolicy();
setSizePolicy(QSizePolicy::Preferred, policy.verticalPolicy());
- QPalette palette;
- palette.setColor( QPalette::Text, Qt::gray );
- m_lineEdit->setPalette( palette );
- m_lineEdit->setText( "Search.." );
+ setClearButtonShown( true );
- QVBoxLayout *layout = new QVBoxLayout;
- layout->addWidget(m_lineEdit);
- setLayout(layout);
+ QPalette p;
+ p.setColor( QPalette::Text , Qt::lightGray );
+ setPalette( p );
+ setText( i18n("Search..") );
- connect( m_lineEdit , SIGNAL( returnPressed() ) , this , SLOT( searchNow() ) );
+ connect( this, SIGNAL( returnPressed() ) , this , SLOT( searchNow() ) );
}
@@ -56,27 +52,9 @@ SearchBar::~SearchBar()
}
-// void SearchBar::resizeEvent( QResizeEvent * event )
-// {
-// QRect rect = m_lineEdit->contentsRect();
-//
-// int width = rect.width();
-//
-// int lineEditWidth = BrowserApplication::instance()->mainWindow()->size().width() / 5 ; // FIXME ( OR not?)
-//
-// m_lineEdit->setGeometry( rect.x() + ( width - lineEditWidth + 8 ),
-// rect.y() + 4,
-// lineEditWidth,
-// m_lineEdit->height()
-// );
-//
-// QWidget::resizeEvent( event );
-// }
-
-
void SearchBar::searchNow()
{
- QString searchText = m_lineEdit->text();
+ QString searchText = text();
KUrl url(QLatin1String("http://www.google.com/search"));
url.addQueryItem(QLatin1String("q"), searchText);
@@ -87,8 +65,13 @@ void SearchBar::searchNow()
}
-KLineEdit *SearchBar::lineEdit()
+void SearchBar::focusInEvent(QFocusEvent *event)
{
- return m_lineEdit;
+ KLineEdit::focusInEvent(event);
+
+ QPalette p;
+ p.setColor( QPalette::Text , Qt::black );
+ setPalette( p );
+ clear();
}
diff --git a/src/searchbar.h b/src/searchbar.h
index 67f2bda5..a83d7024 100644
--- a/src/searchbar.h
+++ b/src/searchbar.h
@@ -28,27 +28,19 @@
// Qt Includes
#include <QtGui>
-class SearchBar : public QWidget
+class SearchBar : public KLineEdit
{
-Q_OBJECT
+ Q_OBJECT
public:
SearchBar(QWidget *parent = 0);
~SearchBar();
- KLineEdit *lineEdit();
-
- friend class KLineEdit;
-
public slots:
void searchNow();
protected:
-// void resizeEvent(QResizeEvent *);
-// void focusInEvent(QFocusEvent *);
-
-private:
- KLineEdit *m_lineEdit;
+ void focusInEvent(QFocusEvent * );
signals:
void search(const KUrl &url);
diff --git a/src/tabwidget.cpp b/src/tabwidget.cpp
index 46724e1e..24aacfff 100644
--- a/src/tabwidget.cpp
+++ b/src/tabwidget.cpp
@@ -41,6 +41,7 @@
TabBar::TabBar(QWidget *parent)
: KTabBar(parent)
{
+ setElideMode(Qt::ElideRight);
setContextMenuPolicy(Qt::CustomContextMenu);
setAcceptDrops(true);
connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(contextMenuRequested(const QPoint &)));
@@ -495,7 +496,7 @@ WebView *TabWidget::newTab(bool makeCurrent)
connect(this, SIGNAL(currentChanged(int)), this, SLOT(currentChanged(int)));
return 0;
}
-
+
// webview
WebView *webView = new WebView;
urlLineEdit->setWebView(webView);
diff --git a/src/urlbar.cpp b/src/urlbar.cpp
index 85e59693..e2dc458d 100644
--- a/src/urlbar.cpp
+++ b/src/urlbar.cpp
@@ -26,24 +26,19 @@
UrlBar::UrlBar(QWidget *parent)
- : QWidget(parent)
- , m_historyComboBox( new KHistoryComboBox( true, parent ) )
+ : KHistoryComboBox( true, parent )
, m_webView(0)
, m_lineEdit(new QLineEdit)
{
- m_historyComboBox->setLineEdit( m_lineEdit );
+ 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( m_historyComboBox, SIGNAL( activated( const QString& ) ), m_historyComboBox, SLOT( addToHistory( const QString& ) ) );
+ connect( this, SIGNAL( activated( const QString& ) ), this, SLOT( addToHistory( const QString& ) ) );
webViewIconChanged();
}
@@ -91,8 +86,8 @@ void UrlBar::webViewIconChanged()
QIcon urlIcon = QIcon(pixmap);
// FIXME simple hack to show Icon in the urlbar, as calling changeUrl() doesn't affect it
- m_historyComboBox->removeItem( 0 );
- m_historyComboBox->insertUrl( 0 , urlIcon , url );
+ removeItem( 0 );
+ insertUrl( 0 , urlIcon , url );
}
@@ -138,17 +133,19 @@ QLinearGradient UrlBar::generateGradient(const QColor &color) const
// }
-// void UrlBar::resizeEvent( QResizeEvent *event )
+// FIXME : seems working. Need to re-enable it when searchbar resizing will work , too..
+// void UrlBar::resizeEvent( QResizeEvent * event )
// {
-// QRect rect = m_historyComboBox->frameGeometry();
-//
-// int newWidth = BrowserApplication::instance()->mainWindow()->size().width() * 3 / 5 ; // FIXME ( OR not?)
+// QRect rect = geometry();
//
-// m_historyComboBox->setGeometry( rect.x(),
-// rect.y(),
-// newWidth,
-// m_historyComboBox->height()
-// );
+// int windowWidth = BrowserApplication::instance()->mainWindow()->size().width() ; // FIXME ( OR not?)
+// int newWidth = windowWidth * 4 / 6;
+//
+// setGeometry( rect.x() + 1,
+// rect.y() + 1,
+// newWidth,
+// height()
+// );
//
-// QWidget::resizeEvent( event );
+// KHistoryComboBox::resizeEvent( event );
// }
diff --git a/src/urlbar.h b/src/urlbar.h
index 3180920a..1346eada 100644
--- a/src/urlbar.h
+++ b/src/urlbar.h
@@ -30,7 +30,7 @@
#include <QtGui>
-class UrlBar : public QWidget
+class UrlBar : public KHistoryComboBox
{
Q_OBJECT
@@ -52,7 +52,6 @@ protected:
private:
QLinearGradient generateGradient(const QColor &color) const;
- KHistoryComboBox* m_historyComboBox;
WebView* m_webView;
QLineEdit* m_lineEdit;
QColor m_defaultBaseColor;