Ticket #3375: mythbrowser-2-completed_loading.diff
File mythbrowser-2-completed_loading.diff, 5.7 KB (added by , 17 years ago) |
---|
-
mythbrowser/webpage.h
38 38 void newUrlRequested(const KURL &url, const KParts::URLArgs &args); 39 39 void newWindowRequested(const KURL &, const KParts::URLArgs &, 40 40 const KParts::WindowArgs &, KParts::ReadOnlyPart *&); 41 void pageCompleted(WebPage *page); 42 41 43 private: 42 44 QString sUrl; 43 45 }; -
mythbrowser/tabview.cpp
38 38 #include "mythtv/mythdbcon.h" 39 39 #include "mythtv/mythwidgets.h" 40 40 41 #define LOADING "Loading..." 42 41 43 using namespace std; 42 44 43 45 TabView::TabView(MythMainWindow *parent, const char *name, QStringList urls, … … 83 85 const KParts::WindowArgs &, KParts::ReadOnlyPart *&) ), 84 86 this, SLOT( newWindowRequested( const KURL &, const KParts::URLArgs &, 85 87 const KParts::WindowArgs &, KParts::ReadOnlyPart *&) ) ); 88 connect(page, SIGNAL( pageCompleted(WebPage *) ), 89 this, SLOT( pageCompleted(WebPage *) ) ); 90 91 mytab->addTab(page,LOADING); 86 92 87 88 mytab->addTab(page,*it);89 90 93 /* moved this into show event processing 91 94 // Hide Scrollbars - Why doesn't this work??? TSH 1/20/04 92 95 if (hideScrollbars) { … … 116 119 { 117 120 } 118 121 122 void TabView::pageCompleted(WebPage *page) 123 { 124 // Strip leading and trailing whitespace from page title 125 QString title = 126 page->browser->htmlDocument().title().string().stripWhiteSpace(); 127 128 if (title.isEmpty()) 129 { 130 // Title empty, use pretty form of url, 131 // removes passwords and usernames 132 mytab->setTabLabel(page, 133 page->browser->toplevelURL().prettyURL(-1)); 134 } 135 else 136 { 137 // Title defined, set tab text to title 138 // compress multiple whitespace 139 mytab->setTabLabel(page, 140 title.replace( QRegExp("\\s+"), " ") ); 141 } 142 } 143 119 144 void TabView::openMenu() 120 145 { 121 146 QButton *temp; … … 399 424 const KParts::WindowArgs &, KParts::ReadOnlyPart *&) ), 400 425 this, SLOT( newWindowRequested( const KURL &, const KParts::URLArgs &, 401 426 const KParts::WindowArgs &, KParts::ReadOnlyPart *&) ) ); 427 connect(page, SIGNAL( pageCompleted(WebPage *) ), 428 this, SLOT( pageCompleted(WebPage *) ) ); 402 429 403 mytab->insertTab(page, sURL, index);430 mytab->insertTab(page,LOADING, index); 404 431 mytab->setCurrentPage(index); 405 432 406 433 QPtrStack<QWidget> *currWidgetHistory = new QPtrStack<QWidget>; … … 422 449 // if the tab title is blank then a new blank web page has already been 423 450 // created for a popup window just need to open the URL 424 451 ((WebPage*)mytab->currentPage())->openURL(url.url()); 425 mytab->setTabLabel(mytab->currentPage(), url.url()); 452 mytab->setTabLabel(mytab->currentPage(), LOADING); 453 connect( ((WebPage*)mytab->currentPage()), SIGNAL( pageCompleted(WebPage *) ), 454 this, SLOT( pageCompleted(WebPage *) ) ); 426 455 } 427 456 else 428 457 { … … 435 464 436 465 WebPage *page = new WebPage(url.url(),args,((WebPage*)curr)->zoomFactor,f); 437 466 438 mytab->insertTab(page, url.url(),index);467 mytab->insertTab(page,LOADING,index); 439 468 mytab->removePage(curr); 440 469 mytab->setCurrentPage(index); 441 470 … … 446 475 const KParts::WindowArgs &, KParts::ReadOnlyPart *&) ), 447 476 this, SLOT( newWindowRequested( const KURL &, const KParts::URLArgs &, 448 477 const KParts::WindowArgs &, KParts::ReadOnlyPart *&) ) ); 478 connect( page, SIGNAL( pageCompleted(WebPage *) ), 479 this, SLOT( pageCompleted(WebPage *) ) ); 449 480 } 450 481 } 451 482 -
mythbrowser/tabview.h
40 40 void newWindowRequested(const KURL &url, const KParts::URLArgs &args, 41 41 const KParts::WindowArgs &windowArgs, 42 42 KParts::ReadOnlyPart *&part); 43 44 43 private slots: 45 44 void openMenu(); 46 45 void actionBack(); … … 56 55 57 56 // new URL dialog 58 57 void showEnterURLDialog(); 58 59 // Use page title for tabLabel 60 void pageCompleted(WebPage *page); 59 61 60 62 private: 61 63 int z,w,h; -
mythbrowser/webpage.cpp
41 41 #include <khtmlview.h> 42 42 #include <kio/jobclasses.h> 43 43 44 45 44 using namespace std; 46 45 47 46 WebPage::WebPage (const char *location, int zoom, WFlags flags) : QWidget(NULL,NULL,flags) … … 68 67 this,SLOT(started(KIO::Job*))); 69 68 connect( browser,SIGNAL(completed()), 70 69 this,SLOT(completed())); 70 connect( browser,SIGNAL(completed(bool)), 71 this,SLOT(completed())); 71 72 72 73 browser->setStandardFont("Arial"); 73 74 … … 109 110 this,SLOT(started(KIO::Job*))); 110 111 connect( browser,SIGNAL(completed()), 111 112 this,SLOT(completed())); 113 connect( browser,SIGNAL(completed(bool)), 114 this,SLOT(completed())); 112 115 113 116 browser->setStandardFont("Arial"); 114 117 browser->browserExtension()->setURLArgs(args); … … 206 209 } 207 210 208 211 setFocus(); 212 213 emit pageCompleted( this ); 209 214 } 210 215 211 216 void WebPage::timerTimeout()