<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -22,6 +22,7 @@
 #define BASKETDCOPINTERFACE_H
 
 #include &lt;dcopobject.h&gt;
+#include &lt;qstringlist.h&gt;
 
 /**
 	@author Petri Damsten &lt;petri.damsten@iki.fi&gt;
@@ -33,7 +34,11 @@ class BasketDcopInterface : virtual public DCOPObject
     virtual ASYNC newBasket() = 0;
 	virtual void handleCommandLine() = 0;
 
+	virtual bool createNoteHtml(const QString content, const QString basket) = 0;
 	virtual void reloadBasket(const QString &amp;folderName) = 0;
+	virtual QStringList listBaskets() = 0;
+	virtual bool createNoteFromFile(const QString url, const QString basket) = 0;
+	virtual bool changeNoteHtml(const QString content, const QString basket, const QString noteName) = 0;
 };
 
 #endif</diff>
      <filename>src/basketdcopiface.h</filename>
    </modified>
    <modified>
      <diff>@@ -74,6 +74,8 @@
 #include &quot;crashhandler.h&quot;
 #include &quot;likeback.h&quot;
 #include &quot;backup.h&quot;
+#include &quot;notefactory.h&quot;
+#include &quot;notecontent.h&quot;
 
 /** class BNPView: */
 
@@ -1667,6 +1669,24 @@ Basket* BNPView::basketForFolderName(const QString &amp;folderName)
 	return 0;
 }
 
+Note* BNPView::noteForFileName(const QString &amp;fileName, Basket &amp;basket, Note* note)
+{
+	if (!note)
+		note = basket.firstNote();
+	if (note-&gt;fullPath().endsWith(fileName))
+		return note;
+	Note* child = note-&gt;firstChild();
+	Note* found;
+	while(child)
+	{
+		found = noteForFileName(fileName, basket, child);
+		if (found)
+			return found;
+		child = child-&gt;next();
+	}
+	return 0;
+}
+
 void BNPView::setFiltering(bool filtering)
 {
 	m_actShowFilter-&gt;setChecked(filtering);
@@ -2149,6 +2169,61 @@ void BNPView::newBasket()
 	askNewBasket();
 }
 
+bool BNPView::createNoteHtml(const QString content, const QString basket)
+{
+	Basket* b = basketForFolderName(basket);
+	if (!b)
+		return false;
+	Note* note = NoteFactory::createNoteHtml(content, b);
+	if (!note)
+		return false;
+	b -&gt; insertCreatedNote(note);
+	return true;
+}
+
+bool BNPView::changeNoteHtml(const QString content, const QString basket, const QString noteName)
+{
+	Basket* b = basketForFolderName(basket);
+	if (!b)
+		return false;
+	Note* note = noteForFileName(noteName , *b);
+	if (!note || note-&gt;content()-&gt;type()!=NoteType::Html)
+		return false;
+	HtmlContent* noteContent = (HtmlContent*)note-&gt;content();
+	noteContent-&gt;setHtml(content);
+	note-&gt;saveAgain();
+	return true;
+}
+
+bool BNPView::createNoteFromFile(const QString url, const QString basket)
+{
+	Basket* b = basketForFolderName(basket);
+	if (!b)
+		return false;
+	KURL kurl(url);
+	if ( url.isEmpty() )
+		return false;
+	Note* n = NoteFactory::copyFileAndLoad(kurl, b);
+	if (!n)
+		return false;
+	b-&gt;insertCreatedNote(n);
+	return true;
+}
+
+QStringList BNPView::listBaskets()
+{
+	QStringList basketList;
+
+	QListViewItemIterator it(m_tree);
+	while (it.current()) {
+		BasketListViewItem *item = ((BasketListViewItem*)it.current());
+		basketList.append(item-&gt;basket()-&gt;basketName());
+		basketList.append(item-&gt;basket()-&gt;folderName());
+		++it;
+	}	
+	return basketList;
+}
+
 void BNPView::handleCommandLine()
 {
 	KCmdLineArgs *args = KCmdLineArgs::parsedArgs();</diff>
      <filename>src/bnpview.cpp</filename>
    </modified>
    <modified>
      <diff>@@ -281,6 +281,7 @@ class BNPView : public QSplitter, virtual public BasketDcopInterface
 		BasketListViewItem* appendBasket(Basket *basket, QListViewItem *parentItem); // Public only for class Archive
 
 		Basket* basketForFolderName(const QString &amp;folderName);
+		Note* noteForFileName(const QString &amp;fileName, Basket &amp;basket, Note* note = 0);
 		QPopupMenu* popupMenu(const QString &amp;menuName);
 		bool isPart();
 		bool isMainWindowActive();
@@ -290,6 +291,10 @@ class BNPView : public QSplitter, virtual public BasketDcopInterface
 		virtual void newBasket();
 		virtual void handleCommandLine();
 		virtual void reloadBasket(const QString &amp;folderName);
+		virtual bool createNoteHtml(const QString content, const QString basket);
+		virtual QStringList listBaskets();
+		virtual bool createNoteFromFile(const QString url, const QString basket);
+		virtual bool changeNoteHtml(const QString content, const QString basket, const QString noteName);
 
 	public slots:
 		void setCaption(QString s);</diff>
      <filename>src/bnpview.h</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>707b14be95afc4591d2c35c65587d849a17dd1c6</id>
    </parent>
  </parents>
  <author>
    <name>seb</name>
    <email>seb@68e0c82f-6715-0410-a4b6-c4571a790354</email>
  </author>
  <url>http://github.com/kelvie/basket/commit/bbc0e1e26dc29042444a45fb1062b4ad20ffda80</url>
  <id>bbc0e1e26dc29042444a45fb1062b4ad20ffda80</id>
  <committed-date>2007-09-17T13:00:14-07:00</committed-date>
  <authored-date>2007-09-17T13:00:14-07:00</authored-date>
  <message>Patch from Romain H. to create notes from the DCOP interface.


git-svn-id: http://basket.linux62.org/svn/basket/trunk@555 68e0c82f-6715-0410-a4b6-c4571a790354</message>
  <tree>118575a86c762eda9e84b77a3ece75a74aa9d4ff</tree>
  <committer>
    <name>seb</name>
    <email>seb@68e0c82f-6715-0410-a4b6-c4571a790354</email>
  </committer>
</commit>
