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 113: | 4d55bb09d8b6 |
| parent 112: | 01eaede9a68d |
| parent 110: | 9756f00aec37 |
| branch: | default |
Fixed blog affecting changing blog away from one with no categories
SideWindow.ui - New checkbox, chNoCats
EditingWindow.cc - Connects the changeBlog slot when switching accounts when categories are found in the 0 account; posts no categories and disables the category selectors when chNoCats is checked; the Preview and Console actions tagged "Exit preview/console" when preview or console are on
EditingWindow.cc,h - Removed blogThis; slottified newMTPost
EditingWindowBase.ui - Some new Whats This
Changed (Δ2.7 KB):
raw changeset »
EditingWindow.cc (82 lines added, 51 lines removed)
EditingWindow.h (2 lines added, 2 lines removed)
EditingWindowBase.ui (13 lines added, 31 lines removed)
ImageEntry.ui (2 lines added, 6 lines removed)
SideWidget.ui (86 lines added, 46 lines removed)
Up to file-list EditingWindow.cc:
| … | … | @@ -593,9 +593,8 @@ void EditingWindow::doUiSetup() |
593 |
593 |
this, SLOT( addClipTBPing() ) ); |
594 |
594 |
connect( ui.actionRe_move_ping, SIGNAL( triggered( bool ) ), |
595 |
595 |
this, SLOT( removeTBPing() ) ); |
596 |
||
597 |
596 |
connect( ui.action_Blog_this, SIGNAL( triggered( bool ) ), |
598 |
this, SLOT( |
|
597 |
this, SLOT( newMTPost() ) ); |
|
599 |
598 |
connect( ui.action_What_s_this, SIGNAL( triggered( bool ) ), |
600 |
599 |
this, SLOT( doWhatsThis() ) ); |
601 |
600 |
|
| … | … | @@ -1668,6 +1667,7 @@ void EditingWindow::populateBlogList() / |
1668 |
1667 |
} |
1669 |
1668 |
} |
1670 |
1669 |
else { |
1670 |
cw.chNoCats->setEnabled( false ); |
|
1671 |
1671 |
cw.cbMainCat->setEnabled( false ); |
1672 |
1672 |
cw.lwOtherCats->setEnabled( false ); |
1673 |
1673 |
} |
| … | … | @@ -1825,6 +1825,10 @@ void EditingWindow::changeAccount( int a |
1825 |
1825 |
cw.cbBlogSelector->addItem( blogsList.at( i ).firstChildElement( "blogName" ).text(), |
1826 |
1826 |
blogsList.at( i ).firstChildElement( "blogid" ).text() ); |
1827 |
1827 |
cw.cbBlogSelector->setEnabled( true ); |
1828 |
changeBlog( 0 ); |
|
1829 |
cw.cbBlogSelector->disconnect( this, SLOT( changeBlog( int ) ) ); // eliminate duplicate connections |
|
1830 |
connect( cw.cbBlogSelector, SIGNAL( activated( int ) ), |
|
1831 |
this, SLOT( changeBlog( int ) ) ); |
|
1828 |
1832 |
emit blogRefreshFinished(); |
1829 |
1833 |
if( QApplication::overrideCursor() != 0 ) |
1830 |
1834 |
QApplication::restoreOverrideCursor(); |
| … | … | @@ -1875,6 +1879,7 @@ void EditingWindow::changeBlog( int b ) |
1875 |
1879 |
cw.cbMainCat->addItem( currentCategoryText, |
1876 |
1880 |
QVariant( catsList.at( i ).firstChildElement( "categoryId" ).text() ) ); |
1877 |
1881 |
cw.lwOtherCats->addItem( currentCategoryText ); |
1882 |
cw.chNoCats->setEnabled( true ); |
|
1878 |
1883 |
cw.cbMainCat->setEnabled( true ); |
1879 |
1884 |
cw.lwOtherCats->setEnabled( true ); |
1880 |
1885 |
statusBar()->clearMessage(); // as otherwise, "there are no categories" would still show |
| … | … | @@ -1923,6 +1928,7 @@ void EditingWindow::blogger_getUsersBlog |
1923 |
1928 |
statusBar()->showMessage( tr( "Could not connect - check account details & password" ), 2000 ); |
1924 |
1929 |
addToConsole( QString( "%1\n" ).arg( fstring ) ); |
1925 |
1930 |
cw.cbBlogSelector->setEnabled( false ); |
1931 |
cw.chNoCats->setEnabled( false ); |
|
1926 |
1932 |
cw.cbMainCat->setEnabled( false ); |
1927 |
1933 |
cw.cbMainCat->clear(); |
1928 |
1934 |
cw.lwOtherCats->setEnabled( false ); |
| … | … | @@ -1951,6 +1957,8 @@ void EditingWindow::blogger_getUsersBlog |
1951 |
1957 |
currentBlog = cw.cbBlogSelector->currentIndex(); |
1952 |
1958 |
} |
1953 |
1959 |
cw.cbBlogSelector->setEnabled( true ); |
1960 |
connect( cw.cbBlogSelector, SIGNAL( activated( int ) ), |
|
1961 |
this, SLOT( changeBlog( int ) ) ); |
|
1954 |
1962 |
addToConsole( accountsDom.toString( 2 ) ); |
1955 |
1963 |
|
1956 |
1964 |
if( !initialChangeBlog ) |
| … | … | @@ -1984,8 +1992,9 @@ void EditingWindow::metaWeblog_newPost( |
1984 |
1992 |
QString parsedData( response ); |
1985 |
1993 |
entryNumber = parsedData.section( "<string>", 1, 1 ) |
1986 |
1994 |
.section( "</string>", -2, -2 ); |
1987 |
connect( this, SIGNAL( httpBusinessFinished() ), |
|
1988 |
this, SLOT( setPostCategories() ) ); |
|
1995 |
if( !cw.chNoCats->isChecked() ) |
|
1996 |
connect( this, SIGNAL( httpBusinessFinished() ), |
|
1997 |
this, SLOT( setPostCategories() ) ); |
|
1989 |
1998 |
|
1990 |
1999 |
if( !entryEverSaved ) { |
1991 |
2000 |
if( postAsSave && cleanSave ) { |
| … | … | @@ -2120,6 +2129,7 @@ void EditingWindow::mt_getCategoryList( |
2120 |
2129 |
else { |
2121 |
2130 |
if( !i ) { |
2122 |
2131 |
statusBar()->showMessage( tr( "There are no categories." ) ); |
2132 |
cw.chNoCats->setEnabled( false ); |
|
2123 |
2133 |
cw.cbMainCat->setEnabled( false ); |
2124 |
2134 |
cw.lwOtherCats->setEnabled( false ); |
2125 |
2135 |
} |
| … | … | @@ -2144,6 +2154,7 @@ void EditingWindow::mt_getCategoryList( |
2144 |
2154 |
else |
2145 |
2155 |
currentBlogElement.replaceChild( newCategoriesElement, currentBlogElement.firstChildElement( "categories" ) ); |
2146 |
2156 |
|
2157 |
cw.chNoCats->setEnabled( true ); |
|
2147 |
2158 |
cw.cbMainCat->setEnabled( true ); |
2148 |
2159 |
cw.lwOtherCats->setEnabled( true ); |
2149 |
2160 |
if( !noAutoSave ) { |
| … | … | @@ -2198,17 +2209,22 @@ void EditingWindow::mt_setPostCategories |
2198 |
2209 |
|
2199 |
2210 |
void EditingWindow::handleConsole( bool isChecked ) |
2200 |
2211 |
{ |
2201 |
switch( isChecked ) { |
|
2202 |
case false: |
|
2212 |
if( !isChecked ) { |
|
2203 |
2213 |
ui.actionP_review->setEnabled( true ); |
2204 |
2214 |
mainStack->setCurrentIndex( previousRaisedLSWidget ); |
2205 |
2215 |
searchWidget->setTextEdit( EDITOR ); |
2206 |
break; |
|
2207 |
case true: |
|
2216 |
ui.action_View_Console->setText( tr( "&Console" ) ); |
|
2217 |
ui.action_View_Console->setIconText( tr( "Console" ) ); |
|
2218 |
ui.action_View_Console->setToolTip( tr( "Console" ) ); |
|
2219 |
} |
|
2220 |
else { |
|
2208 |
2221 |
ui.actionP_review->setEnabled( false ); |
2209 |
2222 |
previousRaisedLSWidget = mainStack->currentIndex(); |
2210 |
2223 |
mainStack->setCurrentIndex( consoleID ); |
2211 |
2224 |
searchWidget->setTextEdit( console ); |
2225 |
ui.action_View_Console->setText( tr( "Exit &console" ) ); |
|
2226 |
ui.action_View_Console->setIconText( tr( "Exit console" ) ); |
|
2227 |
ui.action_View_Console->setToolTip( tr( "Exit console" ) ); |
|
2212 |
2228 |
} |
2213 |
2229 |
} |
2214 |
2230 |
|
| … | … | @@ -2523,11 +2539,17 @@ void EditingWindow::doPreview( bool isCh |
2523 |
2539 |
this, SLOT( showHighlightedURL( const QString & ) ) ); |
2524 |
2540 |
mainStack->setCurrentIndex( previewWindowID ); |
2525 |
2541 |
searchWidget->setTextEdit( previewWindow ); |
2542 |
ui.actionP_review->setText( tr( "Exit p&review" ) ); |
|
2543 |
ui.actionP_review->setIconText( tr( "Exit preview" ) ); |
|
2544 |
ui.actionP_review->setToolTip( tr( "Exit preview" ) ); |
|
2526 |
2545 |
} else { |
2527 |
2546 |
ui.action_View_Console->setEnabled( true ); |
2528 |
2547 |
mainStack->setCurrentIndex( previousRaisedLSWidget ); |
2529 |
2548 |
previewWindow->disconnect( SIGNAL( highlighted( const QString & ) ) ); |
2530 |
2549 |
searchWidget->setTextEdit( EDITOR ); |
2550 |
ui.actionP_review->setText( tr( "Entry in p&review" ) ); |
|
2551 |
ui.actionP_review->setIconText( tr( "Entry in preview" ) ); |
|
2552 |
ui.actionP_review->setToolTip( tr( "Entry in preview" ) ); |
|
2531 |
2553 |
} |
2532 |
2554 |
} |
2533 |
2555 |
|
| … | … | @@ -2536,10 +2558,10 @@ void EditingWindow::showHighlightedURL( |
2536 |
2558 |
statusBar()->showMessage( highlightedURL, 2000 ); |
2537 |
2559 |
} |
2538 |
2560 |
|
2539 |
|
|
2561 |
/*void EditingWindow::blogThis() |
|
2540 |
2562 |
{ |
2541 |
2563 |
newMTPost(); |
2542 |
} |
|
2564 |
}*/ |
|
2543 |
2565 |
|
2544 |
2566 |
void EditingWindow::newMTPost() |
2545 |
2567 |
{ |
| … | … | @@ -2818,33 +2840,36 @@ void EditingWindow::setPostCategories() |
2818 |
2840 |
QDomElement data = doc.createElement( "data" ); |
2819 |
2841 |
QDomElement arrayValue = doc.createElement( "value" ); |
2820 |
2842 |
QDomElement arrayStruct = doc.createElement( "struct" ); |
2821 |
#ifndef NO_DEBUG_OUTPUT |
|
2822 |
qDebug() << "posting prim cat"; |
|
2823 |
#endif |
|
2824 |
cat = currentBlogElement.firstChildElement( "categories" ) |
|
2825 |
.childNodes().at( cw.cbMainCat->currentIndex() ).toElement(); |
|
2826 |
QString primCat = cw.cbMainCat->itemData( cw.cbMainCat->currentIndex() ).toString(); |
|
2827 |
#ifndef NO_DEBUG_OUTPUT |
|
2828 |
qDebug() << "posted prim cat"; |
|
2829 |
#endif |
|
2830 |
arrayStruct.appendChild( XmlMember( doc, "categoryId", "string", primCat ) ); |
|
2831 |
arrayStruct.appendChild( XmlMember( doc, "isPrimary", "boolean", "1" ) ); |
|
2832 |
arrayValue.appendChild( arrayStruct ); |
|
2833 |
data.appendChild( arrayValue ); |
|
2834 |
||
2835 |
for( int a = 0; a < cw.lwOtherCats->count(); a++ ) { |
|
2836 |
if( cw.lwOtherCats->isItemSelected( cw.lwOtherCats->item( a ) ) ) { |
|
2837 |
cat = currentBlogElement.firstChildElement( "categories" ).childNodes().at( a ).toElement(); |
|
2838 |
secCatId = cw.cbMainCat->itemData( a ).toString(); |
|
2839 |
secCatName = cw.cbMainCat->itemText( a ); |
|
2840 |
arrayValue = doc.createElement( "value" ); |
|
2841 |
arrayStruct = doc.createElement( "struct" ); |
|
2842 |
arrayStruct.appendChild( XmlMember( doc, "categoryId", "int", secCatId ) ); |
|
2843 |
arrayStruct.appendChild( XmlMember( doc, "categoryName", "string", |
|
2844 |
secCatName ) ); |
|
2845 |
arrayStruct.appendChild( XmlMember( doc, "isPrimary", "boolean", "0" ) ); |
|
2846 |
arrayValue.appendChild( arrayStruct ); |
|
2847 |
data.appendChild( arrayValue ); |
|
2843 |
||
2844 |
if( !cw.chNoCats->isChecked() ) { |
|
2845 |
#ifndef NO_DEBUG_OUTPUT |
|
2846 |
qDebug() << "posting prim cat"; |
|
2847 |
#endif |
|
2848 |
cat = currentBlogElement.firstChildElement( "categories" ) |
|
2849 |
.childNodes().at( cw.cbMainCat->currentIndex() ).toElement(); |
|
2850 |
QString primCat = cw.cbMainCat->itemData( cw.cbMainCat->currentIndex() ).toString(); |
|
2851 |
#ifndef NO_DEBUG_OUTPUT |
|
2852 |
qDebug() << "posted prim cat"; |
|
2853 |
#endif |
|
2854 |
arrayStruct.appendChild( XmlMember( doc, "categoryId", "string", primCat ) ); |
|
2855 |
arrayStruct.appendChild( XmlMember( doc, "isPrimary", "boolean", "1" ) ); |
|
2856 |
arrayValue.appendChild( arrayStruct ); |
|
2857 |
data.appendChild( arrayValue ); |
|
2858 |
||
2859 |
for( int a = 0; a < cw.lwOtherCats->count(); a++ ) { |
|
2860 |
if( cw.lwOtherCats->isItemSelected( cw.lwOtherCats->item( a ) ) ) { |
|
2861 |
cat = currentBlogElement.firstChildElement( "categories" ).childNodes().at( a ).toElement(); |
|
2862 |
secCatId = cw.cbMainCat->itemData( a ).toString(); |
|
2863 |
secCatName = cw.cbMainCat->itemText( a ); |
|
2864 |
arrayValue = doc.createElement( "value" ); |
|
2865 |
arrayStruct = doc.createElement( "struct" ); |
|
2866 |
arrayStruct.appendChild( XmlMember( doc, "categoryId", "int", secCatId ) ); |
|
2867 |
arrayStruct.appendChild( XmlMember( doc, "categoryName", "string", |
|
2868 |
secCatName ) ); |
|
2869 |
arrayStruct.appendChild( XmlMember( doc, "isPrimary", "boolean", "0" ) ); |
|
2870 |
arrayValue.appendChild( arrayStruct ); |
|
2871 |
data.appendChild( arrayValue ); |
|
2872 |
} |
|
2848 |
2873 |
} |
2849 |
2874 |
} |
2850 |
2875 |
|
| … | … | @@ -3051,20 +3076,24 @@ void EditingWindow::save( const QString |
3051 |
3076 |
} |
3052 |
3077 |
out << "\n"; |
3053 |
3078 |
|
3054 |
QDomNodeList catNodeList = currentBlogElement.firstChildElement( "categories" ).elementsByTagName( "category" ); |
|
3055 |
out << QString( "PrimaryID:%1\n" ).arg( cw.cbMainCat->itemData( cw.cbMainCat->currentIndex() ).toString() ); |
|
3056 |
QString catsList; |
|
3057 |
int cats = 0; |
|
3058 |
for( int a = 0; a < cw.lwOtherCats->count(); a++ ) { |
|
3059 |
if( cw.lwOtherCats->isItemSelected( cw.lwOtherCats->item( a ) ) ) { |
|
3060 |
if( cats ) |
|
3061 |
catsList.append( QString( ";%1" ).arg( cw.cbMainCat->itemData( a ).toString() ) ); |
|
3062 |
else |
|
3063 |
catsList.append( cw.cbMainCat->itemData( a ).toString() ); |
|
3064 |
cats++; |
|
3065 |
} |
|
3066 |
} |
|
3067 |
out << QString( "CatIDs:%1\n" ).arg( catsList ); |
|
3079 |
if( !cw.chNoCats->isChecked() ) { |
|
3080 |
QDomNodeList catNodeList = currentBlogElement.firstChildElement( "categories" ).elementsByTagName( "category" ); |
|
3081 |
out << QString( "PrimaryID:%1\n" ).arg( cw.cbMainCat->itemData( cw.cbMainCat->currentIndex() ).toString() ); |
|
3082 |
QString catsList; |
|
3083 |
int cats = 0; |
|
3084 |
for( int a = 0; a < cw.lwOtherCats->count(); a++ ) { |
|
3085 |
if( cw.lwOtherCats->isItemSelected( cw.lwOtherCats->item( a ) ) ) { |
|
3086 |
if( cats ) |
|
3087 |
catsList.append( QString( ";%1" ).arg( cw.cbMainCat->itemData( a ).toString() ) ); |
|
3088 |
else |
|
3089 |
catsList.append( cw.cbMainCat->itemData( a ).toString() ); |
|
3090 |
cats++; |
|
3091 |
} |
|
3092 |
} |
|
3093 |
out << QString( "CatIDs:%1\n" ).arg( catsList ); |
|
3094 |
} |
|
3095 |
else |
|
3096 |
out << "PrimaryID:none\n"; |
|
3068 |
3097 |
if( cw.teExcerpt->toPlainText().length() > 0 ) |
3069 |
3098 |
out << QString( "Excerpt:%1\n" ) |
3070 |
3099 |
.arg( cw.teExcerpt->toPlainText().replace( QChar( '\n' ), "\\n" ) ); |
| … | … | @@ -3357,6 +3386,7 @@ bool EditingWindow::load( const QString |
3357 |
3386 |
cw.cbAccountSelector->setCurrentIndex( cw.cbAccountSelector->count()-1 ); |
3358 |
3387 |
cw.cbBlogSelector->clear(); |
3359 |
3388 |
cw.cbBlogSelector->setEnabled( false ); |
3389 |
cw.chNoCats->setEnabled( false ); |
|
3360 |
3390 |
cw.cbMainCat->clear(); |
3361 |
3391 |
cw.cbMainCat->setEnabled( false ); |
3362 |
3392 |
cw.lwOtherCats->clear(); |
| … | … | @@ -3435,6 +3465,7 @@ bool EditingWindow::load( const QString |
3435 |
3465 |
} |
3436 |
3466 |
} |
3437 |
3467 |
else { |
3468 |
cw.chNoCats->setEnabled( false ); |
|
3438 |
3469 |
cw.cbMainCat->setEnabled( false ); |
3439 |
3470 |
cw.lwOtherCats->setEnabled( false ); |
3440 |
3471 |
} |
Up to file-list EditingWindow.h:
| … | … | @@ -118,7 +118,6 @@ class EditingWindow : public QMainWindow |
118 |
118 |
QDomElement XmlRpcArray( QDomDocument &, QString, QList<QString> ); |
119 |
119 |
void setNetworkActionsEnabled( bool ); |
120 |
120 |
//void newBloggerPost(); |
121 |
void newMTPost(); // formerly blogThis() |
|
122 |
121 |
QString & getHTMLList( QString, QString & ); |
123 |
122 |
void saveAutoLinkDictionary(); |
124 |
123 |
void loadAutoLinkDictionary(); |
| … | … | @@ -227,7 +226,8 @@ class EditingWindow : public QMainWindow |
227 |
226 |
void makeOrderedList(); |
228 |
227 |
void doPreview( bool ); |
229 |
228 |
void showHighlightedURL( const QString & ); |
230 |
|
|
229 |
//void blogThis(); |
|
230 |
void newMTPost(); // formerly blogThis() |
|
231 |
231 |
void updatePostCategories(); |
232 |
232 |
void saveBlogs(); |
233 |
233 |
void setPostCategories(); |
