|
|
@ -252,7 +252,7 @@ Knowit::Knowit(TQWidget*, const char *name) : KMainWindow(0, name),
|
|
|
|
TQT_SLOT(slotItemEnd()), actionCollection(), "note_end");
|
|
|
|
TQT_SLOT(slotItemEnd()), actionCollection(), "note_end");
|
|
|
|
new KAction(i18n("Go to first subnote"), "", "Alt+Right", TQT_TQOBJECT(Items),
|
|
|
|
new KAction(i18n("Go to first subnote"), "", "Alt+Right", TQT_TQOBJECT(Items),
|
|
|
|
TQT_SLOT(slotItemRight()), actionCollection(), "note_right");
|
|
|
|
TQT_SLOT(slotItemRight()), actionCollection(), "note_right");
|
|
|
|
new KAction(i18n("Go to tqparent note"), "", "Alt+Left", TQT_TQOBJECT(Items),
|
|
|
|
new KAction(i18n("Go to parent note"), "", "Alt+Left", TQT_TQOBJECT(Items),
|
|
|
|
TQT_SLOT(slotItemLeft()), actionCollection(), "note_left");
|
|
|
|
TQT_SLOT(slotItemLeft()), actionCollection(), "note_left");
|
|
|
|
|
|
|
|
|
|
|
|
/* Actions */
|
|
|
|
/* Actions */
|
|
|
@ -349,15 +349,15 @@ bool Knowit::open(const KURL& fname)
|
|
|
|
name = ls.readLine();
|
|
|
|
name = ls.readLine();
|
|
|
|
name = name.stripWhiteSpace();
|
|
|
|
name = name.stripWhiteSpace();
|
|
|
|
if (depth == prevdepth) /* same level */
|
|
|
|
if (depth == prevdepth) /* same level */
|
|
|
|
if (depth) current = new KListViewItem(current->tqparent(), current, name);
|
|
|
|
if (depth) current = new KListViewItem(current->parent(), current, name);
|
|
|
|
else current = new KListViewItem(Items, current, name);
|
|
|
|
else current = new KListViewItem(Items, current, name);
|
|
|
|
else if (depth > prevdepth) /* subnote */
|
|
|
|
else if (depth > prevdepth) /* subnote */
|
|
|
|
current = new KListViewItem(current, name);
|
|
|
|
current = new KListViewItem(current, name);
|
|
|
|
else { /* tqparent note */
|
|
|
|
else { /* parent note */
|
|
|
|
for(uint i=depth; i<prevdepth && current; i++)
|
|
|
|
for(uint i=depth; i<prevdepth && current; i++)
|
|
|
|
current = current->tqparent();
|
|
|
|
current = current->parent();
|
|
|
|
if (current && current->tqparent())
|
|
|
|
if (current && current->parent())
|
|
|
|
current = new KListViewItem(current->tqparent(), current, name);
|
|
|
|
current = new KListViewItem(current->parent(), current, name);
|
|
|
|
else current = new KListViewItem(Items, current, name);
|
|
|
|
else current = new KListViewItem(Items, current, name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
prevdepth = depth;
|
|
|
|
prevdepth = depth;
|
|
|
@ -627,8 +627,8 @@ void Knowit::slotNoteAdd()
|
|
|
|
i18n("Note title:"), Options.defaultName, &Ok);
|
|
|
|
i18n("Note title:"), Options.defaultName, &Ok);
|
|
|
|
if (!Ok) return;
|
|
|
|
if (!Ok) return;
|
|
|
|
if (Items->currentItem())
|
|
|
|
if (Items->currentItem())
|
|
|
|
if (Items->currentItem()->tqparent())
|
|
|
|
if (Items->currentItem()->parent())
|
|
|
|
elt = new KListViewItem(Items->currentItem()->tqparent(),
|
|
|
|
elt = new KListViewItem(Items->currentItem()->parent(),
|
|
|
|
Items->currentItem(), text);
|
|
|
|
Items->currentItem(), text);
|
|
|
|
else
|
|
|
|
else
|
|
|
|
elt = new KListViewItem(Items, Items->currentItem(), text);
|
|
|
|
elt = new KListViewItem(Items, Items->currentItem(), text);
|
|
|
@ -672,14 +672,14 @@ void Knowit::slotNoteRemove()
|
|
|
|
"and its subnotes?</qt>") :
|
|
|
|
"and its subnotes?</qt>") :
|
|
|
|
i18n("<qt>Are you sure you want to delete note<br><b>%1</b>?</qt>");
|
|
|
|
i18n("<qt>Are you sure you want to delete note<br><b>%1</b>?</qt>");
|
|
|
|
if (KMessageBox::questionYesNo(0, msg.tqarg(elt->text(0))) == KMessageBox::Yes) {
|
|
|
|
if (KMessageBox::questionYesNo(0, msg.tqarg(elt->text(0))) == KMessageBox::Yes) {
|
|
|
|
TQListViewItem* tqparent = elt->tqparent();
|
|
|
|
TQListViewItem* parent = elt->parent();
|
|
|
|
Notes.removeNote(elt);
|
|
|
|
Notes.removeNote(elt);
|
|
|
|
if (!Notes.count())
|
|
|
|
if (!Notes.count())
|
|
|
|
slotActionUpdate();
|
|
|
|
slotActionUpdate();
|
|
|
|
if (!tqparent)
|
|
|
|
if (!parent)
|
|
|
|
tqparent = Items->firstChild();
|
|
|
|
parent = Items->firstChild();
|
|
|
|
Items->prevItem = 0;
|
|
|
|
Items->prevItem = 0;
|
|
|
|
slotNoteChanged(tqparent);
|
|
|
|
slotNoteChanged(parent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -722,7 +722,7 @@ void Knowit::slotNoteMoveUp()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TQListViewItem* elt = Items->currentItem();
|
|
|
|
TQListViewItem* elt = Items->currentItem();
|
|
|
|
if (elt && elt->itemAbove()) {
|
|
|
|
if (elt && elt->itemAbove()) {
|
|
|
|
TQListViewItem* above = elt->tqparent() ? elt->tqparent()->firstChild()
|
|
|
|
TQListViewItem* above = elt->parent() ? elt->parent()->firstChild()
|
|
|
|
: Items->firstChild();
|
|
|
|
: Items->firstChild();
|
|
|
|
if (above == elt)
|
|
|
|
if (above == elt)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
@ -733,9 +733,9 @@ void Knowit::slotNoteMoveUp()
|
|
|
|
if (above)
|
|
|
|
if (above)
|
|
|
|
elt->moveItem(above);
|
|
|
|
elt->moveItem(above);
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
TQListViewItem* tqparent = elt->tqparent();
|
|
|
|
TQListViewItem* parent = elt->parent();
|
|
|
|
Items->takeNode(elt);
|
|
|
|
Items->takeNode(elt);
|
|
|
|
Items->insertNode(tqparent, elt);
|
|
|
|
Items->insertNode(parent, elt);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
slotNoteChanged(elt);
|
|
|
|
slotNoteChanged(elt);
|
|
|
|
Notes.modified = true;
|
|
|
|
Notes.modified = true;
|
|
|
@ -756,11 +756,11 @@ void Knowit::slotNoteMoveBegin()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TQListViewItem* elt = Items->currentItem();
|
|
|
|
TQListViewItem* elt = Items->currentItem();
|
|
|
|
if (elt) {
|
|
|
|
if (elt) {
|
|
|
|
TQListViewItem* tqparent = elt->tqparent();
|
|
|
|
TQListViewItem* parent = elt->parent();
|
|
|
|
Items->takeNode(elt);
|
|
|
|
Items->takeNode(elt);
|
|
|
|
Items->insertItem(elt);
|
|
|
|
Items->insertItem(elt);
|
|
|
|
if (tqparent)
|
|
|
|
if (parent)
|
|
|
|
Notes.find(tqparent)->updateView();
|
|
|
|
Notes.find(parent)->updateView();
|
|
|
|
slotNoteChanged(elt);
|
|
|
|
slotNoteChanged(elt);
|
|
|
|
Notes.modified = true;
|
|
|
|
Notes.modified = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -772,15 +772,15 @@ void Knowit::slotNoteMoveEnd()
|
|
|
|
if (!elt)
|
|
|
|
if (!elt)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
TQListViewItem* last = Items->firstChild();
|
|
|
|
TQListViewItem* last = Items->firstChild();
|
|
|
|
TQListViewItem* tqparent = elt->tqparent();
|
|
|
|
TQListViewItem* parent = elt->parent();
|
|
|
|
while (last->nextSibling())
|
|
|
|
while (last->nextSibling())
|
|
|
|
last = last->nextSibling();
|
|
|
|
last = last->nextSibling();
|
|
|
|
if (elt && elt != last) {
|
|
|
|
if (elt && elt != last) {
|
|
|
|
Items->takeNode(elt);
|
|
|
|
Items->takeNode(elt);
|
|
|
|
Items->insertNode(0, elt, last);
|
|
|
|
Items->insertNode(0, elt, last);
|
|
|
|
slotNoteChanged(elt);
|
|
|
|
slotNoteChanged(elt);
|
|
|
|
if (tqparent)
|
|
|
|
if (parent)
|
|
|
|
Notes.find(tqparent)->updateView();
|
|
|
|
Notes.find(parent)->updateView();
|
|
|
|
Notes.modified = true;
|
|
|
|
Notes.modified = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -788,11 +788,11 @@ void Knowit::slotNoteMoveEnd()
|
|
|
|
void Knowit::slotNoteMoveLeft()
|
|
|
|
void Knowit::slotNoteMoveLeft()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TQListViewItem* elt = Items->currentItem();
|
|
|
|
TQListViewItem* elt = Items->currentItem();
|
|
|
|
TQListViewItem* tqparent = elt->tqparent();
|
|
|
|
TQListViewItem* parent = elt->parent();
|
|
|
|
if (elt && tqparent) {
|
|
|
|
if (elt && parent) {
|
|
|
|
Items->takeNode(elt);
|
|
|
|
Items->takeNode(elt);
|
|
|
|
Items->insertNode(tqparent->tqparent(), elt, tqparent);
|
|
|
|
Items->insertNode(parent->parent(), elt, parent);
|
|
|
|
Notes.find(tqparent)->updateView();
|
|
|
|
Notes.find(parent)->updateView();
|
|
|
|
slotNoteChanged(elt);
|
|
|
|
slotNoteChanged(elt);
|
|
|
|
Notes.modified = true;
|
|
|
|
Notes.modified = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -811,9 +811,9 @@ void Knowit::slotNoteMoveRight()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
while (above->depth() > elt->depth()+1)
|
|
|
|
while (above->depth() > elt->depth()+1)
|
|
|
|
above = above->tqparent();
|
|
|
|
above = above->parent();
|
|
|
|
Items->takeNode(elt);
|
|
|
|
Items->takeNode(elt);
|
|
|
|
Items->insertNode(above->tqparent(), elt, above);
|
|
|
|
Items->insertNode(above->parent(), elt, above);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Notes.find(above)->updateView();
|
|
|
|
Notes.find(above)->updateView();
|
|
|
|
slotNoteChanged(elt);
|
|
|
|
slotNoteChanged(elt);
|
|
|
|