diff -r 735c7ea1d2a9 -r 4a84d7e444d8 mainwindow.cpp --- a/mainwindow.cpp Tue Jan 05 11:23:12 2010 +0000 +++ b/mainwindow.cpp Thu Jan 21 11:56:57 2010 +0000 @@ -211,9 +211,14 @@ // Status bar and progress bar there statusBar(); progressMax=0; - progressBar=new QProgressBar; - progressBar->hide(); - statusBar()->addPermanentWidget(progressBar); + progressCounter=0; + progressCounterTotal=0; + + progressDialog.setLabelText (tr("Loading maps","Mainwindow")); + progressDialog.setAutoReset(false); + progressDialog.setAutoClose(false); + //progressDialog.setWindowModality (Qt::WindowModal); // That forces mainwindo to update and slows down + //progressDialog.setCancelButton (NULL); restoreState (settings.value("/mainwindow/state",0).toByteArray()); @@ -250,7 +255,6 @@ delete textEditor; delete historyWindow; delete branchPropertyWindow; - delete progressBar; // Remove temporary directory removeDir (QDir(tmpVymDir)); @@ -267,6 +271,8 @@ QStringList flist=options.getFileList(); QStringList::Iterator it=flist.begin(); + progressCounter=flist.count(); + progressCounterTotal=flist.count(); while (it !=flist.end() ) { fileLoad (*it, NewMap); @@ -277,39 +283,46 @@ void Main::statusMessage(const QString &s) { - // Surpress messages while progressbar during + // Surpress messages while progressdialog during // load is active - if (progressMin==progressMax) + if (progressMax==0) statusBar()->message( s); } -void Main::setProgressMinimum (int min) +void Main::setProgressMaximum (int max) { - progressBar->setMinimum(min); - progressMin=min; + if (progressCounterTotal!=0) + + progressDialog.setRange (0,progressCounterTotal*1000); + else + progressDialog.setRange (0,max+10); + + progressDialog.setValue (0); + progressMax=max*1000; + //cout << "Main max="<setValue (v); -} - -void Main::removeProgressBar() -{ - if (progressMax>0) - statusBar()->removeWidget(progressBar); - progressMax=progressMin=0; + progressMax=0; + progressCounter--; + if (progressCounter<=0) + { + // Hide dialog again + progressCounterTotal=0; + progressDialog.reset(); + progressDialog.hide(); + } } void Main::closeEvent (QCloseEvent* ) @@ -745,6 +758,13 @@ editMenu->addAction (a); connect( a, SIGNAL( triggered() ), this, SLOT( editOpenFindWidget() ) ); + a = new QAction( tr( "Find duplicate URLs","Edit menu"), this); + //a->setStatusTip (tr( "Find" ) ); + a->setShortcut (Qt::SHIFT + Qt::Key_F); //Find duplicate URLs + if (settings.value( "/mainwindow/showTestMenu",false).toBool() ) + editMenu->addAction (a); + connect( a, SIGNAL( triggered() ), this, SLOT( editFindDuplicateURLs() ) ); + editMenu->addSeparator(); a = new QAction( QPixmap(flagsPath+"flag-url.png"), tr( "Open URL","Edit menu" ), this); @@ -762,9 +782,16 @@ connect( a, SIGNAL( triggered() ), this, SLOT( editOpenURLTab() ) ); actionOpenURLTab=a; + a = new QAction( tr( "Open all URLs in subtree (including scrolled branches)","Edit menu" ), this); + a->setStatusTip (tr( "Open all URLs in subtree (including scrolled branches)" )); + a->setShortcut ( Qt::CTRL + Qt::Key_U ); + addAction(a); + actionListBranches.append(a); + connect( a, SIGNAL( triggered() ), this, SLOT( editOpenMultipleVisURLTabs() ) ); + actionOpenMultipleVisURLTabs=a; + a = new QAction( tr( "Open all URLs in subtree","Edit menu" ), this); a->setStatusTip (tr( "Open all URLs in subtree" )); - a->setShortcut ( Qt::CTRL + Qt::Key_U ); addAction(a); actionListBranches.append(a); connect( a, SIGNAL( triggered() ), this, SLOT( editOpenMultipleURLTabs() ) ); @@ -805,7 +832,7 @@ connect( a, SIGNAL( triggered() ), this, SLOT( editBugzilla2URL() ) ); actionBugzilla2URL=a; - a = new QAction(tr( "Create URL to Novell Bugzilla","Edit menu" ), this); + a = new QAction(tr( "Get data from Novell Bugzilla","Edit menu" ), this); a->setStatusTip ( tr( "Get data from Novell Bugzilla" )); a->setEnabled (false); actionListBranches.append(a); @@ -1624,6 +1651,7 @@ branchLinksContextMenu=branchContextMenu->addMenu(tr("References (URLs, vymLinks, ...)","Context menu name")); branchLinksContextMenu->addAction ( actionOpenURL ); branchLinksContextMenu->addAction ( actionOpenURLTab ); + branchLinksContextMenu->addAction ( actionOpenMultipleVisURLTabs ); branchLinksContextMenu->addAction ( actionOpenMultipleURLTabs ); branchLinksContextMenu->addAction ( actionURL ); branchLinksContextMenu->addAction ( actionLocalURL ); @@ -1979,6 +2007,9 @@ lastFileDir=fd->directory().path(); QStringList flist = fd->selectedFiles(); QStringList::Iterator it = flist.begin(); + + progressCounter=flist.count(); + progressCounterTotal=flist.count(); while( it != flist.end() ) { fn = *it; @@ -2511,6 +2542,12 @@ if (m) m->emitShowFindWidget(); } +void Main::editFindDuplicateURLs() +{ + VymModel *m=currentModel(); + if (m) m->findDuplicateURLs(); +} + void Main::openTabs(QStringList urls) { if (!urls.isEmpty()) @@ -2518,8 +2555,15 @@ bool success=true; QStringList args; QString browser=settings.value("/mainwindow/readerURL" ).toString(); - if (*browserPID==0) //FIXME-2 need to check if browser is really still there instead of this + //qDebug ()<<"Services: "<registeredServiceNames().value(); + if (*browserPID==0 || + (browser.contains("konqueror") && + !QDBusConnection::sessionBus().interface()->registeredServiceNames().value().contains (QString("org.kde.konqueror-%1").arg(*browserPID))) + ) { + // Start a new browser, if there is not one running already or + // if a previously started konqueror is gone. + if (debug) cout <<"Main::openTabs no konqueror-"<<*browserPID<<" found\n"; QString u=urls.takeFirst(); args<getURLs(); + urls=m->getURLs(ignoreScrolled); openTabs (urls); } } +void Main::editOpenMultipleURLTabs() +{ + editOpenMultipleVisURLTabs (false); +} + void Main::editURL() { @@ -2662,6 +2712,23 @@ void Main::getBugzillaData() { VymModel *m=currentModel(); + /* + QProgressDialog progress ("Doing stuff","cancl",0,10,this); + progress.setWindowModality(Qt::WindowModal); + //progress.setCancelButton (NULL); + progress.show(); + progress.setMinimumDuration (0); + progress.setValue (1); + progress.setValue (5); + progress.update(); + */ + /* + QProgressBar *pb=new QProgressBar; + pb->setMinimum (0); + pb->setMaximum (0); + pb->show(); + pb->repaint(); + */ if (m) m->getBugzillaData(); } @@ -3334,19 +3401,17 @@ void Main::updateNoteFlag() { // this slot is connected to TextEditor::textHasChanged() - VymModel *m=currentModel(); if (m) m->updateNoteFlag(); } void Main::updateNoteEditor(QModelIndex index ) { - cout << QObject::sender(); - QObject *obj=QObject::sender(); - TreeItem *ti=((TreeModel*)obj)->getItem (index); - //TreeItem *ti=((VymModel*) QObject::sender())->getItem(index); - //cout << "Main::updateNoteEditor model="<getItem(index); + /* + cout << "Main::updateNoteEditor model="<setNote (ti->getNoteObj() ); } @@ -3676,6 +3741,34 @@ void Main::testFunction1() { + int max=100000; + QProgressDialog p ("testprogress","cancel",0,max,this); + p.setWindowModality (Qt::WindowModal); + p.setAutoReset (false); + p.setAutoClose (false); + p.show(); + for (int i=0;itestFunction1(); /*