diff options
author | nils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2010-12-22 23:06:04 +0000 |
---|---|---|
committer | nils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2010-12-22 23:06:04 +0000 |
commit | 1cf3eb2174458a0b844287b9c265fc4e92464177 (patch) | |
tree | 9b837881d1e747b3964df89e9f4be39c949191d5 /gpgwin.cpp | |
parent | there may be more than on signature (diff) | |
download | gpg4usb-1cf3eb2174458a0b844287b9c265fc4e92464177.tar.gz gpg4usb-1cf3eb2174458a0b844287b9c265fc4e92464177.zip |
added comment action (to insert > at every line) in edit menu, added drag and drop handling and exported textedit to its own class
git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@407 34ebc366-c3a9-4b3c-9f84-69acf7962910
Diffstat (limited to 'gpgwin.cpp')
-rw-r--r-- | gpgwin.cpp | 24 |
1 files changed, 22 insertions, 2 deletions
@@ -32,7 +32,7 @@ GpgWin::GpgWin() QString appPath = qApp->applicationDirPath(); iconPath = appPath + "/icons/"; - edit = new QPlainTextEdit(); + edit = new TextEdit(); setCentralWidget(edit); // setAcceptDrops(true); @@ -69,6 +69,7 @@ GpgWin::GpgWin() loadFile(args[1]); } } + setAcceptDrops(true); } void GpgWin::restoreSettings() @@ -188,6 +189,10 @@ void GpgWin::createActions() "clipboard")); connect(copyAct, SIGNAL(triggered()), edit, SLOT(copy())); + commentAct = new QAction(tr("Co&mment"), this); + commentAct->setToolTip(tr("Insert > in front of every line")); + connect(commentAct, SIGNAL(triggered()), edit, SLOT(comment())); + selectallAct = new QAction(tr("Select &All"), this); selectallAct->setIcon(QIcon(iconPath + "edit.png")); selectallAct->setShortcut(QKeySequence::SelectAll); @@ -295,6 +300,7 @@ void GpgWin::createMenus() editMenu->addAction(cutAct); editMenu->addAction(pasteAct); editMenu->addAction(selectallAct); + editMenu->addAction(commentAct); editMenu->addSeparator(); editMenu->addAction(openSettingsAct); @@ -795,7 +801,6 @@ void GpgWin::fileEncryption() void GpgWin::openSettingsDialog() { new SettingsDialog(this); -// restoreSettings(); // Iconsize QSize iconSize = settings.value("toolbar/iconsize", QSize(32, 32)).toSize(); this->setIconSize(iconSize); @@ -804,3 +809,18 @@ void GpgWin::openSettingsDialog() Qt::ToolButtonStyle buttonStyle = static_cast<Qt::ToolButtonStyle>(settings.value("toolbar/iconstyle", Qt::ToolButtonTextUnderIcon).toUInt()); this->setToolButtonStyle(buttonStyle); } +void GpgWin::dropEvent(QDropEvent* event) +{ + edit->setPlainText(event->mimeData()->text()); + qDebug() << "drop event main"; + //qDebug() << "hallo"; +// event->acceptProposedAction(); +} + +void GpgWin::dragEnterEvent(QDragEnterEvent *event) +{ + //qDebug() << "hallo"; + qDebug() << event->mimeData()->text(); + if (event->mimeData()->hasFormat("text/plain")) + event->acceptProposedAction(); +} |