145 WebPageController::WebPageController ( QObject* parent ) : |
145 WebPageController::WebPageController ( QObject* parent ) : |
146 QObject ( parent ), |
146 QObject ( parent ), |
147 m_networkError (false), |
147 m_networkError (false), |
148 m_networkErrorMsg("No network error"), |
148 m_networkErrorMsg("No network error"), |
149 m_networkErrorUrl("No Url"), |
149 m_networkErrorUrl("No Url"), |
|
150 m_bErrorUrlMatches(false), |
150 m_promptMsg("No message"), |
151 m_promptMsg("No message"), |
151 m_promptReserved(""), |
152 m_promptReserved(""), |
152 m_memoryHandler(new LowMemoryHandler(this)), |
153 m_memoryHandler(new LowMemoryHandler(this)), |
153 d(new WebPageControllerPrivate(this)), |
154 d(new WebPageControllerPrivate(this)), |
154 m_settingsLoaded(0), |
155 m_settingsLoaded(0) |
155 m_bErrorUrlMatches(false) |
|
156 { |
156 { |
157 // Register a new MetaType WebPageData. It is needed to serialize history (starage) |
157 // Register a new MetaType WebPageData. It is needed to serialize history (starage) |
158 qRegisterMetaTypeStreamOperators<WebPageData> ("WebPageData"); |
158 qRegisterMetaTypeStreamOperators<WebPageData> ("WebPageData"); |
159 |
159 |
160 d->m_historyDir = BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->valueAsString("DataBaseDirectory"); |
160 d->m_historyDir = BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->valueAsString("DataBaseDirectory"); |
455 void WebPageController::onLoadFinishedForBackgroundWindow(bool ok) |
455 void WebPageController::onLoadFinishedForBackgroundWindow(bool ok) |
456 { |
456 { |
457 if (!ok) |
457 if (!ok) |
458 return; |
458 return; |
459 WRT::WrtBrowserContainer* page = qobject_cast<WRT::WrtBrowserContainer*> (sender()); |
459 WRT::WrtBrowserContainer* page = qobject_cast<WRT::WrtBrowserContainer*> (sender()); |
460 if (page) |
460 if (page){ |
461 page->setUpdateThumbnail(true); |
461 page->setUpdateThumbnail(true); |
|
462 // Current page is handled in onLoadFinished() so skip this case here |
|
463 if(page != currentPage()){ |
|
464 BookmarksManager::getSingleton()->addHistory(page->mainFrame()->url().toString(), page->pageTitle()); |
|
465 emit (loadFinishedForBackgroundWindow(true,page)); |
|
466 } |
|
467 } |
462 } |
468 } |
463 |
469 |
464 void WebPageController::updateHistory() |
470 void WebPageController::updateHistory() |
465 { |
471 { |
466 BookmarksManager::getSingleton()->addHistory(currentDocUrl(), currentDocTitle()); |
472 BookmarksManager::getSingleton()->addHistory(currentDocUrl(), currentDocTitle()); |
949 currentLoad(startPagePath); |
955 currentLoad(startPagePath); |
950 } |
956 } |
951 |
957 |
952 void WebPageController::loadInitialUrlFromOtherApp(QString url) |
958 void WebPageController::loadInitialUrlFromOtherApp(QString url) |
953 { |
959 { |
954 m_bRestoreSession = FALSE; |
960 m_bRestoreSession = false; |
955 currentLoad(url); |
961 |
|
962 // open in current window |
|
963 currentLoad(guessUrlFromString(url)); |
956 } |
964 } |
957 |
965 |
958 void WebPageController::loadFromHistory() |
966 void WebPageController::loadFromHistory() |
959 { |
967 { |
960 |
|
961 int count = historyWindowCount(); |
968 int count = historyWindowCount(); |
962 |
969 |
963 if(!count) |
970 if(!count) |
964 { |
971 { |
965 m_bRestoreSession = FALSE; |
972 m_bRestoreSession = FALSE; |
966 loadLocalFile(); // load start page for first startup of the browser |
973 loadLocalFile(); // load start page for first startup of the browser |
967 } |
974 } |
1670 emitted to indicate load progress of the current page |
1677 emitted to indicate load progress of the current page |
1671 \a ok indicates whether load was successful |
1678 \a ok indicates whether load was successful |
1672 */ |
1679 */ |
1673 |
1680 |
1674 /*! |
1681 /*! |
|
1682 \fn void WebPageController::void loadFinishedForBackgroundWindow(const bool ok, WRT::WrtBrowserContainer *page); |
|
1683 emitted to indicate load progress of the page in the background window |
|
1684 \a ok indicates whether load was successful |
|
1685 \a page is the background page that completed loading |
|
1686 */ |
|
1687 |
|
1688 /*! |
1675 \fn void WebPageController::currentPageIconChanged(); |
1689 \fn void WebPageController::currentPageIconChanged(); |
1676 emitted when the favicon of the current page has changed |
1690 emitted when the favicon of the current page has changed |
1677 */ |
1691 */ |
1678 |
1692 |
1679 /*! |
1693 /*! |