[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdebase/workspace/klipper
From: Ryan James Rix <ry () n ! rix ! si>
Date: 2010-07-22 20:51:49
Message-ID: 20100722205149.5D6E0AC7AB () svn ! kde ! org
[Download RAW message or body]
SVN commit 1153227 by ryanrix:
Adds dmtx barcode support to Klipper. This patch was
written by Sune Vuorela <nospam@vuorela.dk> and backported to
trunk from 4.4.4 by me.
Tested and WORKSFORME both with and without libdmtx.
CCMAIL: nospam@vourela.dk
CCBUG: 241895
M +17 -0 CMakeLists.txt
M +36 -0 klipper.cpp
M +6 -0 klipper.h
A mobilebarcode.cpp [License: BSD X11 (BSD like)]
A mobilebarcode.h [License: BSD X11 (BSD like)]
--- trunk/KDE/kdebase/workspace/klipper/CMakeLists.txt #1153226:1153227
@@ -1,5 +1,7 @@
kde4_no_enable_final(klipper)
+find_package(Dmtx)
+
set(libklipper_common_SRCS
klipper.cpp
urlgrabber.cpp
@@ -17,6 +19,18 @@
clipcommandprocess.cpp
)
+if(DMTX_FOUND)
+ MESSAGE(STATUS "Found Datamatrix library, will use it to give possibility to \
show mobile barcodes of clipboard data") + set(libklipper_common_SRCS \
${libklipper_common_SRCS} mobilebarcode.cpp) + add_definitions(-DHAVE_DMTX)
+else(DMTX_FOUND)
+ MESSAGE(STATUS "Datamatrix library not found. Consider installing it to create \
mobile barcodes from clipboard data. See http://wwwlibdmtx.org") +endif(DMTX_FOUND)
+
+macro_log_feature(DMTX_FOUND "Dmtx" "Datamatrix library" "http://www.libdmtx.org" \
FALSE "" "Needed to provide create mobile barcodes from clipboard data") \
+include_directories(${QNTRACK_INCLUDE_DIR}) +
+
kde4_add_app_icon(libklipper_common_SRCS \
"${KDE4_ICON_INSTALL_DIR}/oxygen/*/apps/klipper.png") \
kde4_add_ui_files(libklipper_common_SRCS generalconfig.ui actionsconfig.ui \
editactiondialog.ui) kde4_add_kcfg_files(libklipper_common_SRCS \
klippersettings.kcfgc) @@ -30,6 +44,9 @@
if (X11_Xfixes_FOUND)
target_link_libraries(kdeinit_klipper ${X11_Xfixes_LIB})
endif (X11_Xfixes_FOUND)
+if (DMTX_FOUND)
+ target_link_libraries(kdeinit_klipper ${DMTX_LIBRARIES})
+endif (DMTX_FOUND)
install(TARGETS kdeinit_klipper ${INSTALL_TARGETS_DEFAULT_ARGS})
install(TARGETS klipper ${INSTALL_TARGETS_DEFAULT_ARGS})
--- trunk/KDE/kdebase/workspace/klipper/klipper.cpp #1153226:1153227
@@ -53,6 +53,10 @@
#include "historystringitem.h"
#include "klipperpopup.h"
+#if HAVE_DMTX
+#include "mobilebarcode.h"
+#endif
+
#include <zlib.h>
#ifdef Q_WS_X11
@@ -204,6 +208,13 @@
qobject_cast<KAction*>(m_editAction)->setGlobalShortcut(KShortcut(Qt::ALT+Qt::CTRL+Qt::Key_E), \
KAction::DefaultShortcut); connect(m_editAction, SIGNAL(triggered()), \
SLOT(slotEditData()));
+#if HAVE_DMTX
+ // add barcode for mobile phones
+ m_showBarcodeAction = m_collection->addAction("show_barcode");
+ m_showBarcodeAction->setText(i18n("&Show barcode..."));
+ connect(m_showBarcodeAction, SIGNAL(triggered()), SLOT(slotShowBarcode()));
+#endif
+
// Cycle through history
m_cycleNextAction = m_collection->addAction("cycleNextAction");
m_cycleNextAction->setText(i18n("Next History Item"));
@@ -231,6 +242,9 @@
popup->plugAction( m_configureAction );
popup->plugAction( m_repeatAction );
popup->plugAction( m_editAction );
+#ifdef HAVE_DMTX
+ popup->plugAction( m_showBarcodeAction );
+#endif
if ( !isApplet() ) {
popup->plugAction( m_quitAction );
}
@@ -1109,6 +1123,28 @@
}
+#ifdef HAVE_DMTX
+void Klipper::slotShowBarcode()
+{
+ const HistoryStringItem* item = dynamic_cast<const \
HistoryStringItem*>(m_history->first()); +
+ KDialog dlg;
+ dlg.setModal( true );
+ dlg.setCaption( i18n("Mobile barcode") );
+ dlg.setButtons( KDialog::Ok );
+
+ MobileBarcode::DataMatrixWidget* barcode = new MobileBarcode::DataMatrixWidget( \
&dlg ); + if (item) {
+ barcode->setData( item->text() );
+ }
+ barcode->setFocus();
+ dlg.setMainWidget( barcode );
+ dlg.adjustSize();
+
+ dlg.exec();
+}
+#endif //HAVE_DMTX
+
void Klipper::slotAskClearHistory()
{
int clearHist = KMessageBox::questionYesNo(0,
--- trunk/KDE/kdebase/workspace/klipper/klipper.h #1153226:1153227
@@ -99,6 +99,9 @@
void slotHistoryTopChanged();
void slotConfigure();
void slotEditData();
+#ifdef HAVE_DMTX
+ void slotShowBarcode();
+#endif
void slotCycleNext();
void slotCyclePrev();
@@ -198,6 +201,9 @@
QAction* m_clearHistoryAction;
QAction* m_repeatAction;
QAction* m_editAction;
+#ifdef HAVE_DMTX
+ QAction* m_showBarcodeAction;
+#endif
QAction* m_configureAction;
QAction* m_quitAction;
KAction* m_cycleNextAction;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic