Release 0.4.3-3maemo with patches to disable menus/actions, add ScrollArea and fix...
[keepassx] / debian / patches / 10_RemoveSystray.dpatch
1 #! /bin/sh /usr/share/dpatch/dpatch-run
2 ## 10_RemoveSystray.dpatch by  <yma@>
3 ##
4 ## All lines beginning with `## DP:' are a description of the patch.
5 ## DP: No description.
6
7 @DPATCH@
8 diff -urNad keepassx-0.4.3~/src/main.cpp keepassx-0.4.3/src/main.cpp
9 --- keepassx-0.4.3~/src/main.cpp        2010-12-30 00:32:17.000000000 +0100
10 +++ keepassx-0.4.3/src/main.cpp 2010-12-30 00:50:22.000000000 +0100
11 @@ -56,6 +56,13 @@
12  #else
13         QApplication* app = new QApplication(argc,argv);
14  #endif
15 +
16 +#ifdef Q_WS_HILDON
17 +       QFont font = app->font();
18 +       font.setPointSize( font.pointSize()-4 );
19 +       app->setFont( font );
20 +#endif
21 +       
22         EventListener* eventListener = new EventListener();
23         app->installEventFilter(eventListener);
24         
25 diff -urNad keepassx-0.4.3~/src/mainwindow.cpp keepassx-0.4.3/src/mainwindow.cpp
26 --- keepassx-0.4.3~/src/mainwindow.cpp  2010-12-30 00:32:17.000000000 +0100
27 +++ keepassx-0.4.3/src/mainwindow.cpp   2010-12-30 00:50:22.000000000 +0100
28 @@ -73,7 +73,9 @@
29                 restoreGeometry(windowGeo);
30         VSplitter->restoreState(config->vSplitterPos());
31         HSplitter->restoreState(config->hSplitterPos());
32 +#ifndef        Q_WS_HILDON
33         SysTray=new QSystemTrayIcon(this);
34 +#endif
35         setupToolbar();
36         setupIcons();
37         setStateFileOpen(false);
38 @@ -211,7 +213,9 @@
39         connect(EntryView, SIGNAL(viewModeChanged(bool)), SLOT(loadColumnVisibility()));
40         connect(EntryView, SIGNAL(viewModeChanged(bool)), ViewColumnsGroupAction, SLOT(setVisible(bool)));
41  
42 +#ifndef Q_WS_HILDON
43         connect(SysTray,SIGNAL(activated(QSystemTrayIcon::ActivationReason)),this,SLOT(OnSysTrayActivated(QSystemTrayIcon::ActivationReason)));
44 +#endif
45         connect(DetailView,SIGNAL(anchorClicked(const QUrl&)),this,SLOT(OnDetailViewUrlClicked(const QUrl&)));
46         connect(WorkspaceLockedWidget.Button_Unlock,SIGNAL(clicked()),this,SLOT(OnUnLockWorkspace()));
47         connect(WorkspaceLockedWidget.Button_CloseDatabase,SIGNAL(clicked()),this,SLOT(OnLockClose()));
48 @@ -282,9 +286,11 @@
49         AddThisAsBookmarkAction->setIcon(getIcon("bookmark_this"));
50         AddBookmarkAction->setIcon(getIcon("bookmark_add"));
51         ManageBookmarksAction->setIcon(getIcon("bookmark"));
52 +#ifndef Q_WS_HILDON
53         SysTray->setIcon(getIcon("keepassx"));
54         if(config->showSysTrayIcon())
55                 SysTray->show();
56 +#endif
57  }
58  
59  void KeepassMainWindow::setupMenus(){
60 @@ -336,9 +342,11 @@
61         SysTrayMenu->addAction(FileUnLockWorkspaceAction);
62         SysTrayMenu->addSeparator();
63         SysTrayMenu->addAction(FileExitAction);
64 +#ifndef Q_WS_HILDON
65         SysTray->setContextMenu(SysTrayMenu);
66         updateTrayTooltip();
67 -
68 +#endif
69 +       
70         #define _add_import(name){\
71         QAction* import=new QAction(this);\
72         import->setData(qVariantFromValue(dynamic_cast<QObject*>(&name)));\
73 @@ -1102,7 +1110,9 @@
74                 config->setHSplitterPos(HSplitter->saveState());
75         config->setShowStatusbar(statusBar()->isVisible());
76         
77 +#ifndef Q_WS_HILDON
78         delete SysTray;
79 +#endif
80         QMainWindow::closeEvent(e);
81         QApplication::quit();
82  }
83 @@ -1153,7 +1163,9 @@
84         }
85         
86         EntryView->setAlternatingRowColors(config->alternatingRowColors());
87 +#ifndef Q_WS_HILDON
88         SysTray->setVisible(config->showSysTrayIcon());
89 +#endif
90         menuBookmarks->menuAction()->setVisible(config->featureBookmarks());
91  #ifndef Q_WS_MAC
92         if (config->alwaysOnTop() != oldAlwaysOnTop) {
93 @@ -1245,6 +1257,7 @@
94         toolBar->setIconSize(QSize(28,28));
95  }
96  
97 +#ifndef Q_WS_HILDON
98  void KeepassMainWindow::OnSysTrayActivated(QSystemTrayIcon::ActivationReason reason){
99         if(reason!=QSystemTrayIcon::Context){
100                 if (isVisible()){
101 @@ -1263,6 +1276,7 @@
102                 }
103         }
104  }
105 +#endif
106  
107  void KeepassMainWindow::restoreWindow(){
108  #ifdef Q_WS_WIN
109 @@ -1371,7 +1385,9 @@
110         NormalCentralWidget->setParent(NULL);
111         setCentralWidget(LockedCentralWidget);
112         LockedCentralWidget->setVisible(true);
113 +#ifndef Q_WS_HILDON
114         SysTray->setIcon(getIcon("keepassx_locked"));
115 +#endif
116         FileUnLockWorkspaceAction->setText(tr("Un&lock Workspace"));
117         IsLocked=true;
118         updateTrayTooltip();
119 @@ -1386,7 +1402,9 @@
120         LockedCentralWidget->setParent(NULL);
121         setCentralWidget(NormalCentralWidget);
122         NormalCentralWidget->setVisible(true);
123 +#ifndef Q_WS_HILDON
124         SysTray->setIcon(getIcon("keepassx"));
125 +#endif
126         FileUnLockWorkspaceAction->setText(tr("&Lock Workspace"));
127         IsLocked=false;
128         updateTrayTooltip();
129 @@ -1510,6 +1528,7 @@
130  }
131  
132  void KeepassMainWindow::updateTrayTooltip() {
133 +#ifndef Q_WS_HILDON
134         if (!IsLocked && !FileOpen)
135                 SysTray->setToolTip(QString("%1 - %2").arg(APP_DISPLAY_NAME, APP_SHORT_FUNC));
136         else {
137 @@ -1519,6 +1538,7 @@
138                         tooltip.append( QString(" (%1)").arg(tr("locked")) );
139                 SysTray->setToolTip(tooltip);
140         }
141 +#endif
142  }
143  
144  void KeepassMainWindow::updateCurrentFile(const QString& filePath) {
145 diff -urNad keepassx-0.4.3~/src/mainwindow.h keepassx-0.4.3/src/mainwindow.h
146 --- keepassx-0.4.3~/src/mainwindow.h    2010-12-30 00:32:17.000000000 +0100
147 +++ keepassx-0.4.3/src/mainwindow.h     2010-12-30 00:50:22.000000000 +0100
148 @@ -129,7 +129,9 @@
149                 QLabel* StatusBarGeneral;
150                 //QLabel* StatusBarSelection;
151                 QToolBar* toolBar;
152 +#ifndef Q_WS_HILDON
153                 QSystemTrayIcon* SysTray;
154 +#endif
155                 QAction* ViewShowToolbarAction;
156                 QMenu* SysTrayMenu;
157                 //QAssistantClient* HelpBrowser; //TODO HelpBrowser