commit 41f7de10553c7280ee0221751a05a57f56c1fd54
parent f71f07bc362b595ecb6a17a7166e1969046bf16d
Author: cfillion <cfillion@users.noreply.github.com>
Date: Wed, 14 Dec 2016 23:29:10 -0500
about: make Ctrl+C copy pkg name or source url
Diffstat:
2 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/src/about.cpp b/src/about.cpp
@@ -92,6 +92,19 @@ void About::onCommand(const int id, int)
}
}
+bool About::onKeyDown(const int key, const int mods)
+{
+ if(GetFocus() != m_list->handle())
+ return false;
+
+ if(mods == CtrlModifier && key == 'C')
+ m_delegate->itemCopy();
+ else
+ return false;
+
+ return true;
+}
+
void About::setDelegate(const DelegatePtr &delegate, const bool focus)
{
if(focus)
@@ -421,6 +434,12 @@ void AboutIndexDelegate::aboutPackage()
m_dialog->setDelegate(make_shared<AboutPackageDelegate>(pkg, current, m_reapack));
}
+void AboutIndexDelegate::itemCopy()
+{
+ if(const Package *pkg = currentPackage())
+ m_dialog->setClipboard(pkg->displayName(m_reapack->config()->browser.showDescs));
+}
+
void AboutIndexDelegate::install()
{
enum { INSTALL_ALL = 80, UPDATE_ONLY };
diff --git a/src/about.hpp b/src/about.hpp
@@ -59,6 +59,7 @@ public:
protected:
void onInit() override;
void onCommand(int, int) override;
+ bool onKeyDown(int, int) override;
private:
void selectLink(int control);
@@ -84,6 +85,7 @@ protected:
virtual void updateList(int) = 0;
virtual bool fillContextMenu(Menu &, int) const = 0;
virtual void itemActivated() = 0;
+ virtual void itemCopy() = 0;
virtual void onCommand(int) = 0;
virtual const void *data() const = 0;
@@ -98,6 +100,7 @@ protected:
void updateList(int) override;
bool fillContextMenu(Menu &, int) const override;
void itemActivated() override { aboutPackage(); }
+ void itemCopy() override;
void onCommand(int) override;
const void *data() const override
@@ -126,6 +129,7 @@ protected:
void updateList(int) override;
bool fillContextMenu(Menu &, int) const override;
void itemActivated() override { locate(); }
+ void itemCopy() override { copySourceUrl(); }
void onCommand(int) override;
const void *data() const override