[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    playground/pim/kblogger/src
From:       Christian Weilbach <christian () whiletaker ! homeip ! net>
Date:       2009-02-25 18:46:23
Message-ID: 1235587583.487182.21681.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 931743 by weilbach:

Ask before profile deletion first. Remove BlogChoser as the composer is so tightly \
bound to one blog site and changing the blog actually means to reinitialize it \
anyway. So only allow creation of new posts if you chose a blog first. Therefore fix \
new and allow it on QTreeList items of a blog only.


 M  +9 -40     composer/composer.cpp  
 M  +1 -3      composer/composer.h  
 M  +2 -2      mainwindow.cpp  
 M  +3 -0      profiles/profilelist.cpp  


--- trunk/playground/pim/kblogger/src/composer/composer.cpp #931742:931743
@@ -85,7 +85,8 @@
     }
     mPostToModify = 0;
     initialize();
-    setBlogname(blogname);
+    mBlogname = blogname;
+    setWindowTitle( i18n("Blog post for blog: %1", blogname ) );
     timeStampKDateTime->setDateTime ( QDateTime::currentDateTime() );
     connect ( buttonBox, SIGNAL( accepted() ), this, SLOT( enqueueSlot() ) );
     connect ( buttonBox, SIGNAL( rejected() ), this, SLOT( close() ) );
@@ -98,30 +99,10 @@
     //TODO Stop 'Fetch Categories' if it's running!
 }
 
-void Composer::setBlogname(const QString& blogname)
-{
-    kDebug();
-    if ( blogname.isEmpty() ){
-      return;
-    }
-
-    for ( int i = 0; mBlogChooser->blogCombo->count(); ++i ) {
-        if ( blogname == mBlogChooser->blogCombo->itemText(i) ) {
-            mBlogChooser->blogCombo->setCurrentIndex(i);
-            // disable blog changing, because media get mixed up then
-            mBlogChooser->blogCombo->setEnabled(false);
-            break;
-        }
-    }
-}
-
 QString Composer::blogname()
 {
     kDebug();
-    if ( !mBlogChooser->blogCombo->currentIndex() )
-        return QString();
-    else
-        return mBlogChooser->blogCombo->currentText();
+    return mBlogname;
 }
 
 void Composer::initialize ()
@@ -133,10 +114,6 @@
 
     setAttribute( Qt::WA_DeleteOnClose ); //Destroy on close
 
-    //Add BlogServer Chooser
-    mBlogChooser = new BlogChooser( blogGroupBox );
-    blogGroupBox->layout()->addWidget( mBlogChooser );
-
     //Add Editor: NOTE Editor requires BlogChooser!
     mEditor = new ComposerEditor(this, editorFrame);
     editorFrame->layout()->addWidget(mEditor);
@@ -144,8 +121,6 @@
     //Connections
     connect ( refreshCategoriesButton, SIGNAL( clicked() ),
               this, SLOT( slotRefreshCateroriesFromServer() ) );
-    connect ( mBlogChooser->blogCombo, SIGNAL( currentIndexChanged(const QString& ) \
                ),
-              this, SLOT( updateBlogOptions(const QString& ) ) );
     connect( CategoryComboBox, SIGNAL( currentIndexChanged(const QString& ) ),
              this , SLOT( hideFirstCategory( const QString&)));
 
@@ -159,8 +134,9 @@
     //First of All we need to set the blogname,
     //In this way categories are loaded and some options
     //are enabled by updateBlogOptions();
-    setBlogname ( post->getBlogName() );
-
+    mBlogname = post->getBlogName();
+    setWindowTitle( i18n("Blog post for blog: %1", mBlogname ) );
+ 
     //Set Title
     TitleLineEdit->setText ( post->title() );
 
@@ -277,7 +253,7 @@
 void Composer::slotRefreshCateroriesFromServer()
 {
     kDebug();
-    getCategories(mBlogChooser->blogCombo->currentText());
+    getCategories(mBlogname);
 }
 
 void Composer::hideFirstCategory( const QString& categoryToHide )
