SVN commit 681930 by aloisio: All the KBlogger classes now are defined in the KBlogger namespace M +16 -4 backend.cpp M +7 -2 backend.h M +4 -5 editor.cpp M +5 -6 editor.h M +8 -2 entrieslist.cpp M +11 -6 entrieslist.h M +3 -1 imagemanager.cpp M +3 -0 imagemanager.h M +4 -8 kblogger.cpp M +8 -8 kblogger.h M +1 -1 kbloggerconfig.kcfgc M +5 -8 linkdialog.cpp M +4 -2 linkdialog.h M +1 -0 main.cpp M +2 -1 mainwidget.cpp M +1 -1 mainwidget.h M +5 -0 medialist.cpp M +5 -2 medialist.h M +1 -0 profileconfig.kcfgc M +4 -2 profileconfig_addons.cpp M +4 -0 profileconfigdialog.cpp M +6 -2 profileconfigdialog.h M +1 -1 profilelist.h M +3 -1 upload.cpp M +5 -1 upload.h M +2 -0 uploadmanager.cpp M +2 -2 uploadmanager.h M +3 -0 uploadqueue.cpp M +2 -1 uploadqueue.h --- trunk/playground/pim/kblogger/src/backend.cpp #681929:681930 @@ -24,12 +24,17 @@ #include #include #include +#include #include "uploadmanager.h" #include "uploadqueue.h" #include "kblogger.h" #include "profileconfig.h" +using namespace KBlog; + +namespace KBlogger{ + kbloggerbackend::kbloggerbackend(api_type api, QObject* parent): QObject(parent),m_backend(0),m_uploadQueueDialog(0) { @@ -80,10 +85,14 @@ void kbloggerbackend::listPostings() { - connect ( m_backend, SIGNAL( listedPosting( KBlog::BlogPosting & ) ), - SLOT( listedPostingSlot( KBlog::BlogPosting & ) )); - connect ( m_backend, SIGNAL( fetchedPosting( KBlog::BlogPosting & ) ), - SLOT( fetchedPostingSlot( KBlog::BlogPosting & ) )); + if (!m_backend) { + KMessageBox::error (0, i18n("Please choose an account before to fetch last posting list."), i18n("Account doesn't setteted")); + return; + } + connect ( m_backend, SIGNAL( listedPosting( KBlog::BlogPosting & ) ), + SLOT( listedPostingSlot( KBlog::BlogPosting & ) )); + connect ( m_backend, SIGNAL( fetchedPosting( KBlog::BlogPosting & ) ), + SLOT( fetchedPostingSlot( KBlog::BlogPosting & ) )); connect ( m_backend, SIGNAL( listPostingsFinished() ), SLOT( listPostingsFinishedSlot() )); m_backend->listPostings(); @@ -259,4 +268,7 @@ emit backendUpdated(); } +} //namespace + #include "backend.moc" + --- trunk/playground/pim/kblogger/src/backend.h #681929:681930 @@ -37,10 +37,13 @@ using namespace KBlog; class APIBlog; + +namespace KBlogger{ + +class kbloggerUploadQueue; +class kblogger; class kbloggerUploadManager; class postItem; //see kbloggeruploadmanager.h -class kbloggerUploadQueue; -class kblogger; class kbloggerbackend : public QObject { @@ -194,4 +197,6 @@ void backendUpdated(); }; +} + #endif // _KBLOGGERBACKEND_H_ --- trunk/playground/pim/kblogger/src/editor.cpp #681929:681930 @@ -52,15 +52,15 @@ #include "kbloggerconfig.h" #include "linkdialog.h" #include "backend.h" -#include "kblogger.h" +namespace KBlogger{ + KBloggerEditor::KBloggerEditor ( kbloggerbackend* backend, const QString& tempDir, int postid, QWidget* parent) : QWidget(parent) , m_linkDialog(), cssUrl(new KUrl(QString::null)) //TODO ? { setAttribute(Qt::WA_DeleteOnClose); //Destroy on close - m_parent=(kblogger*)parent; m_postid=postid; m_tempDir=new QDir(tempDir); m_upload=0; @@ -316,7 +316,7 @@ currentCharFormat.setAnchor(true); currentCharFormat.setAnchorHref(target); currentCharFormat.setUnderlineStyle(QTextCharFormat::SingleUnderline); - currentCharFormat.setForeground(KGlobalSettings::linkColor()); + currentCharFormat.setForeground(KGlobalSettings::linkColor()); //FIXME DEPRECATED if ( name !=VisualTextEditor->textCursor().selectedText() ) VisualTextEditor->textCursor().insertText(name,currentCharFormat); } @@ -604,7 +604,6 @@ } +} //namespace - - #include "editor.moc" --- trunk/playground/pim/kblogger/src/editor.h #681929:681930 @@ -22,25 +22,25 @@ #ifndef KBLOGGEREDITOR_H #define KBLOGGEREDITOR_H - #include #include #include "ui_editorbase.h" #include "upload.h" -//#include class KToolBar; class KActionCollection; class KStatusBar; -class kblogger; class KHTMLPart; class KUrl; + + +namespace KBlogger{ + class KBloggerLinkDialog; class kbloggerbackend; - class KBloggerEditor : public QWidget, public Ui::kbloggerEditorBase { Q_OBJECT @@ -68,7 +68,6 @@ KBloggerLinkDialog *m_linkDialog; KToolBar *m_toolBar; KActionCollection *m_actionCollection; //FIXME? Use application Action collection? - kblogger *m_parent; QStringList categDescription; int nCategFetched; KHTMLPart *PreviewBrowser; @@ -107,6 +106,6 @@ void statusBarMessage( const QString& message ); }; - +} //namespace #endif --- trunk/playground/pim/kblogger/src/entrieslist.cpp #681929:681930 @@ -27,7 +27,12 @@ #include #include "uploadmanager.h" +#include "backend.h" + + +namespace KBlogger{ + /** * kbloggerEntriesList */ @@ -86,9 +91,9 @@ setAttribute(Qt::WA_DeleteOnClose); //QWidget.setAttribute() //see m_backend->listPosts() connect(m_backend,SIGNAL( listedPosting( KBlog::BlogPosting &) ), - SLOT(listedPostingSlot( KBlog::BlogPosting &))); + SLOT(listedPostingSlot(KBlog::BlogPosting&))); connect(m_backend,SIGNAL( fetchedPosting( KBlog::BlogPosting &)), - SLOT(fetchedPostingSlot(KBlog::BlogPosting &))); + SLOT(fetchedPostingSlot(KBlog::BlogPosting&))); show(); listPosts(); @@ -133,4 +138,5 @@ kDebug() << "kbloggerQueuedEntriesList::~kbloggerQueuedEntriesList" << endl; } +} //namespace #include "entrieslist.moc" --- trunk/playground/pim/kblogger/src/entrieslist.h #681929:681930 @@ -22,15 +22,18 @@ #define KBLOGGERENTRIESLIST_H #include "ui_entrieslistblank.h" -#include "backend.h" -class postItem; - /** * Generic Posts List widget. */ -class KBlog::BlogPosting; +namespace KBlog{ + class BlogPosting; +} +namespace KBlogger{ +class kbloggerbackend; +class postItem; + class kbloggerEntriesList : public QWidget, public Ui::kbloggerEntriesListBlank { Q_OBJECT @@ -56,10 +59,11 @@ void listPosts(); private Q_SLOTS: - //void listedPostingSlot( KBlog::BlogPosting &posting ); - //void fetchedPostingSlot( KBlog::BlogPosting &posting ); void listedPostingSlot( postItem &posting ); void fetchedPostingSlot( postItem &posting ); + void listedPostingSlot( KBlog::BlogPosting &posting ){ kDebug()<< "listedPostingSlot" < #include @@ -33,7 +34,7 @@ #include #include -#include "imagemanager.h" +namespace KBlogger{ KBloggerImageManager::KBloggerImageManager(QDir* tmpDir, QWidget *parent, const char *name) :QWidget(parent), m_Image(0), m_tempDir(tmpDir) @@ -141,5 +142,6 @@ comboSizeChanged(resizeComboBox->currentItem()); } +}//namespace #include "imagemanager.moc" --- trunk/playground/pim/kblogger/src/imagemanager.h #681929:681930 @@ -24,6 +24,7 @@ #include #include "ui_imagemanagerblank.h" +namespace KBlogger{ class KBloggerImageManager: public QWidget, public Ui::KBloggerImageManagerBlank { Q_OBJECT @@ -45,4 +46,6 @@ void imageResized(const QString&); }; +} //namespace + #endif --- trunk/playground/pim/kblogger/src/kblogger.cpp #681929:681930 @@ -38,14 +38,12 @@ #include #include -#include "editor.h" -#include "backend.h" #include "entrieslist.h" #include "kbloggerconfig.h" #include "profilelist.h" -using namespace KBlogger; +namespace KBlogger{ kblogger::kblogger() : KXmlGuiWindow() @@ -99,10 +97,6 @@ //NOTE: the menu works only if you have installed kbloggerui.rc // local path of kbloggerui.rc is ~/.kde/share/apps/kblogger - /*KAction *newEntryAction = new KAction(KIcon("new"), i18n("New Entry"), this); - actionCollection()->addAction( QLatin1String("new_entry"), newEntryAction ); - connect(newEntryAction, SIGNAL(triggered(bool)), m_backend, SLOT(newEntry())); -*/ KAction *syncAction = new KAction(KIcon("arrow-up"), i18n("Sync Media and Entries"), this); actionCollection()->addAction( QLatin1String("sync_all"), syncAction ); connect(syncAction, SIGNAL(triggered(bool)), m_backend, SLOT(sync())); @@ -148,7 +142,7 @@ fetchedEntriesListDialog= new QDialog(this); fetchedEntriesListWidget=new kbloggerFetchedEntriesList( m_backend , fetchedEntriesListDialog ); - fetchedEntriesListDialog->setCaption(i18n("Fetched posts")); + fetchedEntriesListDialog->setCaption(i18n("Fetched posts")); //FIXME setCaption DEPRECATED! new QGridLayout ( fetchedEntriesListDialog ); fetchedEntriesListDialog->layout()->addWidget(fetchedEntriesListWidget); fetchedEntriesListDialog->show(); @@ -168,4 +162,6 @@ m_editor= new KBloggerEditor(m_backend,m_tempDir->name(),-1,0); connect(m_editor,SIGNAL(statusBarMessage( const QString&)),statusBar(),SLOT(message( const QString&))); } + +} //namespace #include "kblogger.moc" --- trunk/playground/pim/kblogger/src/kblogger.h #681929:681930 @@ -26,17 +26,13 @@ #include "profileconfigdialog.h" #include "mainwidget.h" +#include "editor.h" +#include "backend.h" class KToggleAction; class KUrl; class KTempDir; -class KBloggerEditor; -class kbloggerbackend; - - -using namespace KBlogger; - /** * This class serves as the main window for kblogger. It handles the * menus, toolbars, and status bars. @@ -45,6 +41,9 @@ * @author Antonio Aloisio * @version 0.8 */ + +namespace KBlogger{ + class kblogger : public KXmlGuiWindow { Q_OBJECT @@ -69,13 +68,14 @@ void setupActions(); private: - mainWidget *m_mainWidget; + KBlogger::mainWidget *m_mainWidget; KToggleAction *m_toolbarAction; KToggleAction *m_statusbarAction; - kbloggerbackend* m_backend; + KBlogger::kbloggerbackend* m_backend; KTempDir *m_tempDir; }; +} //namespace #endif // _KBLOGGER_H_ --- trunk/playground/pim/kblogger/src/kbloggerconfig.kcfgc #681929:681930 @@ -2,4 +2,4 @@ ClassName=KBloggerConfig Singleton=true Mutators=true - +Namespace=KBlogger --- trunk/playground/pim/kblogger/src/linkdialog.cpp #681929:681930 @@ -23,6 +23,9 @@ #include #include #include + +namespace KBlogger{ + KBloggerLinkDialog::KBloggerLinkDialog(QWidget *parent, const char *name) : QWidget(parent) { @@ -47,18 +50,12 @@ //nameLineEdit->clear(); close(); } + void KBloggerLinkDialog::reject() { kDebug() << "KBloggerLinkDialog::reject" << endl; close(); } -/* Remove? -QString KBloggerLinkDialog::sanitize(const QString& dirtyString) -{ - QRegExp rx("<[-;!= #:\"/.a-zA-Z0-9]+>"); - QString cleanedString=dirtyString; - return cleanedString.remove(rx); -} -*/ +} //namespace #include "linkdialog.moc" --- trunk/playground/pim/kblogger/src/linkdialog.h #681929:681930 @@ -26,6 +26,7 @@ #include #include "ui_linkdialogblank.h" +namespace KBlogger{ class KBloggerLinkDialog : public QWidget, public Ui::KBloggerLinkDialogBlank { @@ -40,8 +41,9 @@ public Q_SLOTS: virtual void accept(); // OK Button virtual void reject(); // Cancel Button -//private: REMOVE? -// QString sanitize(const QString& dirtyString); //Remove Tags if present in the text. + }; +} //namespace + #endif --- trunk/playground/pim/kblogger/src/main.cpp #681929:681930 @@ -24,6 +24,7 @@ #include #include +using namespace KBlogger; static const char description[] = I18N_NOOP("A KDE4 Application for blogging"); --- trunk/playground/pim/kblogger/src/mainwidget.cpp #681929:681930 @@ -21,7 +21,7 @@ #include "profileconfig.h" -using namespace KBlogger; +namespace KBlogger{ mainWidget::mainWidget( QWidget* parent ): QWidget(parent){ setupUi(this); @@ -52,4 +52,5 @@ blogListTree->insertTopLevelItems(0, items); } +} //namespace #include "mainwidget.moc" --- trunk/playground/pim/kblogger/src/mainwidget.h #681929:681930 @@ -41,5 +41,5 @@ void populateAccountList(); }; -} +}//namespace #endif --- trunk/playground/pim/kblogger/src/medialist.cpp #681929:681930 @@ -28,6 +28,8 @@ #include "uploadmanager.h" +namespace KBlogger{ + /** * kbloggerEntriesList */ @@ -51,4 +53,7 @@ __item->setText(3, QString()); */ } + +} + #include "medialist.moc" --- trunk/playground/pim/kblogger/src/medialist.h #681929:681930 @@ -24,13 +24,16 @@ #include "ui_medialistblank.h" #include "backend.h" -class postItem; + /** * Generic Posts List widget. */ class KBlog::BlogPosting; +namespace KBlogger{ +class postItem; + class kbloggerMediaList : public QWidget, public Ui::kbloggerMediaListBlank { Q_OBJECT @@ -39,6 +42,6 @@ virtual ~kbloggerMediaList(); void insertItem(); }; - +} #endif --- trunk/playground/pim/kblogger/src/profileconfig.kcfgc #681929:681930 @@ -3,3 +3,4 @@ Singleton=false Mutators=true CustomAdditions=true +Namespace=KBlogger --- trunk/playground/pim/kblogger/src/profileconfig_addons.cpp #681929:681930 @@ -25,11 +25,12 @@ #include #include + +namespace KBlogger{ + typedef QHash DevsHash; - K_GLOBAL_STATIC( DevsHash, m_prefs) - profileConfig* profileConfig::prefs(const QString &groupName) { // if (!m_prefs) @@ -67,3 +68,4 @@ }; +} //namespace \ No newline at end of file --- trunk/playground/pim/kblogger/src/profileconfigdialog.cpp #681929:681930 @@ -33,6 +33,8 @@ #include #include +namespace KBlogger{ + profileConfigDialog::profileConfigDialog(QWidget* parent) : QWidget(parent),areIdsRetrieved(false) { @@ -99,5 +101,7 @@ } +} //namespace + #include "profileconfigdialog.moc" --- trunk/playground/pim/kblogger/src/profileconfigdialog.h #681929:681930 @@ -29,8 +29,12 @@ #include "backend.h" -class profileConfig; + +namespace KBlogger{ + +class profileConfig; + class profileConfigDialog : public QWidget, public Ui::profileConfigDialogBase { Q_OBJECT @@ -53,6 +57,6 @@ Q3ValueVector blogNames; bool areIdsRetrieved; }; - +} #endif --- trunk/playground/pim/kblogger/src/profilelist.h #681929:681930 @@ -45,5 +45,5 @@ //profileConfig *m_profileconfig; }; -} +}//namespace #endif --- trunk/playground/pim/kblogger/src/upload.cpp #681929:681930 @@ -41,6 +41,8 @@ #include "imagemanager.h" #include "backend.h" +namespace KBlogger{ + KBloggerUpload::KBloggerUpload( kbloggerbackend *backend, const QString& filename, mimeType filter,QDir* tmpDir, @@ -151,6 +153,6 @@ m_imageManager->setImage(filename); } +} //namespace - #include "upload.moc" --- trunk/playground/pim/kblogger/src/upload.h #681929:681930 @@ -27,6 +27,10 @@ #include "ui_uploadblank.h" + + +namespace KBlogger{ + class KBloggerImageManager; class kbloggerbackend; @@ -52,5 +56,5 @@ //virtual void handleFileJobMimetype( KIO::Job*, const QString& ); virtual void setFileNameOnServer(const QString& filename); }; - +} #endif --- trunk/playground/pim/kblogger/src/uploadmanager.cpp #681929:681930 @@ -20,6 +20,7 @@ #include "uploadmanager.h" +namespace KBlogger{ kbloggerUploadManager::kbloggerUploadManager(QObject *parent): QObject(parent) { @@ -66,4 +67,5 @@ emit postFinished(); } +} //namespace #include "uploadmanager.moc" --- trunk/playground/pim/kblogger/src/uploadmanager.h #681929:681930 @@ -38,7 +38,7 @@ using namespace KBlog; - +namespace KBlogger{ class mediaItem{ public: mediaItem() @@ -133,5 +133,5 @@ bool uploadIt);*/ void postFinished(); }; - +} #endif // _kbloggerUploadManager_H_ --- trunk/playground/pim/kblogger/src/uploadqueue.cpp #681929:681930 @@ -25,6 +25,8 @@ #include +namespace KBlogger{ + kbloggerUploadQueue::kbloggerUploadQueue( QWidget *parent ): QDialog(parent) { kDebug() << "kbloggerUploadQueue::kbloggerUploadQueue" << endl; @@ -49,4 +51,5 @@ EntriesList->appendPost(*post); } +} //namespace #include "uploadqueue.moc" --- trunk/playground/pim/kblogger/src/uploadqueue.h #681929:681930 @@ -27,6 +27,7 @@ * kblogger UploadQueue Dialog shows the posts and the media object in the upload queue. */ +namespace KBlogger{ class kbloggerQueuedEntriesList; class kbloggerMediaList; @@ -44,5 +45,5 @@ kbloggerMediaList *MediaList; }; - +} //namespace #endif