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

List:       kde-commits
Subject:    playground/pim/kblogger
From:       Antonio Aloisio <antonio.aloisio () gmail ! com>
Date:       2007-05-12 20:25:46
Message-ID: 1179001546.290190.18844.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 663976 by aloisio:

KBloggerEditor setted as central widget

 M  +1 -2      NOT_PORTED_YET/kblogger.cpp  
 M  +1 -2      NOT_PORTED_YET/kblogger.h  
 M  +51 -3     src/kblogger.cpp  
 M  +12 -2     src/kblogger.h  
 M  +10 -9     src/kbloggereditor.cpp  
 M  +1 -1      src/kbloggereditor.h  
 M  +3 -2      src/main.cpp  


--- trunk/playground/pim/kblogger/NOT_PORTED_YET/kblogger.cpp #663975:663976
@@ -29,7 +29,7 @@
 #include <QCursor>
 //Added by qt3to4:
 #include <QMouseEvent>
-/*#include <QVBoxLayout> // it's right?
+#include <QVBoxLayout> // it's right?
 
 #include <kaboutdata.h>
 #include <k3aboutapplication.h>
@@ -299,4 +299,3 @@
 		                      parent, "kblogger" );
 	}
 }
-*/
\ No newline at end of file
--- trunk/playground/pim/kblogger/NOT_PORTED_YET/kblogger.h #663975:663976
@@ -20,8 +20,8 @@
  *   Free Software Foundation, Inc.,                                       *
  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
  ***************************************************************************/
-/*
 
+
 #ifndef KBLOGGER_H
 #define KBLOGGER_H
 
@@ -117,4 +117,3 @@
 };
 
 #endif
-*/
\ No newline at end of file
--- trunk/playground/pim/kblogger/src/kblogger.cpp #663975:663976
@@ -9,6 +9,7 @@
 
 #include <QDropEvent>
 #include <QPainter>
+#include <QDir>
 
 #include <kconfigdialog.h>
 #include <kglobal.h>
@@ -16,23 +17,36 @@
 #include <kicon.h>
 #include <kprinter.h>
 #include <kstatusbar.h>
-//#include <kkeydialog.h>
 #include <kedittoolbar.h>
+#include <ktempdir.h>
 
 #include <kaction.h>
 #include <kactioncollection.h>
 #include <kstandardaction.h>
+#include <kstandarddirs.h>
+#include <kblog/blogger.h>
+#include <kblog/metaweblog.h>
 
+#include "kbloggerconfig.h"
+#include "kbloggereditor.h"
+
 kblogger::kblogger()
     : KXmlGuiWindow(),
-      //m_view(new kbloggerView(this)),
+      m_backend(0),
+      m_tempDir(0),
+      m_view(0),
       m_printer(0)
 {
+    m_tempDir=new KTempDir(KStandardDirs::locateLocal("tmp", "kblogger"));
+    updateBackend();
+    if (!m_tempDir && !m_backend) return;
+    m_view=new KBloggerEditor(m_backend,m_tempDir->name(),statusBar(),-1,this);
+
     // accept dnd
     setAcceptDrops(true);
 
     // tell the KXmlGuiWindow that this is indeed the main widget
-    //setCentralWidget(m_view);
+    setCentralWidget(m_view);
 
     // then, setup our actions
     setupActions();
@@ -46,6 +60,8 @@
     // mainwindow to automatically save settings if changed: window size,
     // toolbar position, icon size, etc.
     setupGUI();
+
+
 }
 
 kblogger::~kblogger()
@@ -94,4 +110,36 @@
     dialog->show();
 }
 
