Bug 80719 - remember the cursor's position
Summary: remember the cursor's position
Status: RESOLVED FIXED
Alias: None
Product: kjots
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR wishlist
Target Milestone: ---
Assignee: Jaison Lee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-05-01 00:18 UTC by Dumitru Cristian
Modified: 2005-06-20 04:32 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dumitru Cristian 2004-05-01 00:18:31 UTC
Version:           v0.5 (using KDE 3.2.2,  (testing/unstable))
Compiler:          gcc version 3.3.3 (Debian 20040401)
OS:          Linux (i686) release 2.6.6-rc1

I would like kjots to remember the cursor's position when you open a note.
And also I would like to be able to view a book's content when the book is closed and I select it.
It would also be nice if you could export a html version of your book/s with threads & stuff.
That's all I think.
Comment 1 Jaison Lee 2005-06-20 04:32:26 UTC
SVN commit 427241 by jlee:

FEATURE: 80719
The cursor position will be remembered while the program is running.
It is not saved between sessions, however. I'm not sure that
is necessary.



 M  +0 -1      KJotsMain.cpp  
 M  +10 -3     kjotsentry.cpp  
 M  +2 -0      kjotsentry.h  


--- trunk/KDE/kdeutils/kjots/KJotsMain.cpp #427240:427241
@@ -214,7 +214,6 @@
             this, SLOT(slotExpandBook(QListViewItem*)));
     connect(subjectList, SIGNAL(collapsed(QListViewItem*)),
             this, SLOT(slotCollapseBook(QListViewItem*)));
-//            this, SLOT(jumpToEntry(QListViewItem*)));
     connect(subjectList, SIGNAL(contextMenu(KListView*,QListViewItem*,const QPoint&)),
             this, SLOT(showListviewContextMenu(KListView*,QListViewItem*,const QPoint&)));
     connect(subjectList, SIGNAL(itemRenamed(QListViewItem*,const QString&,int)),
--- trunk/KDE/kdeutils/kjots/kjotsentry.cpp #427240:427241
@@ -844,6 +844,7 @@
     m_editor(0)
 {
     m_isBook = false;
+    m_paraPos = m_indexPos = 0;
     setPixmap(0, kapp->iconLoader()->loadIcon(QString("edit"), KIcon::Small));
 }
 
@@ -1057,10 +1058,15 @@
 void KJotsPage::setEditor( KJotsEdit *editor )
 {
     //out with the old...
-    if ( m_editor && m_editor->edited() )
+    if ( m_editor )
     {
-        m_text = m_editor->text();
-        setDirty(true);
+        m_editor->getCursorPosition(&m_paraPos, &m_indexPos);
+
+        if ( m_editor->edited() )
+        {
+            m_text = m_editor->text();
+            setDirty(true);
+        }
     }
 
     m_editor = editor;
@@ -1069,6 +1075,7 @@
     if ( m_editor )
     {
         m_editor->setEdited(false);
+        m_editor->setCursorPosition(m_paraPos, m_indexPos);
     }
 
     return;
--- trunk/KDE/kdeutils/kjots/kjotsentry.h #427240:427241
@@ -170,6 +170,8 @@
         QTextCodec* m_saveEncoding;
         bool    m_saveToPlainText;
         KJotsEdit *m_editor; //!< ptr to editor if this is the active subject
+        int m_paraPos; //< used to remrmber the cursor position
+        int m_indexPos; //< used to remrmber the cursor position
 };
 
 #endif // __KJOTSENTRY_H