From 7f611e03ceca9f2bb3d7f6ab564cd1b1e2fd099f Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sun, 13 May 2012 17:12:14 +0200 Subject: Another CSS clean up (last??) --- src/data/home.html | 225 +++++++++++++++++++++++++++-------------------------- src/newtabpage.cpp | 74 ++++++++++-------- 2 files changed, 155 insertions(+), 144 deletions(-) diff --git a/src/data/home.html b/src/data/home.html index 295d5d78..1d791d52 100644 --- a/src/data/home.html +++ b/src/data/home.html @@ -12,221 +12,225 @@ /* -------------------------------------------------------- */ /* generic styles */ -* { -border: 0; padding: 0; margin: 0; -} - @font-face { font-family: 'Nunito'; src: url(%2/fonts/Nunito-Regular.ttf); font-weight: normal; font-style: normal; - } body { -background: url(%2/pics/background.jpg) repeat-y #fff; -font-family: 'Nunito', sans-serif; -font-size: 0.9em; -} - -#rekonq-newtabpage { -width: 96%; -text-align: center; /* center #navigation */ -margin: 0 2%; -} - -#content { -text-align: left; -margin: 0 1% 2% 1%; + background: url(%2/pics/background.jpg) repeat-y #fff; + font-family: 'Nunito', sans-serif; + font-size: 0.9em; + border: 0; + padding: 0; + margin: 0; } h3 { -padding: 0.2em; -margin: 1.5em 0 0.5em; -font: normal bold 1em; + padding: 0.2em; + margin: 1.5em 0 0.5em; + font: normal bold 1em; } h4 { -padding: 0.2em; -margin: 1em 0 0.5em; -font: normal bold 1em; -border-bottom: 1px solid black; + padding: 0.2em; + margin: 1em 0 0.5em; + font: normal bold 1em; + border-bottom: 1px solid black; } a { -color: #3F7AB7; -text-decoration: none; --webkit-transition: color 0.5s ease; + color: #3F7AB7; + text-decoration: none; + -webkit-transition: color 0.5s ease; } + a:hover { -color: black; + color: black; } -/* -------------------------------------------------------- */ -/* Top bar */ +input { + min-width: 180px; + font-family: 'Nunito', sans-serif; + font-size: 0.8em; +} -#top { -margin: 20px; -display:table; -width: 95%; + +.right { + float: right; } -.topSide, .topMiddle { -display:table-cell; +.left { + float: left; } -.topSide { -width: 15%; +/* -------------------------------------------------------- */ +/* content div */ + + +#rekonq-newtabpage { + width: 90%; + text-align: center; /* center #navigation */ + margin: 0 5%; } #navigation { -display: table; -margin-left: auto; -margin-right: auto; + display: table; + margin-left: auto; + margin-right: auto; } - #actions { -display: table; -width:auto; + display: table; + margin: 20px auto; + width: 100%; +} + +#content { + text-align: left; + margin: 0; } + +/* -------------------------------------------------------- */ +/* Top bar */ + .link { -display: table-cell; -/*display:inline-block;*/ --webkit-transition: opacity 0.5s ease; + display: table-cell; + /*display:inline-block;*/ + -webkit-transition: opacity 0.5s ease; } .link:not(.current):hover { -opacity: 0.6; + opacity: 0.6; } .link img, .link span { -vertical-align: middle; display: inline-block; -margin:0 10px; + vertical-align: middle; display: inline-block; + margin:0 10px; } .link a, .link span { -color: black; + color: black; } #actions .link img { -margin-right: 3px; width: 16px; + margin-right: 3px; width: 16px; } .current { -border-width: 6px; --webkit-border-image: url(%2/pics/button.png) 6 stretch stretch; + border-width: 6px; + -webkit-border-image: url(%2/pics/button.png) 6 stretch stretch; } .link:not(.current){ -margin: 0 10px; -padding:3px; + margin: 0 10px; + padding:3px; } /* -------------------------------------------------------- */ /* Previews */ -#content.favorites, #content.closedTabs { -text-align: center; +#content.favorites, #content.closedTabs, #content.bookmarks { + text-align: center; } .thumbnail { -display: inline-block; -width: 25%; min-width: 240px; -height: 170px; -margin: 3% 0 3% 0; + display: inline-block; + width: 25%; min-width: 240px; + height: 170px; + margin: 3% 0 3% 0; } .thumb-inner { -width: 232px; /* 200 + 16*2 */ -margin: auto; + width: 232px; /* 200 + 16*2 */ + margin: auto; } .preview { -display: table-cell; vertical-align: middle; -width: 200px; height: 150px; -padding: 14px 16px 12px; -background: url(%2/pics/bg.png) no-repeat; --webkit-background-size: 100% 100%; + display: table-cell; + vertical-align: middle; + width: 200px; + height: 150px; + padding: 14px 16px 12px; + background: url(%2/pics/bg.png) no-repeat; + -webkit-background-size: 100% 100%; } .title { -padding: 0 12px; + padding: 0 12px; } .button img { -display: inline-block; -width: 16px; -height: 16px; -opacity: 0; -} - -.remove { -float: right; -} -.reload { -float: left; + display: inline-block; + width: 16px; + height: 16px; + opacity: 0; } .button img, .preview { --webkit-transition: opacity 0.8s ease-in-out; + -webkit-transition: opacity 0.8s ease-in-out; } + .thumb-inner:hover .preview { -opacity: 0.6; + opacity: 0.6; } + .thumb-inner:hover .button img { -opacity: 0.4; --webkit-transition: opacity 0.8s ease-out; + opacity: 0.4; + -webkit-transition: opacity 0.8s ease-out; } + .thumb-inner .button img:hover { -opacity: 1; + opacity: 1; } + .thumbnail a:hover { -color:#3F7AB7; + color:#3F7AB7; } /* -------------------------------------------------------- */ /* Bookmarks page */ .bookmarkfolder { -display: inline-block; -background: #BBB; -border-radius: 15px; -padding: 0px 15px 15px 15px; -float:left; -margin: 1em; -width: 28%; + background: #CCC; + border-radius: 15px; + padding: 0px 15px 15px 15px; + float:left; + margin: 1em; + width: 28%; + text-align: left; } /* -------------------------------------------------------- */ /* Downloads page */ .download { -margin: 2em 5em; + margin: 2em 0; } .download img { -float: left; -margin-right: 5px; + float: left; + margin-right: 5px; } .download a.greylink { -color:grey; + color:grey; } /* -------------------------------------------------------- */ /* History page */ .greybox { -background: #CCC; -padding: 5px 10px; + background: #CCC; + padding: 5px 10px; } .historyfolder { -margin-left: 4em; -margin-bottom: 1em; + margin-left: 4em; + margin-bottom: 1em; } @@ -234,11 +238,10 @@ margin-bottom: 1em; /* Empty pages : in the end : need to overwrite */ #content.empty { -margin-top: 10%; -text-align: center; + margin-top: 10%; + text-align: center; } - @@ -273,9 +276,9 @@ elements creation, cloning one of these.
- + - +
@@ -284,8 +287,8 @@ elements creation, cloning one of these.
-

-

+
+
diff --git a/src/newtabpage.cpp b/src/newtabpage.cpp index 54c0e437..8973cf4c 100644 --- a/src/newtabpage.cpp +++ b/src/newtabpage.cpp @@ -365,11 +365,12 @@ void NewTabPage::browsingMenu(const KUrl ¤tUrl) void NewTabPage::favoritesPage() { m_root.addClass(QL1S("favorites")); - - const QWebElement add = createLinkItem(i18n("Add Favorite"), - QL1S("about:preview/add"), - QL1S("list-add"), - KIconLoader::Toolbar); + + QWebElement add = createLinkItem(i18n("Add Favorite"), + QL1S("about:preview/add"), + QL1S("list-add"), + KIconLoader::Toolbar); + add.setAttribute(QL1S("class"), QL1S("right")); m_root.document().findFirst("#actions").appendInside(add); QStringList names = ReKonfig::previewNames(); @@ -399,13 +400,16 @@ void NewTabPage::historyPage(const QString & filter) { m_root.addClass(QL1S("history")); - const QWebElement searchForm = createFormItem(i18n("Search History"), QL1S("about:history/search")); + QWebElement searchForm = createFormItem(i18n("Search History"), QL1S("about:history/search")); + searchForm.setAttribute(QL1S("class"), QL1S("left")); + m_root.document().findFirst(QL1S("#actions")).appendInside(searchForm); - const QWebElement clearHistory = createLinkItem(i18n("Clear History"), + QWebElement clearHistory = createLinkItem(i18n("Clear History"), QL1S("about:history/clear"), QL1S("edit-clear"), KIconLoader::Toolbar); + clearHistory.setAttribute(QL1S("class"), QL1S("right")); m_root.document().findFirst(QL1S("#actions")).appendInside(clearHistory); HistoryTreeModel *model = rApp->historyManager()->historyTreeModel(); @@ -491,10 +495,11 @@ void NewTabPage::bookmarksPage() { m_root.addClass(QL1S("bookmarks")); - const QWebElement editBookmarks = createLinkItem(i18n("Edit Bookmarks"), - QL1S("about:bookmarks/edit"), - QL1S("bookmarks-organize"), - KIconLoader::Toolbar); + QWebElement editBookmarks = createLinkItem(i18n("Edit Bookmarks"), + QL1S("about:bookmarks/edit"), + QL1S("bookmarks-organize"), + KIconLoader::Toolbar); + editBookmarks.setAttribute(QL1S("class"), QL1S("right")); m_root.document().findFirst(QL1S("#actions")).appendInside(editBookmarks); KBookmarkGroup bookGroup = rApp->bookmarkManager()->rootGroup(); @@ -510,7 +515,7 @@ void NewTabPage::bookmarksPage() m_root.appendInside(markup(QL1S(".bookmarkfolder"))); QWebElement rootFolder = m_root.lastChild(); rootFolder.appendInside(markup(QL1S("h4"))); - rootFolder.lastChild().setPlainText(i18n("ROOT")); + rootFolder.lastChild().setPlainText(i18n("Unsorted")); while (!bookmark.isNull()) { @@ -546,8 +551,8 @@ void NewTabPage::closedTabsPage() prev.setAttribute(QL1S("id"), QL1S("preview") + QVariant(i).toString()); // hide controls - prev.findFirst(QL1S(".remove")).setStyleProperty(QL1S("visibility"), QL1S("hidden")); - prev.findFirst(QL1S(".reload")).setStyleProperty(QL1S("visibility"), QL1S("hidden")); + prev.findFirst(QL1S(".right")).setStyleProperty(QL1S("visibility"), QL1S("hidden")); + prev.findFirst(QL1S(".left")).setStyleProperty(QL1S("visibility"), QL1S("hidden")); m_root.appendInside(prev); } @@ -558,13 +563,15 @@ void NewTabPage::downloadsPage(const QString & filter) { m_root.addClass(QL1S("downloads")); - const QWebElement searchForm = createFormItem(i18n("Search Downloads"), QL1S("about:downloads/search")); + QWebElement searchForm = createFormItem(i18n("Search Downloads"), QL1S("about:downloads/search")); + searchForm.setAttribute(QL1S("class"), QL1S("left")); m_root.document().findFirst(QL1S("#actions")).appendInside(searchForm); - const QWebElement clearDownloads = createLinkItem(i18n("Clear Downloads"), - QL1S("about:downloads/clear"), - QL1S("edit-clear"), - KIconLoader::Toolbar); + QWebElement clearDownloads = createLinkItem(i18n("Clear Downloads"), + QL1S("about:downloads/clear"), + QL1S("edit-clear"), + KIconLoader::Toolbar); + clearDownloads.setAttribute(QL1S("class"), QL1S("right")); m_root.document().findFirst(QL1S("#actions")).appendInside(clearDownloads); DownloadList list = rApp->downloadManager()->downloads(); @@ -753,8 +760,8 @@ QWebElement NewTabPage::tabPreview(int winIndex, int tabIndex, const KUrl &url, setupTabPreview(prev, winIndex, tabIndex); - prev.findFirst(QL1S(".remove")).setStyleProperty(QL1S("visibility"), QL1S("visible")); - prev.findFirst(QL1S(".reload")).setStyleProperty(QL1S("visibility"), QL1S("hidden")); + prev.findFirst(QL1S(".right")).setStyleProperty(QL1S("visibility"), QL1S("visible")); + prev.findFirst(QL1S(".left")).setStyleProperty(QL1S("visibility"), QL1S("hidden")); return prev; } @@ -783,36 +790,37 @@ QWebElement NewTabPage::closedTabPreview(int index, const KUrl &url, const QStri void NewTabPage::setupPreview(QWebElement e, int index, bool showControls) { - e.findFirst(QL1S(".remove img")).setAttribute(QL1S("src"), + e.findFirst(QL1S(".right img")).setAttribute(QL1S("src"), QL1S("file:///") + KIconLoader::global()->iconPath("edit-delete", KIconLoader::DefaultState)); - e.findFirst(QL1S(".remove")).setAttribute(QL1S("title"), i18n("Remove favorite")); + e.findFirst(QL1S(".right")).setAttribute(QL1S("title"), i18n("Remove favorite")); - e.findFirst(QL1S(".reload img")).setAttribute(QL1S("src"), + e.findFirst(QL1S(".left img")).setAttribute(QL1S("src"), QL1S("file:///") + KIconLoader::global()->iconPath("view-refresh", KIconLoader::DefaultState)); - e.findFirst(QL1S(".reload")).setAttribute(QL1S("title"), i18n("Set new favorite")); + e.findFirst(QL1S(".left")).setAttribute(QL1S("title"), i18n("Set new favorite")); - e.findFirst(QL1S(".reload")).setAttribute(QL1S("href"), QL1S("about:preview/reload/") + QVariant(index).toString()); - e.findFirst(QL1S(".remove")).setAttribute(QL1S("href"), QL1S("about:preview/remove/") + QVariant(index).toString()); + e.findFirst(QL1S(".left")).setAttribute(QL1S("href"), QL1S("about:preview/reload/") + QVariant(index).toString()); + e.findFirst(QL1S(".right")).setAttribute(QL1S("href"), QL1S("about:preview/remove/") + QVariant(index).toString()); e.setAttribute(QL1S("id"), QL1S("preview") + QVariant(index).toString()); if (showControls) { - e.findFirst(QL1S(".remove")).setStyleProperty(QL1S("visibility"), QL1S("visible")); - e.findFirst(QL1S(".reload")).setStyleProperty(QL1S("visibility"), QL1S("visible")); + e.findFirst(QL1S(".right")).setStyleProperty(QL1S("visibility"), QL1S("visible")); + e.findFirst(QL1S(".left")).setStyleProperty(QL1S("visibility"), QL1S("visible")); } } void NewTabPage::setupTabPreview(QWebElement e, int winIndex, int tabIndex) { - e.findFirst(QL1S(".remove img")).setAttribute(QL1S("src"), QL1S("file:///") + KIconLoader::global()->iconPath("edit-delete", KIconLoader::DefaultState)); - e.findFirst(QL1S(".remove")).setAttribute(QL1S("title"), QL1S("Close Tab")); + e.findFirst(QL1S(".right img")).setAttribute(QL1S("src"), + QL1S("file:///") + KIconLoader::global()->iconPath("edit-delete", KIconLoader::DefaultState)); + e.findFirst(QL1S(".right")).setAttribute(QL1S("title"), QL1S("Close Tab")); QString href = QL1S("about:tabs/remove?win=") + QString::number(winIndex) + QL1S("&tab=") + QString::number(tabIndex); - e.findFirst(QL1S(".remove")).setAttribute(QL1S("href"), href); + e.findFirst(QL1S(".right")).setAttribute(QL1S("href"), href); e.setAttribute(QL1S("id"), QL1S("win") + QString::number(winIndex) + QL1S("tab") + QString::number(tabIndex)); } @@ -849,7 +857,7 @@ void NewTabPage::createBookmarkGroup(const KBookmark &bookmark, QWebElement pare { createBookmarkItem(bm, folder); bm = group.next(bm); - } + } } -- cgit v1.2.1