+void kblogger::updateBackend()
+{
+	kDebug() << "KBlogger::updateBackend()\n - Creating KUrl..." << endl;
+	KUrl mServerUrl ( KBloggerConfig::url() );
+
+	// create the backend
+	kDebug() << "  - API type =" << KBloggerConfig::type() << endl;
+	switch ( KBloggerConfig::type() )
+	{
+		case BLOGGER_API:
+			kDebug() << "  - Creating APIBlogger( '"<< KBloggerConfig::url() << "' )" << \
endl; +			m_backend = new KBlog::APIBlogger ( mServerUrl );
+			//m_backend->setAppID ( "0123456789ABCDEF" ); // id not needed anymore
+			break;
+
+		case METAWEBLOG_API:
+			m_backend = new KBlog::APIMetaWeblog ( mServerUrl );
+			break;
+		/*FIXME
+		default:
+		{
+			//KMessageBox::error ( 0, i18n ( "API Type not found. You have to configure \
first." ) ); +			QPixmap icon( m_iconLoader->loadIcon("kblogger/warning",KIcon::Panel \
)); +			KPassivePopup::message ( "KBlogger Warning","API Type not found. You have to \
configure first.",icon,this ); +			m_backend=0;
+			return;
+			break;
+		}*/
+	}
+	m_backend->setUsername ( KBloggerConfig::user() );
+	m_backend->setPassword ( KBloggerConfig::password() );
+}
 #include "kblogger.moc"
--- trunk/playground/pim/kblogger/src/kblogger.h #663975:663976
@@ -8,14 +8,18 @@
 
 
 #include <kxmlguiwindow.h>
+#include <kblog/blog.h>
+#
 
 #include "ui_kbloggerconfigblank.h"
 
-//class kbloggerView;
+class KBloggerEditor;
 class KPrinter;
 class KToggleAction;
 class KUrl;
 
+class KTempDir;
+
 /**
  * This class serves as the main window for kblogger.  It handles the
  * menus, toolbars, and status bars.
@@ -41,17 +45,23 @@
 private slots:
     void fileNew();
     void optionsPreferences();
+    void updateBackend(); //Create a new backend or update the beckend's settings
 
 private:
     void setupActions();
+    enum apiType { BLOGGER_API=0,METAWEBLOG_API };
 
 private:
     Ui::KBloggerConfigBlank ui_kbloggerconfigBlank ;
-    //kbloggerView *m_view;
+    KBloggerEditor *m_view;
 
     KPrinter   *m_printer;
     KToggleAction *m_toolbarAction;
     KToggleAction *m_statusbarAction;
+    
+    KBlog::APIBlog* m_backend;
+    KTempDir *m_tempDir;
+
 };
 
 #endif // _KBLOGGER_H_
--- trunk/playground/pim/kblogger/src/kbloggereditor.cpp #663975:663976
@@ -51,7 +51,7 @@
 #include <kpassivepopup.h>
 #include <kinputdialog.h>
 
-#include "kbloggerconfigdialog.h"
+//#include "kbloggerconfigdialog.h"
 #include "kbloggerconfig.h"
 #include "kbloggerlinkdialog.h"
 
@@ -62,8 +62,8 @@
 #include <kvbox.h>
 
 
-KBloggerEditor::KBloggerEditor ( KBlog::APIBlog* backend, QDir* tempDir, int postid, \
                QWidget* parent, const char* name, Qt::WFlags fl )
-		: QWidget(parent) , m_parent((KBlogger*)parent)/*WARNING*/, m_postid ( postid ), \
m_linkDialog(), cssUrl(new KUrl(QString::null)), m_tempDir(tempDir) \
+KBloggerEditor::KBloggerEditor ( KBlog::APIBlog* backend, const QString& tempDir, \
KStatusBar* statusBar, int postid, QWidget* parent) +		: QWidget(parent) , \
m_parent((KBlogger*)parent)/*WARNING*/, m_postid ( postid ), m_linkDialog(), \
cssUrl(new KUrl(QString::null)), m_tempDir(new QDir(tempDir)),m_statusBar(statusBar)  \
{  setupUi((QDialog*)this);
 	kDebug() << "KBloggerEditor::KBloggerEditor()" << endl;
@@ -76,7 +76,7 @@
 	TimeStampKDateTime->setDateTime ( QDateTime::currentDateTime() );
 
 	m_backend=backend;
-	m_linkDialog=new KBloggerLinkDialog ( this );
+	m_linkDialog=new KBloggerLinkDialog ( 0 );
 
 	kDebug() << "initialize KActions & Toolbar" << endl;
 	m_actionCollection= new KActionCollection ( this );
@@ -158,8 +158,7 @@
 	checkSpellingAction->setIcon ( "spellcheck" ); 
 	checkSpellingAction->plug ( m_toolBar );
 */
-	//STATUS BAR!!!! ;)
-	m_statusBar= new KStatusBar(this);
+	
 	//KBloggerEditorBlankLayout->addWidget(m_statusBar,KBloggerEditorBlankLayout->numRows(),0);
  
 	//Preview KHTML Widget
@@ -189,7 +188,7 @@
 	}
 
 	
