Skip to content

Commit

Permalink
Fix copying without pasting from tray menu
Browse files Browse the repository at this point in the history
Fixes #686
  • Loading branch information
hluk committed Apr 12, 2017
1 parent 7a77c25 commit d1d5e89
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/gui/mainwindow.cpp
Expand Up @@ -1775,12 +1775,12 @@ void MainWindow::addMenuItems(TrayMenu *menu, ClipboardBrowser *c, int maxItemCo

void MainWindow::onMenuActionTriggered(ClipboardBrowser *c, uint itemHash, bool omitPaste)
{
if (!c || !m_options.trayItemPaste)
if ( !c || !c->moveToClipboard(itemHash) )
return;

PlatformWindowPtr lastWindow = m_lastWindow;

if ( c->moveToClipboard(itemHash) && lastWindow && !omitPaste && canPaste() )
if ( m_options.trayItemPaste && lastWindow && !omitPaste && canPaste() )
pasteClipboard(lastWindow);
}

Expand Down
30 changes: 30 additions & 0 deletions src/tests/tests.cpp
Expand Up @@ -1987,6 +1987,36 @@ void Tests::traySearch()
WAIT_FOR_CLIPBOARD("B");
}

void Tests::trayPaste()
{
RUN("config" << "tray_tab_is_current" << "false", "false\n");

const auto tab1 = testTab(1);
RUN("setCurrentTab" << tab1, "");
RUN("keys" << "CTRL+N" << ":NEW ", "");

RUN("add" << "TEST", "");
RUN("menu", "");
waitFor(waitMsShow);
RUN("keys" << "ENTER", "");
WAIT_FOR_CLIPBOARD("TEST");

RUN("keys" << "F2", "");
RUN("tab" << tab1 << "read" << "0", "NEW TEST");

RUN("keys" << "CTRL+N" << ":NEW ", "");

RUN("config" << "tray_item_paste" << "false", "false\n");
RUN("add" << "TEST2", "");
RUN("menu", "");
waitFor(waitMsShow);
RUN("keys" << "ENTER", "");
WAIT_FOR_CLIPBOARD("TEST2");

RUN("keys" << "F2", "");
RUN("tab" << tab1 << "read" << "0", "NEW ");
}

void Tests::configTrayTab()
{
const auto tab1 = testTab(1);
Expand Down
1 change: 1 addition & 0 deletions src/tests/tests.h
Expand Up @@ -166,6 +166,7 @@ private slots:
void menu();

void traySearch();
void trayPaste();

// Options for tray menu.
void configTrayTab();
Expand Down

0 comments on commit d1d5e89

Please sign in to comment.