diff options
| author | 2008-04-29 15:47:43 +0000 | |
|---|---|---|
| committer | 2008-04-29 15:47:43 +0000 | |
| commit | 2a4fc1efb27bd3a6ea04fd7a89cb26efe805df33 (patch) | |
| tree | eeeba944e406de9951d338630903fb0854dfdd9e /src | |
| parent | more work on alias editor QT4 port (wip) and fix. (diff) | |
| download | KVIrc-2a4fc1efb27bd3a6ea04fd7a89cb26efe805df33.tar.gz KVIrc-2a4fc1efb27bd3a6ea04fd7a89cb26efe805df33.tar.bz2 KVIrc-2a4fc1efb27bd3a6ea04fd7a89cb26efe805df33.zip | |
more work on alias editor QT4 port (wip) and fix.
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@1623 17fca916-40b9-46aa-a4ea-0a15b648b75c
Diffstat (limited to 'src')
| -rw-r--r-- | src/modules/aliaseditor/aliaseditor.cpp | 2 | ||||
| -rw-r--r-- | src/modules/editor/scripteditor.cpp | 58 |
2 files changed, 26 insertions, 34 deletions
diff --git a/src/modules/aliaseditor/aliaseditor.cpp b/src/modules/aliaseditor/aliaseditor.cpp index dd4980716..1913ca246 100644 --- a/src/modules/aliaseditor/aliaseditor.cpp +++ b/src/modules/aliaseditor/aliaseditor.cpp @@ -1431,6 +1431,7 @@ void KviAliasEditor::saveLastEditedItem() {
if(!m_pLastEditedItem){debug ("Nothing to save");return;}
debug("Check last edit item %s",m_pLastEditedItem->text(0).toUtf8().data());
+ ((KviAliasListViewItem *)m_pLastEditedItem)->setCursorPosition(m_pEditor->getCursor());
if(!m_pEditor->isModified()){debug ("Alreary saved");return;} // nothing to save
if(!itemExists(m_pLastEditedItem)){debug("Item does not exists");return;} // dead ?
if(m_pLastEditedItem->isNamespace()){debug("Is namespace");return;}
@@ -1440,7 +1441,6 @@ void KviAliasEditor::saveLastEditedItem() debug("Saving %s",newCode.toUtf8().data());
((KviAliasListViewItem *)m_pLastEditedItem)->setBuffer(newCode);
- ((KviAliasListViewItem *)m_pLastEditedItem)->setCursorPosition(m_pEditor->getCursor());
}
void KviAliasEditor::currentItemChanged(QTreeWidgetItem *it,QTreeWidgetItem *prev)
diff --git a/src/modules/editor/scripteditor.cpp b/src/modules/editor/scripteditor.cpp index 2004f7220..bf4206f11 100644 --- a/src/modules/editor/scripteditor.cpp +++ b/src/modules/editor/scripteditor.cpp @@ -1141,23 +1141,15 @@ int KviScriptEditorImplementation::getCursor() void KviScriptEditorImplementation::setCursorPosition(int pos)
{
-debug("Set cursor position to %d",pos);
- m_pEditor->textCursor().setPosition(pos,QTextCursor::MoveAnchor);
- /*
- m_pEditor->setCursorPosition(pos.x(),pos.y());int
- m_pEditor->setFocus();
- m_pEditor->ensureCursorVisible();
- QString tmp;
- KviQString::sprintf(tmp,__tr2qs_ctx("Row: %d Col: %d","editor"),pos.x(),pos.y());
- m_pRowColLabel->setText(tmp);
-
- m_lastCursorPos=pos;
- */
+ QTextCursor cur=m_pEditor->textCursor();
+ cur.setPosition(pos);
+ m_pEditor->setTextCursor(cur);
+ updateRowColLabel();
}
void KviScriptEditorImplementation::loadFromFile()
{
- /*
+
QString fName;
if(KviFileDialog::askForOpenFileName(fName,
__tr2qs_ctx("Load Script File - KVIrc","editor"),
@@ -1168,8 +1160,9 @@ void KviScriptEditorImplementation::loadFromFile() if(KviFileUtils::loadFile(fName,buffer))
{
m_pEditor->setText(buffer);
- m_pEditor->moveCursor(KviTalTextEdit::MoveEnd,false);
- updateRowColLabel();
+ setCursorPosition(0);
+ //m_pEditor->moveCursor(KviTalTextEdit::MoveEnd,false);
+ //updateRowColLabel();
} else {
QString tmp;
QMessageBox::warning(this,
@@ -1177,7 +1170,6 @@ void KviScriptEditorImplementation::loadFromFile() KviQString::sprintf(tmp,__tr2qs_ctx("Can't open the file %s for reading.","editor"),&fName));
}
}
- */
}
void KviScriptEditorImplementation::configureColors()
@@ -1201,47 +1193,47 @@ KviScriptEditorReplaceDialog::KviScriptEditorReplaceDialog( QWidget* parent, con p.setColor(backgroundRole(),QColor( 236, 233, 216 ));
setPalette(p);
-QGridLayout *layout = new QGridLayout( this, 1, 1, 11, 6, "replace layout");
-
- m_pFindlineedit = new QLineEdit( this, "findlineedit" );
- layout->addWidget(m_pFindlineedit,2,2,0,1);
- //layout->addMultiCellWidget( m_pFindlineedit, 2, 2, 1, 2 );
-
- m_pReplacelineedit = new QLineEdit( this, "replacelineedit" );
- layout->addWidget( m_pReplacelineedit,3,3,0,1);
- //3, 3, 1, 2 );
+ QGridLayout *layout = new QGridLayout( this, 1, 1, 11, 6, "replace layout");
- m_pFindlineedit->setFocus();
QLabel *findlabel = new QLabel( this, "findlabel" );
findlabel->setText(tr("Word to Find"));
- layout->addWidget( findlabel, 2, 0 );
+ layout->addWidget( findlabel, 0, 0 );
+
+ m_pFindlineedit = new QLineEdit( this, "findlineedit" );
+ layout->addWidget(m_pFindlineedit,0,1);
+
QLabel *replacelabel = new QLabel( this, "replacelabel" );
replacelabel->setText(tr("Replace with"));
- layout->addWidget( replacelabel, 3, 0 );
+ layout->addWidget( replacelabel, 1, 0 );
+
+ m_pReplacelineedit = new QLineEdit( this, "replacelineedit" );
+ layout->addWidget( m_pReplacelineedit,1,1);
+
+ m_pFindlineedit->setFocus();
QPushButton *cancelbutton = new QPushButton( this, "cancelButton" );
cancelbutton->setText(tr("&Cancel"));
- layout->addWidget( cancelbutton, 5, 2 );
+ layout->addWidget( cancelbutton, 3, 1 );
replacebutton = new QPushButton( this, "replacebutton" );
replacebutton->setText(tr("&Replace"));
replacebutton->setEnabled( FALSE );
- layout->addWidget( replacebutton, 5, 0 );
+ layout->addWidget( replacebutton, 3, 2 );
checkReplaceAll = new KviStyledCheckBox( this, "replaceAll" );
checkReplaceAll->setText(tr("&Replace in all Aliases"));
- layout->addWidget( checkReplaceAll, 4, 0 );
+ layout->addWidget( checkReplaceAll, 2, 0 );
findNext = new QPushButton(this, "findNext(WIP)" );
findNext->setText(tr("&Findnext"));
- layout->addWidget( findNext, 2, 3 );
+ layout->addWidget( findNext, 0, 2 );
findNext->setEnabled(false);
replace = new QPushButton(this, "replace" );
replace->setText(tr("&Replace(WIP)"));
- layout->addWidget( replace, 3, 3 );
+ layout->addWidget( replace, 1, 2 );
replace->setEnabled(false);
// signals and slots connections
|
