IndigoJo / qtm (http://qtm.blogistan.co.uk/)


A repository for the QTM blogging software
Clone URL : http://bitbucket.org/IndigoJo/qtm/ (size: 404.9 KB)
commit 104: e59041a33ad0
parent 103: 01c39ea18aad
branch: default
Fixes wrong changing of sole account name when window opened EditingWindow.cc - When testing for only one account, test for only legacy account (i.e. no details element); treat it as legacy only then, so that the name of a sole account is preserved.
Matthew Smith / IndigoJo
3 months ago

Changed (Δ2.1 KB):

raw changeset »

EditingWindow.cc (7 lines added, 1 lines removed)

SysTrayIcon.cc (2 lines added, 55 lines removed)

Up to file-list EditingWindow.cc:

@@ -913,7 +913,8 @@ void EditingWindow::setInitialAccount()
913
913
    QDomElement thisTitleElem;
914
914
    cw.cbAccountSelector->clear();
915
915
916
    if( accountsList.count() == 1 ) {
916
    if( accountsList.count() == 1 &&
917
	accountsList.at( 0 ).firstChildElement( "details" ).isNull() ) {
917
918
      // This is if there is just one legacy account
918
919
      QDomElement detailElem, titleElem, serverElem, portElem, locElem,
919
920
	loginElem, pwdElem;
@@ -1928,6 +1929,11 @@ void EditingWindow::blogger_getUsersBlog
1928
1929
				 "because you supplied a wrong file name "
1929
1930
				 "or password." ) );
1930
1931
      addToConsole( QString( "%1\n" ).arg( fstring ) );
1932
      cw.cbBlogSelector->setEnabled( false );
1933
      cw.cbMainCat->setEnabled( false );
1934
      cw.cbMainCat->clear();
1935
      cw.lwOtherCats->setEnabled( false );
1936
      cw.lwOtherCats->clear();
1931
1937
    }
1932
1938
  }