@@ -377,12 +353,6 @@
         return;
     }
 
-    //TEST - BlogServer isn't selected
-    if ( !mBlogChooser->blogCombo->currentIndex() ) {
-        KMessageBox::information(this, i18n("Please select a blog first."));
-        return;
-    }
-
     //TEST - Post Title is Empty
     if ( !TitleLineEdit->isHidden() && TitleLineEdit->text().isEmpty() ) {
         KMessageBox::sorry ( this, i18n ( "Please fill the title field." ) );
@@ -412,7 +382,7 @@
 
     //Settings up & create post
     Post *post;
-    post = new Post( mBlogChooser->blogCombo->currentText(),
+    post = new Post( mBlogname,
                              TitleLineEdit->text(),
                              mEditor->contentTextHtmlEditor->toPlainText(),
                              categories,
@@ -455,7 +425,7 @@
     mBackend->slotStatusBarMessage(i18n("Retrieved %1 categories from your blog...", \
categories.count()));  
     //Saving categories;
-    saveCategories(mBlogChooser->blogCombo->currentText(), &categories);
+    saveCategories(mBlogname, &categories);
 }
 
 void Composer::fillCategoriesWidgets(const QList< QMap<QString, QString> >* \
categories) @@ -484,7 +454,6 @@
 {
     kDebug();
     if (!mBackend) return; // TODO can/should this ever happen?
-    if (!mBlogChooser->blogCombo->currentIndex()) return;
 
     CategoryComboBox->clear();
     categoriesList->clear();
--- trunk/playground/pim/kblogger/src/composer/composer.h #931742:931743
@@ -35,7 +35,6 @@
 class Post;
 class ComposerEditor;
 class ItemsManager;
-class BlogChooser;
 
 class Composer : public QDialog, public Ui::ComposerBase
 {
@@ -75,10 +74,9 @@
     //Vars
     Backend* mBackend;
     ItemsManager *mItemsManager;
-    QString mEditCategory;
+    QString mEditCategory,mBlogname;
     Post *mPostToModify;
     ComposerEditor *mEditor;
-    BlogChooser *mBlogChooser;
 
 
 };
--- trunk/playground/pim/kblogger/src/mainwindow.cpp #931742:931743
@@ -134,11 +134,11 @@
     (void) KStandardAction::preferences(this, SLOT(optionsPreferences()), \
actionCollection());  
     //POSTS MENU
-    KLocalizedString ksNew = ki18nc( "a button to create a new post", "New" );
+    KLocalizedString ksNew = ki18nc( "Create a new post", "New" );
     KAction *createPostAction = new KAction(KIcon("document-new"), ksNew.toString(), \
                this);
     actionCollection()->addAction( QLatin1String("create_post"), createPostAction );
     connect(createPostAction, SIGNAL(triggered(bool)), this, SLOT(createPost()));
-    //postActionGroup->addAction(createPostAction);
+    postActionGroup->addAction(createPostAction);
 
     KAction *modifyAction = new KAction(KIcon("document-properties"), \
                i18n("Modify"), this);
     actionCollection()->addAction( QLatin1String("modify_post"), modifyAction );
--- trunk/playground/pim/kblogger/src/profiles/profilelist.cpp #931742:931743
@@ -121,6 +121,9 @@
     QString account = mCurrentTreeItem->text(0);
     kDebug() << account << endl;
 
+    if (KMessageBox::questionYesNo(this,i18n("Do you really want to delete the \
account \"%1\"? All local changes will be lost.",account),i18n("Confirm \
deletion"))==KMessageBox::No){ +        return;
+    }
     // remove stored files for the profile first
     QString entriesFilename = QString(account).prepend(DIR_TO_SAVE_ENTRIES);
     QStringList list;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic