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 118: dc187ef8ba36
parent 117: 1886407a6220
branch: 0.7-release
Commented out all qDebug lines in EditingWindow.cc, SysTrayIcon.cc, main.cc
Matthew Smith / IndigoJo
3 months ago

Changed (Δ7.3 KB):

raw changeset »

EditingWindow.cc (551 lines added, 646 lines removed)

SysTrayIcon.cc (4 lines added, 4 lines removed)

main.cc (1 lines added, 1 lines removed)

Up to file-list EditingWindow.cc:

@@ -175,7 +175,7 @@ EditingWindow::EditingWindow( bool noRef
175
175
    }
176
176
    else {
177
177
#ifndef NO_DEBUG_OUTPUT
178
      qDebug() << "Can't read the XML";
178
      // qDebug() << "Can't read the XML";
179
179
#endif
180
180
      accountsXmlFile.close();
181
181
      accountsElement = accountsDom.createElement( "QTMAccounts" );
@@ -183,7 +183,7 @@ EditingWindow::EditingWindow( bool noRef
183
183
      currentAccountElement.setAttribute( "id", "default" );
184
184
185
185
      if( !server.isEmpty() ) {
186
	qDebug() << "copying details to new default element";
186
	// qDebug() << "copying details to new default element";
187
187
	detailElem = accountsDom.createElement( "details" );
188
188
	nameElem = accountsDom.createElement( "title" );
189
189
	nameElem.appendChild( accountsDom.createTextNode( tr( "Default account" ) ) );
@@ -291,7 +291,7 @@ EditingWindow::EditingWindow( QString ne
291
291
    }
292
292
    else {
293
293
#ifndef NO_DEBUG_OUTPUT
294
      qDebug() << "Can't read the XML";
294
      // qDebug() << "Can't read the XML";
295
295
#endif
296
296
      accountsXmlFile.close();
297
297
      accountsElement = accountsDom.createElement( "QTMAccounts" );
@@ -299,7 +299,7 @@ EditingWindow::EditingWindow( QString ne
299
299
      currentAccountElement.setAttribute( "id", "default" );
300
300
301
301
      if( !server.isEmpty() ) {
302
	qDebug() << "copying details to new default element";
302
	// qDebug() << "copying details to new default element";
303
303
	detailElem = accountsDom.createElement( "details" );
304
304
	nameElem = accountsDom.createElement( "title" );
305
305
	nameElem.appendChild( accountsDom.createTextNode( tr( "Default account" ) ) );
@@ -490,8 +490,6 @@ void EditingWindow::doUiSetup()
490
490
	   this, SLOT( choose() ) );
491
491
  connect( ui.action_Save, SIGNAL( triggered( bool ) ),
492
492
	   this, SLOT( save() ) );
493
  connect( ui.action_Export, SIGNAL( triggered( bool ) ),
494
           this, SLOT( exportEntry() ) );
495
493
  connect( ui.actionSave_As, SIGNAL( triggered( bool ) ),
496
494
	   this, SLOT( saveAs() ) );
497
495
  connect( ui.action_Upload, SIGNAL( triggered( bool ) ),
@@ -593,8 +591,9 @@ void EditingWindow::doUiSetup()
593
591
	   this, SLOT( addClipTBPing() ) );
594
592
  connect( ui.actionRe_move_ping, SIGNAL( triggered( bool ) ),
595
593
	   this, SLOT( removeTBPing() ) );
594
596
595
  connect( ui.action_Blog_this, SIGNAL( triggered( bool ) ),
597
	   this, SLOT( newMTPost() ) );
596
	   this, SLOT( blogThis() ) );
598
597
  connect( ui.action_What_s_this, SIGNAL( triggered( bool ) ),
599
598
	   this, SLOT( doWhatsThis() ) );
600
599
@@ -608,8 +607,6 @@ void EditingWindow::doUiSetup()
608
607
  mainWindowLayout->setMargin( 5 );
609
608
  cw.setupUi( leftWidget );
610
609
611
  connect( cw.lwOtherCats, SIGNAL( itemSelectionChanged() ),
612
           this, SLOT( changeOtherCatsHeading() ) );
613
610
  cw.cbBlogSelector->setMaxVisibleItems( 10 );
614
611
  cw.cbMainCat->setMaxVisibleItems( 10 );
615
612
  cw.lwTags->addAction( ui.actionAdd_tag );
@@ -880,7 +877,7 @@ void EditingWindow::doQuit()
880
877
{
881
878
#ifndef NO_DEBUG_OUTPUT
882
879
  int i = QApplication::topLevelWidgets().size();
883
  qDebug() << i << " top level widgets";
880
  // qDebug() << i << " top level widgets";
884
881
#endif
885
882
886
883
  qApp->setQuitOnLastWindowClosed( true );
@@ -906,7 +903,7 @@ void EditingWindow::setInitialAccount()
906
903
{
907
904
    int i;
908
905
909
    qDebug() << "server is empty";
906
    // qDebug() << "server is empty";
910
907
    QSettings settings;
911
908
    lastAccountID = settings.value( "account/lastAccountID", "" ).toString();
912
909
    QDomNodeList accountsList = accountsDom.documentElement()
@@ -914,11 +911,10 @@ void EditingWindow::setInitialAccount()
914
911
    QDomElement thisTitleElem;
915
912
    cw.cbAccountSelector->clear();
916
913
917
    if( accountsList.count() == 1 &&
918
        accountsList.at( 0 ).firstChildElement( "details" ).isNull() ) {
914
    if( accountsList.count() == 1 ) {
919
915
      // This is if there is just one legacy account
920
916
      QDomElement detailElem, titleElem, serverElem, portElem, locElem,
921
                  loginElem, pwdElem;
917
	loginElem, pwdElem;
922
918
      detailElem = accountsDom.createElement( "details" );
923
919
      titleElem = accountsDom.createElement( "title" );
924
920
      titleElem.appendChild( accountsDom.createTextNode( tr( "Default account" ) ) );
@@ -927,8 +923,8 @@ void EditingWindow::setInitialAccount()
927
923
      locElem = accountsDom.createElement( "location" );
928
924
      locElem.appendChild( accountsDom.createTextNode( location ) );
929
925
      if( !port.isEmpty() ) {
930
        portElem = accountsDom.createElement( "port" );
931
        portElem.appendChild( accountsDom.createTextNode( port ) );
926
	portElem = accountsDom.createElement( "port" );
927
	portElem.appendChild( accountsDom.createTextNode( port ) );
932
928
      }
933
929
      loginElem = accountsDom.createElement( "login" );
934
930
      loginElem.appendChild( accountsDom.createTextNode( login ) );
@@ -937,7 +933,7 @@ void EditingWindow::setInitialAccount()
937
933
      detailElem.appendChild( titleElem );
938
934
      detailElem.appendChild( serverElem );
939
935
      if( !portElem.isNull() )
940
        detailElem.appendChild( portElem );
936
	detailElem.appendChild( portElem );
941
937
      detailElem.appendChild( locElem );
942
938
      detailElem.appendChild( loginElem );
943
939
      detailElem.appendChild( pwdElem );
@@ -947,39 +943,39 @@ void EditingWindow::setInitialAccount()
947
943
948
944
    for( i = 0; i < accountsList.count(); i++ ) {
949
945
      thisTitleElem = accountsList.at( i ).toElement().firstChildElement( "details" )
950
        .firstChildElement( "title" );
946
	.firstChildElement( "title" );
951
947
      if( !thisTitleElem.isNull() )
952
        cw.cbAccountSelector->addItem( thisTitleElem.text(),
953
                                       accountsList.at( i ).toElement().attribute( "id" ) );
954
      else
955
        cw.cbAccountSelector->addItem( tr( "Unnamed account" ),
956
                                       accountsList.at( i ).toElement().attribute( "id" ).isEmpty() ?
957
                                       QString( "noid_%1" ).arg( i ) :
958
                                       accountsList.at( i ).toElement().attribute( "id" ) );
959
    }
960
961
    qDebug() << "checking for last account ID";
948
	cw.cbAccountSelector->addItem( thisTitleElem.text(),
949
				       accountsList.at( i ).toElement().attribute( "id" ) );
950
      else
951
	cw.cbAccountSelector->addItem( tr( "Unnamed account" ),
952
				       accountsList.at( i ).toElement().attribute( "id" ).isEmpty() ?
953
				       QString( "noid_%1" ).arg( i ) :
954
				       accountsList.at( i ).toElement().attribute( "id" ) );
955
    }
956
957
    // qDebug() << "checking for last account ID";
962
958
    for( i = 0; i < accountsList.count(); i++ ) {
963
959
      if( accountsList.at( i ).toElement().attribute( "id" ) == lastAccountID ) {
964
        qDebug() << "found it";
965
        currentAccountElement = accountsList.at( i ).toElement();
966
        currentAccountId = currentAccountElement.attribute( "id" );
967
        cw.cbAccountSelector->setCurrentIndex( i );
960
	// qDebug() << "found it";
961
	currentAccountElement = accountsList.at( i ).toElement();
962
	currentAccountId = currentAccountElement.attribute( "id" );
963
	cw.cbAccountSelector->setCurrentIndex( i );
968
964
        extractAccountDetails();
969
        populateBlogList();
970
        connect( cw.cbAccountSelector, SIGNAL( activated( int ) ),
971
                 this, SLOT( changeAccount( int ) ) );
972
        break;
965
	populateBlogList();
966
	connect( cw.cbAccountSelector, SIGNAL( activated( int ) ),
967
		 this, SLOT( changeAccount( int ) ) );
968
	break;
973
969
      }
974
970
      // If it reaches the end of the loop with no joy
975
971
      if( i == accountsList.count()-1 ) {
976
        qDebug() << "using first account";
977
        currentAccountElement = accountsDom.documentElement()
978
          .firstChildElement( "account" );
972
	// qDebug() << "using first account";
973
	currentAccountElement = accountsDom.documentElement()
974
	  .firstChildElement( "account" );
979
975
        extractAccountDetails();
980
        populateBlogList();
981
        connect( cw.cbAccountSelector, SIGNAL( activated( int ) ),
982
                 this, SLOT( changeAccount( int ) ) );
976
	populateBlogList();
977
	connect( cw.cbAccountSelector, SIGNAL( activated( int ) ),
978
		 this, SLOT( changeAccount( int ) ) );
983
979
      }
984
980
    }
985
981
}
@@ -1082,14 +1078,12 @@ void EditingWindow::updateRecentFileMenu
1082
1078
      if( j == 9 )
1083
1079
        text = tr( "1&0 %1" )
1084
1080
 	.arg( recentFiles.value( j ).title.isEmpty() ?
1085
	      recentFiles.value( j ).filename.section( "/", -1, -1 ) 
1086
	      : t.replace( '&', "&&" ) );
1081
	      recentFiles.value( j ).filename.section( "/", -1, -1 ) : t );
1087
1082
      else
1088
1083
        text  = tr("&%1 %2" )
1089
1084
	  .arg( j + 1 )
1090
1085
	  .arg( recentFiles.value( j ).title.isEmpty() ?
1091
	        recentFiles.value( j ).filename.section( "/", -1, -1 ) 
1092
		: t.replace( '&', "&&" ) );
1086
	        recentFiles.value( j ).filename.section( "/", -1, -1 ) : t );
1093
1087
      recentFileActions[j]->setText( text );
1094
1088
      recentFileActions[j]->setData( recentFiles.value( j ).filename );
1095
1089
      recentFileActions[j]->setVisible( true );
@@ -1143,7 +1137,7 @@ void EditingWindow::callRefreshCategorie
1143
1137
#endif
1144
1138
  }
1145
1139
#ifndef NO_DEBUG_OUTPUT
1146
  qDebug() << "Finishing changeblog";
1140
  // qDebug() << "Finishing changeblog";
1147
1141
#endif
1148
1142
}
1149
1143
@@ -1159,7 +1153,7 @@ void EditingWindow::refreshCategories()
1159
1153
    methodCall.appendChild( XmlMethodName( doc, "mt.getCategoryList" ) );
1160
1154
1161
1155
    QDomElement params = doc.createElement( "params" );
1162
    params.appendChild( XmlValue( doc, "string", currentBlogid ) );
1156
    params.appendChild( XmlValue( doc, "string", cw.cbBlogSelector->itemData( cw.cbBlogSelector->currentIndex() ).toString() ) );
1163
1157
    params.appendChild( XmlValue( doc, "string", currentAccountElement.firstChildElement( "details" )
1164
1158
                                                 .firstChildElement( "login" ).text() ) );
1165
1159
    params.appendChild( XmlValue( doc, "string", currentAccountElement.firstChildElement( "details" )
@@ -1209,11 +1203,10 @@ void EditingWindow::getAccounts()
1209
1203
  QDomNodeList accountsList, thisAccountsAttribs;
1210
1204
  QDomDocument newAccountsDom;
1211
1205
  QDomElement newQTMAccounts, newAccount, detailElement, nameElement, serverElement, locationElement, 
1212
    portElement, loginElement, pwdElement, blogsElement, boolElement, attribsElement, hbtElement;
1206
    portElement, loginElement, pwdElement, blogsElement, boolElement, attribsElement;
1213
1207
  QString oldCurrentAccountId, oldBlogid, currentTitle;
1214
1208
  QStringList thisAccountsAttribStrings;
1215
  int i, j;
1216
  bool ok;
1209
  int c, i, j;
1217
1210
1218
1211
  // Extract accounts list from account tree
1219
1212
  accountsList = accountsDom.elementsByTagName( "account" );
@@ -1228,11 +1221,6 @@ void EditingWindow::getAccounts()
1228
1221
    acct.login = detailElement.firstChildElement( "login" ).text();
1229
1222
    acct.password = detailElement.firstChildElement( "password" ).text();
1230
1223
1231
    acct.hostedBlogType = 0;
1232
    int hbt = detailElement.firstChildElement( "hostedBlogType" ).text().toInt( &ok );
1233
    if( ok )
1234
      acct.hostedBlogType = hbt;
1235
	  
1236
1224
    acct.categoriesEnabled = false;
1237
1225
    acct.postDateTime = false;
1238
1226
    acct.comments = false;
@@ -1278,8 +1266,6 @@ void EditingWindow::getAccounts()
1278
1266
      detailElement = newAccountsDom.createElement( "details" );
1279
1267
      nameElement = newAccountsDom.createElement( "title" );
1280
1268
      nameElement.appendChild( newAccountsDom.createTextNode( returnedAccountsList.at( i ).name ) );
1281
      hbtElement = newAccountsDom.createElement( "hostedBlogType" );
1282
      hbtElement.appendChild( newAccountsDom.createTextNode( QString::number( returnedAccountsList.at( i ).hostedBlogType ) ) );
1283
1269
      serverElement = newAccountsDom.createElement( "server" );
1284
1270
      serverElement.appendChild( newAccountsDom.createTextNode( returnedAccountsList.at( i ).server ) );
1285
1271
      locationElement = newAccountsDom.createElement( "location" );
@@ -1292,7 +1278,6 @@ void EditingWindow::getAccounts()
1292
1278
      pwdElement.appendChild( newAccountsDom.createTextNode( returnedAccountsList.at( i ).password ) );
1293
1279
1294
1280
      detailElement.appendChild( nameElement );
1295
      detailElement.appendChild( hbtElement );
1296
1281
      detailElement.appendChild( serverElement );
1297
1282
      detailElement.appendChild( locationElement );
1298
1283
      detailElement.appendChild( portElement );
@@ -1314,13 +1299,13 @@ void EditingWindow::getAccounts()
1314
1299
	attribsElement.appendChild( boolElement );
1315
1300
      }
1316
1301
      if( returnedAccountsList.at( i ).comments ) {
1317
	qDebug() << "comments attribute set";
1302
	// qDebug() << "comments attribute set";
1318
1303
	boolElement = newAccountsDom.createElement( "attribute" );
1319
1304
	boolElement.setAttribute( "name", "comments" );
1320
1305
	attribsElement.appendChild( boolElement );
1321
1306
      }
1322
1307
      if( returnedAccountsList.at( i ).trackback ) {
1323
	qDebug() << "TB attribute set";
1308
	// qDebug() << "TB attribute set";
1324
1309
	boolElement = newAccountsDom.createElement( "attribute" );
1325
1310
	boolElement.setAttribute( "name", "trackback" );
1326
1311
	attribsElement.appendChild( boolElement );
@@ -1375,11 +1360,11 @@ void EditingWindow::getAccounts()
1375
1360
1376
1361
	// Now check if the current account has any blogs
1377
1362
	if( !currentAccountElement.firstChildElement( "blogs" ).isNull() ) {
1378
	  qDebug() << "blogs found";
1363
	  // qDebug() << "blogs found";
1379
1364
	  populateBlogList();
1380
1365
	}
1381
1366
	else {
1382
	  qDebug() << "no blogs found";
1367
	  // qDebug() << "no blogs found";
1383
1368
	  refreshBlogList();
1384
1369
	}
1385
1370
	break;
@@ -1397,6 +1382,7 @@ void EditingWindow::getAccounts()
1397
1382
1398
1383
void EditingWindow::getPreferences()