-	SendButton->layout()->addWidget(m_statusBar);//KDE PORTING ,0,0);
+	
 	connect(m_actionCollection, SIGNAL( actionStatusText( const QString & ) ),
                 m_statusBar, SLOT( message( const QString & ) ) );
 	connect(m_actionCollection, SIGNAL( clearStatusText() ),
@@ -197,7 +196,7 @@
 	connect(m_backend, SIGNAL( error( const QString& ) ),
 		m_statusBar, SLOT( message( const QString & ) ) );
 
-	kDebug() << "interfaceName() " << backend->interfaceName() << endl;
+	kDebug() << "interfaceName() " << m_backend->interfaceName() << endl;
 
 	//FIXME if Spelling check is enabled => several formatting errors in WYSIWYG.
 	VisualTextEditor->setCheckSpellingEnabled ( false );
@@ -690,13 +689,15 @@
 }
 
 void KBloggerEditor::writeOnPreview(const QString& text)
-{
+{ /*FIXME CREASH!:(
+	if (!PreviewBrowser) return;
 	PreviewBrowser->begin();
 	PreviewBrowser->openStream( "text/html", KUrl() );
 	if (cssUrl->isValid())
 		PreviewBrowser->setUserStyleSheet(*cssUrl);
 	PreviewBrowser->writeStream(QString("<html><body><p>"+text+"</p></body></html>").toAscii() \
);  PreviewBrowser->closeStream();
+*/
 }
 
 bool KBloggerEditor::close(bool destruct)
--- trunk/playground/pim/kblogger/src/kbloggereditor.h #663975:663976
@@ -46,7 +46,7 @@
 	Q_OBJECT
 
 public:
-	KBloggerEditor( KBlog::APIBlog* backend, QDir* tempDir, int postid = -1, QWidget* \
parent = 0, const char* name = 0, Qt::WFlags fl = 0 ); +	KBloggerEditor( \
KBlog::APIBlog* backend, const QString& tempDir,KStatusBar* statusBar, int postid = \
-1, QWidget* parent = 0 );  ~KBloggerEditor();
 	enum tags{ generic=0, img, imglinked, link, notags, };
 
--- trunk/playground/pim/kblogger/src/main.cpp #663975:663976
@@ -5,13 +5,13 @@
 #include <klocale.h>
 
 static const char description[] =
-    I18N_NOOP("A KDE 4 Application");
+    I18N_NOOP("A KDE4 Application for blogging");
 
 static const char version[] = "0.8";
 
 static KCmdLineOptions options[] =
 {
-    { "+[URL]", I18N_NOOP( "Document to open" ), 0 },
+    { "+[URL]", I18N_NOOP( "Document to blog" ), 0 },
     KCmdLineLastOption
 };
 
@@ -19,6 +19,7 @@
 {
     KAboutData about("kblogger", I18N_NOOP("kblogger"), version, description,
                      KAboutData::License_GPL, "(C) 2007 Antonio Aloisio", 0, 0, \
"gnuton@gnuton.org"); +    about.addAuthor( "Christian Weilbach", 0, \
"christian_weilbach@web.de" );  about.addAuthor( "Antonio Aloisio", 0, \
"gnuton@gnuton.org" );  KCmdLineArgs::init(argc, argv, &about);
     KCmdLineArgs::addCmdLineOptions(options);


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

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