1933
1939
  else {

Up to file-list SysTrayIcon.cc:

@@ -96,8 +96,6 @@ SysTrayIcon::SysTrayIcon( bool noWindow,
96
96
  settings.endGroup();
97
97
98
98
#ifndef DONT_USE_DBUS
99
  /*  dbus = new QDbusConnection( "qtm" );
100
  dbus = connectToBus( QDBusConnection::ActivationBus, "qtm" );*/
101
99
  new DBusAdaptor( this );
102
100
  QDBusConnection::sessionBus().registerObject( "/MainApplication", this );
103
101
  QDBusConnection::sessionBus().registerService( "uk.co.blogistan.catkin" );
@@ -134,8 +132,6 @@ SysTrayIcon::SysTrayIcon( bool noWindow,
134
132
  configureTemplates = new QAction( tr( "&Configure ..." ), 0 );
135
133
  connect( configureTemplates, SIGNAL( triggered( bool ) ),
136
134
	   this, SLOT( configureQuickpostTemplates() ) );
137
  // templateMenu->addAction( configureTemplates );
138
  // configureTemplates->setMenu( templateMenu );
139
135
  configureTemplates->setObjectName( "QTM Configure Templates" );
140
136
  setupQuickpostTemplates();
141
137
  menu->addAction( newWindowAtStartup );
@@ -175,8 +171,6 @@ SysTrayIcon::SysTrayIcon( bool noWindow,
175
171
  connect( this, SIGNAL( activated( QSystemTrayIcon::ActivationReason ) ),
176
172
	   this, SLOT( iconActivated( QSystemTrayIcon::ActivationReason ) ) );
177
173
#endif
178
  /*connect( http, SIGNAL( done( bool ) ),
179
    this, SLOT( handleDone( bool ) ) ); */
180
174
181
175
  if( handleArguments() )
182
176
    noNewWindow = true;
@@ -215,10 +209,7 @@ bool SysTrayIcon::handleArguments()
215
209
      rv = true;
216
210
    }
217
211
    else {
218
      /*QMessageBox::showMessage( 0, QObject::tr( "Error" ),
219
				QObject::tr( "Could not load %1." ).arg( args.at( i ) ),
220
				QMessageBox::Cancel, QMessageBox::NoButton ); */
221
				failedFiles.append( args.at( i ) );
212
      failedFiles.append( args.at( i ) );
222
213
    }
223
214
  }
224
215
  if( failedFiles.size() ) {
@@ -371,14 +362,6 @@ void SysTrayIcon::choose( QString fname
371
362
372
363
  QString extn( QString( "%1 (*.%2)" ).arg( tr( "Blog entries" ) )
373
364
		.arg( localStorageFileExtn ) );
374
  /*  QFileDialog *fd = new QFileDialog;
375
  fd->setFileMode( QFileDialog::AnyFile );
376
  fd->setAcceptMode( QFileDialog::AcceptOpen );
377
  fd->setWindowTitle( tr( "Choose a file to open" ) );
378
  fd->setFilter( extn );
379
  if( fd->exec() ) {
380
    filesSelected = fd->selectedFiles();
381
    fn = filesSelected[0];*/
382
365
  
383
366
  if( fname.isEmpty() )
384
367
    fn = QFileDialog::getOpenFileName( 0, tr( "Choose a file to open" ),
@@ -389,8 +372,6 @@ void SysTrayIcon::choose( QString fname
389
372
  if( !fn.isEmpty() ) {
390
373
    EditingWindow *e = new EditingWindow( true );
391
374
    if( !e->load( fn, true ) ) {
392
      /*      e->show();
393
	      else { */
394
375
#ifdef Q_WS_MAC
395
376
      QMessageBox::warning( 0, "QTM",
396
377
			    tr( "Could not load the file you specified." ),
@@ -432,16 +413,9 @@ void SysTrayIcon::quickpost( QClipboard:
432
413
void SysTrayIcon::quickpost( QClipboard::Mode mode )
433
414
{
434
415
  int i, j;
435
  //QListIterator i;
436
  //QStringListIterator j;
437
416
  bool qpt = false;
438
417
  QRegExp regExp;
439
418
440
  /*#if QT_VERSION >= 0x040300 && !defined DONT_USE_SSL
441
  QRegExp httpRegExp( "^(http|https):\\/\\/" );
442
#else
443
  QRegExp httpRegExp( "^http:\\/\\/" );
444
#endif */
445
419
  cbtext = QApplication::clipboard()->text( mode );
446
420
447
421
  if( cbtext == "" )
@@ -454,7 +428,7 @@ void SysTrayIcon::quickpost( QClipboard:
454
428
	&& !cbtext.startsWith( "https://" )
455
429
#endif
456
430
	) {
457
      //qDebug( "doesn't match" );
431
458
432
      // If it's not obviously an URL.
459
433
      if( cbtext.startsWith( "https" ) ) {
460
434
	if( supportsMessages() )
@@ -479,17 +453,12 @@ void SysTrayIcon::quickpost( QClipboard:
479
453
      // Otherwise, it's an URL, and has to be downloaded to extract the title.
480
454
	if( !httpBusy ) {
481
455
	  if( assocHostLists.count() ) {
482
	    // i = QListIterator( assocHostLists );
483
	    //while( i.hasNext() ) {
484
456
	    for( i = 0; i < assocHostLists.count(); ++i ) {
485
457
	      if( assocHostLists.at( i ).count() ) {
486
458
		for( j = 0; j < assocHostLists.at( i ).count(); j++ ) {
487
		  //qDebug() << "Trying " << assocHostLists.at( i ).at( j )
488
		  //  .toAscii().data();
489
459
		  if( (!assocHostLists.at( i ).at( j ).isEmpty()) &&
490
460
		      cbtext.contains( QRegExp( QString( "[/\\.]%1[/\\.]" )
491
461
						.arg( assocHostLists.at( i ).at( j ) ) ) ) ) {
492
		    //qDebug() << "Match: " << cbtext;
493
462
		    qpt = true;
494
463
		    quickpostFromTemplate( i, 
495
464
					   quickpostTemplateActions.value( i )->postTemplate(),
@@ -592,7 +561,6 @@ void SysTrayIcon::quickpostFromTemplate(
592
561
      connect( http, SIGNAL( hostLookupFailed() ),
593
562
	       this, SLOT( handleHostLookupFailed() ) );
594
563
    }
595
    // cbtext = templateString.replace( "%url%", cbtext );
596
564
  }
597
565
}
598
566
@@ -603,12 +571,9 @@ void SysTrayIcon::quickpostFromDBus( QSt
603
571
  for( i = 0; i < assocHostLists.count(); ++i ) {
604
572
    if( assocHostLists.at( i ).count() ) {
605
573
      for( j = 0; j < assocHostLists.at( i ).count(); j++ ) {
606
        //qDebug() << "Trying " << assocHostLists.at( i ).at( j )
607
        //  .toAscii().data();
608
574
        if( (!assocHostLists.at( i ).at( j ).isEmpty()) &&
609
575
            url.contains( QRegExp( QString( "[/\\.]%1[/\\.]" )
610
576
                                   .arg( assocHostLists.at( i ).at( j ) ) ) ) ) {
611
          //qDebug() << "Match: " << cbtext;
612
577
          activeTemplate = i;
613
578
          break;
614
579
        }
@@ -724,21 +689,6 @@ void SysTrayIcon::doQuit()
724
689
  }
725
690
726
691
}
727
//QCoreApplication::quit(); */
728
729
/*
730
#ifdef Q_WS_MAC
731
  if( QApplication::topLevelWidgets().isEmpty() ) {
732
    QCoreApplication::quit();
733
  } else {
734
    connect( qApp, SIGNAL( lastWindowClosed() ), qApp, SLOT( quit() ) );
735
    qApp->closeAllWindows();
736
  }
737
#else
738
  connect( qApp, SIGNAL( lastWindowClosed() ), qApp, SLOT( quit() ) );
739
  qApp->closeAllWindows();
740
#endif
741
} */
742
692
743
693
void SysTrayIcon::doQP( QString receivedText )
744
694
{
@@ -957,9 +907,6 @@ void SysTrayIcon::configureQuickpostTemp
957
907
  QString templateFile;
958
908
  QSettings settings;
959
909
960
  /*  QList<QString> titles, templateStrings;
961
      QStringListModel *titlesModel;*/
962
963
910
  QuickpostTemplateDialog templateDialog( templateTitleList, templateList,
964
911
					  defaultPublishStatusList, copyTitleStatusList,
965
912
					  assocHostLists, _copyTitle, parent );