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 103: | 01c39ea18aad |
| parent 102: | 03145eb3c6d3 |
| branch: | default |
Now remembers setting of Hosted Blog Type combo
AccountsForm.ui - New entry 'None' in cbHostedBlogType
AccountsDialog.h - New int 'hostedBlogType' in Account struct
AccountsDialog.cc - Now remembers cbHostedBlogType setting and returns it to the editing window
EditingWindow.cc - Now saves the hosted blog type in the main DOM.
Changed (Δ923 bytes):
raw changeset »
AccountsDialog.cc (20 lines added, 13 lines removed)
AccountsDialog.h (1 lines added, 0 lines removed)
AccountsForm.ui (5 lines added, 0 lines removed)
EditingWindow.cc (10 lines added, 1 lines removed)
Up to file-list AccountsDialog.cc:
| … | … | @@ -135,6 +135,9 @@ void AccountsDialog::changeListIndex( in |
135 |
135 |
lePort->setText( accountList[currentRow].port ); |
136 |
136 |
leLogin->setText( accountList[currentRow].login ); |
137 |
137 |
lePassword->setText( accountList[currentRow].password ); |
138 |
||
139 |
if( accountList[currentRow].hostedBlogType != -1 ) |
|
140 |
cbHostedBlogType->setCurrentIndex( accountList[currentRow].hostedBlogType ); |
|
138 |
141 |
|
139 |
142 |
chCategoriesEnabled->setCheckState( accountList[currentRow].categoriesEnabled ? |
140 |
143 |
Qt::Checked : Qt::Unchecked ); |
| … | … | @@ -287,7 +290,7 @@ void AccountsDialog::on_leBlogURI_return |
287 |
290 |
return; |
288 |
291 |
} |
289 |
292 |
|
290 |
|
|
293 |
//bool found = false; |
|
291 |
294 |
// QStringList hostedAccountStrings, hostedAccountServers, hostedAccountLocations; |
292 |
295 |
QStringList wpmuHosts; |
293 |
296 |
wpmuHosts << "wordpress.com" << "blogsome.com" << "blogs.ie" |
| … | … | @@ -334,10 +337,10 @@ void AccountsDialog::on_leBlogURI_return |
334 |
337 |
} |
335 |
338 |
|
336 |
339 |
// Is this a self-hosted Wordpress, Textpattern or Drupal site? |
337 |
if( cbHostedBlogType->currentIndex() >= 4 && |
|
338 |
cbHostedBlogType->currentIndex() <= 6 ) { |
|
340 |
if( cbHostedBlogType->currentIndex() >= 5 && |
|
341 |
cbHostedBlogType->currentIndex() <= 7 ) { |
|
339 |
342 |
QString endpoint; |
340 |
if( cbHostedBlogType->currentIndex() == |
|
343 |
if( cbHostedBlogType->currentIndex() == 7 ) // i.e. Textpattern |
|
341 |
344 |
endpoint = "rpc/index.php"; |
342 |
345 |
else |
343 |
346 |
endpoint = "xmlrpc.php"; |
| … | … | @@ -483,8 +486,6 @@ void AccountsDialog::on_leLocation_textE |
483 |
486 |
|
484 |
487 |
void AccountsDialog::on_lePort_textEdited( const QString &text ) |
485 |
488 |
{ |
486 |
bool ok; |
|
487 |
||
488 |
489 |
if( currentRow != -1 ) |
489 |
490 |
accountList[currentRow].port = text; |
490 |
491 |
} |
| … | … | @@ -528,25 +529,31 @@ void AccountsDialog::on_cbHostedBlogType |
528 |
529 |
void AccountsDialog::on_cbHostedBlogType_activated( int newIndex ) |
529 |
530 |
{ |
530 |
531 |
switch( newIndex ) { |
531 |
case |
|
532 |
case 1: // wordpress.com |
|
532 |
533 |
leServer->setText( "yourblog.wordpress.com" ); |
533 |
534 |
leLocation->setText( "/xmlrpc.php" ); |
534 |
535 |
break; |
535 |
case |
|
536 |
case 2: // TypePad |
|
536 |
537 |
leServer->setText( "www.typepad.com" ); |
537 |
538 |
leLocation->setText( "/t/api" ); |
538 |
539 |
break; |
539 |
case |
|
540 |
case 3: // SquareSpace |
|
540 |
541 |
leServer->setText( "www.squarespace.com" ); |
541 |
542 |
leLocation->setText( "/do/process/external/PostInterceptor" ); |
542 |
543 |
break; |
543 |
case 3: // Movable type |
|
544 |
case 4: // Self-hosted Wordpress |
|
545 |
case |
|
544 |
case 4: // Movable type |
|
545 |
case 5: // Self-hosted Wordpress |
|
546 |
leServer->clear(); |
|
547 |
leLocation->clear(); |
|
548 |
break; |
|
549 |
case 6: // Drupal |
|
550 |
case 7: // TextPattern |
|
551 |
chTB->setChecked( false ); // these platforms don't support it |
|
546 |
552 |
leServer->clear(); |
547 |
553 |
leLocation->clear(); |
548 |
554 |
break; |
549 |
555 |
} |
556 |
accountList[currentRow].hostedBlogType = newIndex; |
|
550 |
557 |
} |
551 |
558 |
|
552 |
559 |
bool AccountsDialog::eventFilter( QObject *obj, QEvent *event ) |
| … | … | @@ -560,7 +567,7 @@ bool AccountsDialog::eventFilter( QObjec |
560 |
567 |
return QObject::eventFilter( obj, event ); |
561 |
568 |
} |
562 |
569 |
} |
563 |
||
570 |
||
564 |
571 |
return QObject::eventFilter( obj, event ); |
565 |
572 |
} |
566 |
573 |
Up to file-list AccountsDialog.h:
| … | … | @@ -47,6 +47,7 @@ public: |
47 |
47 |
public: |
48 |
48 |
typedef struct _acct { |
49 |
49 |
QString id; |
50 |
int hostedBlogType; |
|
50 |
51 |
QString name; |
51 |
52 |
QString server; |
52 |
53 |
QString location; |
Up to file-list AccountsForm.ui:
148 |
148 |
</item> |
149 |
149 |
<item row="1" column="1" colspan="3" > |
150 |
150 |
<widget class="QComboBox" name="cbHostedBlogType" > |
151 |
<item> |
|
152 |
<property name="text"> |
|
153 |
<string>None</string> |
|
154 |
</property> |
|
155 |
</item> |
|
151 |
156 |
<item> |
152 |
157 |
<property name="text" > |
153 |
158 |
<string>Wordpress.com</string> |
Up to file-list EditingWindow.cc:
| … | … | @@ -1205,10 +1205,11 @@ void EditingWindow::getAccounts() |
1205 |
1205 |
QDomNodeList accountsList, thisAccountsAttribs; |
1206 |
1206 |
QDomDocument newAccountsDom; |
1207 |
1207 |
QDomElement newQTMAccounts, newAccount, detailElement, nameElement, serverElement, locationElement, |
1208 |
portElement, loginElement, pwdElement, blogsElement, boolElement, attribsElement |
|
1208 |
portElement, loginElement, pwdElement, blogsElement, boolElement, attribsElement, hbtElement; |
|
1209 |
1209 |
QString oldCurrentAccountId, oldBlogid, currentTitle; |
1210 |
1210 |
QStringList thisAccountsAttribStrings; |
1211 |
1211 |
int i, j; |
1212 |
bool ok; |
|
1212 |
1213 |
|
1213 |
1214 |
// Extract accounts list from account tree |
1214 |
1215 |
accountsList = accountsDom.elementsByTagName( "account" ); |
| … | … | @@ -1223,6 +1224,11 @@ void EditingWindow::getAccounts() |
1223 |
1224 |
acct.login = detailElement.firstChildElement( "login" ).text(); |
1224 |
1225 |
acct.password = detailElement.firstChildElement( "password" ).text(); |
1225 |
1226 |
|
1227 |
acct.hostedBlogType = 0; |
|
1228 |
int hbt = detailElement.firstChildElement( "hostedBlogType" ).text().toInt( &ok ); |
|
1229 |
if( ok ) |
|
1230 |
acct.hostedBlogType = hbt; |
|
1231 |
||
1226 |
1232 |
acct.categoriesEnabled = false; |
1227 |
1233 |
acct.postDateTime = false; |
1228 |
1234 |
acct.comments = false; |
| … | … | @@ -1268,6 +1274,8 @@ void EditingWindow::getAccounts() |
1268 |
1274 |
detailElement = newAccountsDom.createElement( "details" ); |
1269 |
1275 |
nameElement = newAccountsDom.createElement( "title" ); |
1270 |
1276 |
nameElement.appendChild( newAccountsDom.createTextNode( returnedAccountsList.at( i ).name ) ); |
1277 |
hbtElement = newAccountsDom.createElement( "hostedBlogType" ); |
|
1278 |
hbtElement.appendChild( newAccountsDom.createTextNode( QString::number( returnedAccountsList.at( i ).hostedBlogType ) ) ); |
|
1271 |
1279 |
serverElement = newAccountsDom.createElement( "server" ); |
1272 |
1280 |
serverElement.appendChild( newAccountsDom.createTextNode( returnedAccountsList.at( i ).server ) ); |
1273 |
1281 |
locationElement = newAccountsDom.createElement( "location" ); |
| … | … | @@ -1280,6 +1288,7 @@ void EditingWindow::getAccounts() |
1280 |
1288 |
pwdElement.appendChild( newAccountsDom.createTextNode( returnedAccountsList.at( i ).password ) ); |
1281 |
1289 |
|
1282 |
1290 |
detailElement.appendChild( nameElement ); |
1291 |
detailElement.appendChild( hbtElement ); |
|
1283 |
1292 |
detailElement.appendChild( serverElement ); |
1284 |
1293 |
detailElement.appendChild( locationElement ); |
1285 |
1294 |
detailElement.appendChild( portElement ); |
